Skip to content

Commit f55c076

Browse files
timekeeping: Fix lost updates to tai adjustment
Since 48cdc13 (Implement a shadow timekeeper), we have to call timekeeping_update() after any adjustment to the timekeeping structure in order to make sure that any adjustments to the structure persist. Unfortunately, the updates to the tai offset via adjtimex do not trigger this update, causing adjustments to the tai offset to be made and then over-written by the previous value at the next update_wall_time() call. This patch resovles the issue by calling timekeeping_update() right after setting the tai offset. Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Prarit Bhargava <prarit@redhat.com> Cc: Richard Cochran <richardcochran@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: stable <stable@vger.kernel.org> #3.10+ Signed-off-by: John Stultz <john.stultz@linaro.org>
1 parent 0e6601e commit f55c076

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/time/timekeeping.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ void timekeeping_set_tai_offset(s32 tai_offset)
610610
raw_spin_lock_irqsave(&timekeeper_lock, flags);
611611
write_seqcount_begin(&timekeeper_seq);
612612
__timekeeping_set_tai_offset(tk, tai_offset);
613+
timekeeping_update(tk, TK_MIRROR | TK_CLOCK_WAS_SET);
613614
write_seqcount_end(&timekeeper_seq);
614615
raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
615616
clock_was_set();
@@ -1698,7 +1699,7 @@ int do_adjtimex(struct timex *txc)
16981699

16991700
if (tai != orig_tai) {
17001701
__timekeeping_set_tai_offset(tk, tai);
1701-
update_pvclock_gtod(tk, true);
1702+
timekeeping_update(tk, TK_MIRROR | TK_CLOCK_WAS_SET);
17021703
clock_was_set_delayed();
17031704
}
17041705
write_seqcount_end(&timekeeper_seq);

0 commit comments

Comments
 (0)