Messages in this thread | | | From | Pavel Tatashin <> | Date | Sat, 23 Jun 2018 17:29:35 -0400 | Subject | Re: [PATCH v12 09/11] x86/tsc: prepare for early sched_clock |
| |
> So you forgot to answer this question. I did not find a system yet, which > actually exposes this behaviour on mainline. > > Is this an artifact of your early sched clock thing? >
Yes, it is. Let me explain how it happens.
So, the problem is introduced in patch "sched: early boot clock" by this change:
- if (unlikely(!sched_clock_running)) - return 0ull; + /* Use early clock until sched_clock_init_late() */ + if (unlikely(sched_clock_running < 2)) + return sched_clock() + __sched_clock_offset;
As soon as sched_clock() starts output non-zero values, we start output time without correcting the output as it is done in sched_clock_local() where unstable TSC and backward motion are detected. But, since early in boot interrupts are disabled, we cannot really correct invalid time, and therefore must rely on sched_clock() to provide us with a contiguous and sane time. In earlier versions of this project, I was solving this problem by adjusting __sched_clock_offset every time sched_clock()'s continuity was changed by using a callback function into sched/clock.c. But, Peter was against that approach.
| |