Skip to content

Commit

Permalink
timekeeping: Increment clock_was_set_seq in timekeeping_init()
Browse files Browse the repository at this point in the history
timekeeping_init() can set the wall time offset, so we need to
increment the clock_was_set_seq counter. That way hrtimers will pick
up the early offset immediately. Otherwise on a machine which does not
set wall time later in the boot process the hrtimer offset is stale at
0 and wall time timers are going to expire with a delay of 45 years.

Fixes: 868a3e9 "hrtimer: Make offset update smarter"
Reported-and-tested-by: Heiko Carstens <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Stefan Liebler <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: John Stultz <[email protected]>
  • Loading branch information
KAGA-KOKO committed Oct 16, 2015
1 parent 25cb62b commit 56fd16c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ void __init timekeeping_init(void)
set_normalized_timespec64(&tmp, -boot.tv_sec, -boot.tv_nsec);
tk_set_wall_to_mono(tk, tmp);

timekeeping_update(tk, TK_MIRROR);
timekeeping_update(tk, TK_MIRROR | TK_CLOCK_WAS_SET);

write_seqcount_end(&tk_core.seq);
raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
Expand Down

0 comments on commit 56fd16c

Please sign in to comment.