Re: [RFC] tick_sched_timer() is not properly aligned, fixed by chance

From: Thomas Gleixner
Date: Thu Apr 06 2023 - 13:13:50 EST


On Thu, Apr 06 2023 at 17:02, Sebastian Andrzej Siewior wrote:
> On 2023-04-06 13:08:29 [+0200], Thomas Gleixner wrote:
> The first one added is hpet. It points to "jiffies" as name and
> jiffies_read() as ->read().
>
> Before the change/ with PeterZ change I get from ktime_get() for
> base/nsec something like:
> |[ 0.004000] tick_next_period Name: jiffies jiffies_read+0x0/0x10
> |[ 0.004000] tick_next_period base/nsec: -401771248 405771248
> |[ 0.004000] tick_next_period hpet 4000000
>
> base/nsec is different on each boot but it always ends up with 4000000.
> With the optimisation, ktime_get() is:
> | [ 1.179079] tick_next_period base/nsec: 647439581 518613145
> | [ 1.179646] tick_next_period hpet 1166052726
>
> so something is using it during init. And this is
> read_persistent_wall_and_boot_offset()

Duh, yes. I remember now. That was done to take the TSC "uptime" into
account, which is sensible.

So making tick_next_period aligned to TICK_NSEC in tick_setup_device()
is the right thing to do in general then.

Thanks,

tglx