Skip to content
  • Mike Galbraith's avatar
    tick/broadcast: Prevent deadlock on tick_broadcast_lock · 202461e2
    Mike Galbraith authored
    tick_broadcast_lock is taken from interrupt context, but the following call
    chain takes the lock without disabling interrupts:
    
    [   12.703736]  _raw_spin_lock+0x3b/0x50
    [   12.703738]  tick_broadcast_control+0x5a/0x1a0
    [   12.703742]  intel_idle_cpu_online+0x22/0x100
    [   12.703744]  cpuhp_invoke_callback+0x245/0x9d0
    [   12.703752]  cpuhp_thread_fun+0x52/0x110
    [   12.703754]  smpboot_thread_fn+0x276/0x320
    
    So the following deadlock can happen:
    
       lock(tick_broadcast_lock);
       <Interrupt>
          lock(tick_broadcast_lock);
    
    intel_idle_cpu_online() is the only place which violates the calling
    convention of tick_broadcast_control(). This was caused by the removal of
    the smp function call in course of the cpu hotplug rework.
    
    Instead of slapping local_irq_disable/enable() at the call site, we can
    relax the calling convention and handle it in the core code, which makes
    the whole machinery more robust.
    
    Fixes: 29d7bbad
    
     ("intel_idle: Remove superfluous SMP fuction call")
    Reported-by: default avatarGabriel C <nix.or.die@gmail.com>
    Signed-off-by: default avatarMike Galbraith <efault@gmx.de>
    Cc: Ruslan Ruslichenko <rruslich@cisco.com>
    Cc: Jiri Slaby <jslaby@suse.cz>
    Cc: Greg KH <gregkh@linuxfoundation.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: lwn@lwn.net
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Anna-Maria Gleixner <anna-maria@linutronix.de>
    Cc: Sebastian Siewior <bigeasy@linutronix.de>
    Cc: stable <stable@vger.kernel.org>
    Link: http://lkml.kernel.org/r/1486953115.5912.4.camel@gmx.de
    
    
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    202461e2