diff options
| author | Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de> | 2026-10-23 13:49:17 +0200 |
|---|---|---|
| committer | Thomas Gleixner <tglx@kernel.org> | 2026-10-23 21:52:01 +0200 |
| commit | 6541fbc942f3b63bb8bd44e34eee6223e0abe719 (patch) | |
| tree | d2108cb0a660070c171af2a7256d1c93238ad57d /kernel | |
| parent | 524d95c8a2000cba6cb80a173d76cb746c561244 (diff) | |
| download | linux-6541fbc942f3b63bb8bd44e34eee6223e0abe719.tar.gz linux-6541fbc942f3b63bb8bd44e34eee6223e0abe719.zip | |
timekeeping: Update offsets on sequence counter retry in ktime_get_update_offsets_now()
The sequence counter of the cwsseq target is modified during the
sequence counter loop. If the loop retries, cwsseq will now match
but the offsets contain the values from the previous loop iteration.
These are not guaranteed to be consistent in themselves or with the
current loops "now.
Save the target's original sequence counter value so that the update
also happens on loop retries.
Fixes: 868a3e915f7f ("hrtimer: Make offset update smarter")
Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261023-timekeeping-clock_was_set_seq-v1-1-61c4c53d031c@linutronix.de
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/time/timekeeping.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 1b342825bd8f..cae3e51eaf55 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -2849,6 +2849,7 @@ ktime_t ktime_get_update_offsets_now(u32 *cwsseq, ktime_t *offs_real, ktime_t *offs_boot, ktime_t *offs_tai) { struct timekeeper *tk = &tk_core.timekeeper; + u32 cwsseq_orig = *cwsseq; unsigned int seq; ktime_t base; u64 nsecs; @@ -2860,7 +2861,7 @@ ktime_t ktime_get_update_offsets_now(u32 *cwsseq, ktime_t *offs_real, nsecs = timekeeping_get_ns(&tk->tkr_mono); base = ktime_add_ns(base, nsecs); - if (*cwsseq != tk->clock_was_set_seq) { + if (cwsseq_orig != tk->clock_was_set_seq) { *cwsseq = tk->clock_was_set_seq; *offs_real = tk->offs_real; *offs_boot = tk->offs_boot; |
