]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commit - kernel/cpu.c
cpuhotplug: Link lock stacks for hotplug callbacks
authorThomas Gleixner <tglx@linutronix.de>
Wed, 24 May 2017 08:15:43 +0000 (10:15 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 26 May 2017 08:10:48 +0000 (10:10 +0200)
commit49dfe2a6779717d9c18395684ee31bdc98b22e53
treed8a067fdbef6e58d980d3137c7fa6f8a27d212ea
parent0266d81e9bf5cc1fe6405c0523dfa015fe55aae1
cpuhotplug: Link lock stacks for hotplug callbacks

The CPU hotplug callbacks are not covered by lockdep versus the cpu hotplug
rwsem.

CPU0 CPU1
cpuhp_setup_state(STATE, startup, teardown);
 cpus_read_lock();
  invoke_callback_on_ap();
    kick_hotplug_thread(ap);
    wait_for_completion(); hotplug_thread_fn()
       lock(m);
  do_stuff();
  unlock(m);

Lockdep does not know about this dependency and will not trigger on the
following code sequence:

  lock(m);
  cpus_read_lock();

Add a lockdep map and connect the initiators lock chain with the hotplug
thread lock chain, so potential deadlocks can be detected.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20170524081549.709375845@linutronix.de
kernel/cpu.c