]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
timekeeping: Always check for negative motion
authorThomas Gleixner <tglx@linutronix.de>
Thu, 31 Oct 2024 12:04:08 +0000 (13:04 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 19:03:38 +0000 (20:03 +0100)
commite26cbab9821a6e511ec839884517838ec596751e
tree6bfe7a0d4dbe69b440c22ead2e790b63cf6d29f4
parentc7559dc2047e655eaa7e9be78bc7efab956463b9
timekeeping: Always check for negative motion

[ Upstream commit c163e40af9b2331b2c629fd4ec8b703ed4d4ae39 ]

clocksource_delta() has two variants. One with a check for negative motion,
which is only selected by x86. This is a historic leftover as this function
was previously used in the time getter hot paths.

Since 135225a363ae timekeeping_cycles_to_ns() has unconditional protection
against this as a by-product of the protection against 64bit math overflow.

clocksource_delta() is only used in the clocksource watchdog and in
timekeeping_advance(). The extra conditional there is not hurting anyone.

Remove the config option and unconditionally prevent negative motion of the
readout.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <jstultz@google.com>
Link: https://lore.kernel.org/all/20241031120328.599430157@linutronix.de
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/Kconfig
kernel/time/Kconfig
kernel/time/timekeeping_internal.h