Re: [GIT PULL clocksource] Clocksource watchdog commits for v5.15

From: Thomas Gleixner
Date: Thu Aug 12 2021 - 13:12:00 EST


On Thu, Aug 12 2021 at 09:37, Paul E. McKenney wrote:

> On Thu, Aug 12, 2021 at 03:46:42PM +0200, Thomas Gleixner wrote:
>> On Wed, Aug 11 2021 at 17:01, Paul E. McKenney wrote:
>> > This pull request contains a single change that prevents clocksource
>> > watchdog testing on systems with HZ < 100, thus preventing the integer
>> > underflow that can occur on leisurely HZed systems. This has been
>> > posted to LKML:
>> >
>> > https://lore.kernel.org/lkml/20210721212755.GA2066078@paulmck-ThinkPad-P17-Gen-1/
>>
>> So with HZ < 100 .mult overflows, but why not simply adjusting the
>> mult, shift value to be
>>
>> .mult = TICK_NSEC,
>> .shift = 0,
>>
>> which is effectively the same as
>>
>> .mult = TICK_NSEC << 8,
>> .shift = 8,
>>
>> Hmm?
>
> Another option would be for me to be less lazy and to move this code:
>
> /* Since jiffies uses a simple TICK_NSEC multiplier
> * conversion, the .shift value could be zero. However
> * this would make NTP adjustments impossible as they are
> * in units of 1/2^.shift. Thus we use JIFFIES_SHIFT to
> * shift both the nominator and denominator the same
> * amount, and give ntp adjustments in units of 1/2^8
> *
> * The value 8 is somewhat carefully chosen, as anything
> * larger can result in overflows. TICK_NSEC grows as HZ
> * shrinks, so values greater than 8 overflow 32bits when
> * HZ=100.
> */
> #if HZ < 34
> #define JIFFIES_SHIFT 6
> #elif HZ < 67
> #define JIFFIES_SHIFT 7
> #else
> #define JIFFIES_SHIFT 8
> #endif
>
> from kernel/time/jiffies.c to include/linux/clocksource.h.

No need to expose this globaly.

kernel/time/tick-internal.h or kernel/time/jiffies.h

Thanks,

tglx