diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2024-12-08 11:51:29 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2024-12-08 11:51:29 -0800 |
commit | c25ca0c2e42c77e0241411d374d44c41e253b3f5 (patch) | |
tree | a191fd3d5ea13957c08866d054d16b85875ce205 /kernel/time/timekeeping_internal.h | |
parent | 84262262177b98cf4e57e8c010119576d3c6bc2b (diff) | |
parent | 76031d9536a076bf023bedbdb1b4317fc801dd67 (diff) |
Merge tag 'timers_urgent_for_v6.13_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fix from Borislav Petkov:
- Handle the case where clocksources with small counter width can,
in conjunction with overly long idle sleeps, falsely trigger the
negative motion detection of clocksources
* tag 'timers_urgent_for_v6.13_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
clocksource: Make negative motion detection more robust
Diffstat (limited to 'kernel/time/timekeeping_internal.h')
-rw-r--r-- | kernel/time/timekeeping_internal.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/time/timekeeping_internal.h b/kernel/time/timekeeping_internal.h index 63e600e943a7..8c9079108ffb 100644 --- a/kernel/time/timekeeping_internal.h +++ b/kernel/time/timekeeping_internal.h @@ -30,15 +30,15 @@ static inline void timekeeping_inc_mg_floor_swaps(void) #endif -static inline u64 clocksource_delta(u64 now, u64 last, u64 mask) +static inline u64 clocksource_delta(u64 now, u64 last, u64 mask, u64 max_delta) { u64 ret = (now - last) & mask; /* - * Prevent time going backwards by checking the MSB of mask in - * the result. If set, return 0. + * Prevent time going backwards by checking the result against + * @max_delta. If greater, return 0. */ - return ret & ~(mask >> 1) ? 0 : ret; + return ret > max_delta ? 0 : ret; } /* Semi public for serialization of non timekeeper VDSO updates. */ |