diff options
author | Peter Hilber <peter.hilber@opensynergy.com> | 2023-12-18 10:38:39 +0300 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2024-02-19 14:18:51 +0300 |
commit | 84dccadd3e2a3f1a373826ad71e5ced5e76b0c00 (patch) | |
tree | e7e33f6eff8e90ac1227e3680c7ac1b128a0e4c9 /kernel/time/timekeeping.c | |
parent | c92a7eb6c642812fb08851e580973c3b83e0227c (diff) | |
download | linux-84dccadd3e2a3f1a373826ad71e5ced5e76b0c00.tar.xz |
timekeeping: Fix cross-timestamp interpolation on counter wrap
cycle_between() decides whether get_device_system_crosststamp() will
interpolate for older counter readings.
cycle_between() yields wrong results for a counter wrap-around where after
< before < test, and for the case after < test < before.
Fix the comparison logic.
Fixes: 2c756feb18d9 ("time: Add history to cross timestamp interface supporting slower devices")
Signed-off-by: Peter Hilber <peter.hilber@opensynergy.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <jstultz@google.com>
Link: https://lore.kernel.org/r/20231218073849.35294-2-peter.hilber@opensynergy.com
Diffstat (limited to 'kernel/time/timekeeping.c')
-rw-r--r-- | kernel/time/timekeeping.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 266d02809dbb..8f35455b6250 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1186,7 +1186,7 @@ static bool cycle_between(u64 before, u64 test, u64 after) { if (test > before && test < after) return true; - if (test < before && before > after) + if (before > after && (test > before || test < after)) return true; return false; } |