Skip to content
  • Michal Hocko's avatar
    watchdog: make sure the watchdog thread gets CPU on loaded system · 7a05c0f7
    Michal Hocko authored
    
    
    If the system is loaded while hotplugging a CPU we might end up with a
    bogus hardlockup detection.  This has been seen during LTP pounder test
    executed in parallel with hotplug test.
    
    The main problem is that enable_watchdog (called when CPU is brought up)
    registers perf event which periodically checks per-cpu counter
    (hrtimer_interrupts), updated from a hrtimer callback, but the hrtimer
    is fired from the kernel thread.
    
    This means that while we already do check for the hard lockup the kernel
    thread might be sitting on the runqueue with zillions of tasks so there
    is nobody to update the value we rely on and so we KABOOM.
    
    Let's fix this by boosting the watchdog thread priority before we wake
    it up rather than when it's already running.  This still doesn't handle
    a case where we have the same amount of high prio FIFO tasks but that
    doesn't seem to be common.  The current implementation doesn't handle
    that case anyway so this is not worse at least.
    
    Unfortunately, we cannot start perf counter from the watchdog thread
    because we could miss a real lock up and also we cannot start the
    hrtimer watchdog_enable because we there is no way (at least I don't
    know any) to start a hrtimer from a different CPU.
    
    [dzickus@redhat.com: fix compile issue with param]
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Reviewed-by: default avatarMandeep Singh Baines <msb@chromium.org>
    Signed-off-by: default avatarMichal Hocko <mhocko@suse.cz>
    Signed-off-by: default avatarDon Zickus <dzickus@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    7a05c0f7