Please sign in to comment.
ntp: Fix leap-second hrtimer livelock
Since commit 7dffa3c the ntp subsystem has used an hrtimer for triggering the leapsecond adjustment. However, this can cause a potential livelock. Thomas diagnosed this as the following pattern: CPU 0 CPU 1 do_adjtimex() spin_lock_irq(&ntp_lock); process_adjtimex_modes(); timer_interrupt() process_adj_status(); do_timer() ntp_start_leap_timer(); write_lock(&xtime_lock); hrtimer_start(); update_wall_time(); hrtimer_reprogram(); ntp_tick_length() tick_program_event() spin_lock(&ntp_lock); clockevents_program_event() ktime_get() seq = req_seqbegin(xtime_lock); This patch tries to avoid the problem by reverting back to not using an hrtimer to inject leapseconds, and instead we handle the leapsecond processing in the second_overflow() function. The downside to this change is that on systems that support highres timers, the leap second processing will occur on a HZ tick boundary, (ie: ~1-10ms, depending on HZ) after the leap second instead of possibly sooner (~34us in my tests w/ x86_64 lapic). This patch applies on top of tip/timers/core. CC: Sasha Levin <email@example.com> CC: Thomas Gleixner <firstname.lastname@example.org> Reported-by: Sasha Levin <email@example.com> Diagnoised-by: Thomas Gleixner <firstname.lastname@example.org> Tested-by: Sasha Levin <email@example.com> Signed-off-by: John Stultz <firstname.lastname@example.org>
- Loading branch information...
Showing with 48 additions and 102 deletions.