timers/core: Correct callback order during CPU hot plug
authorRichard Cochran <rcochran@linutronix.de>
Wed, 27 Jul 2016 09:08:18 +0000 (11:08 +0200)
committerIngo Molnar <mingo@kernel.org>
Thu, 28 Jul 2016 16:56:22 +0000 (18:56 +0200)
On the tear-down path, the dead CPU callback for the timers was
misplaced within the 'cpuhp_state' enumeration.  There is a hidden
dependency between the timers and block multiqueue.  The timers
callback must happen before the block multiqueue callback otherwise a
RCU stall occurs.

Move the timers callback to the proper place in the state machine.

Reported-and-tested-by: Jon Hunter <jonathanh@nvidia.com>
Reported-by: kbuild test robot <lkp@intel.com>
Fixes: 24f73b99716a ("timers/core: Convert to hotplug state machine")
Signed-off-by: Richard Cochran <rcochran@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: John Stultz <john.stultz@linaro.org>
Cc: rt@linutronix.de
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1469610498-25914-1-git-send-email-rcochran@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/cpuhotplug.h
kernel/cpu.c

index 6d405db6fb127ada88285f90109f7d6185031da1..242bf530edfcfe5d720c0818dcb84c0b967b03ff 100644 (file)
@@ -20,9 +20,9 @@ enum cpuhp_state {
        CPUHP_PROFILE_PREPARE,
        CPUHP_X2APIC_PREPARE,
        CPUHP_SMPCFD_PREPARE,
-       CPUHP_TIMERS_DEAD,
        CPUHP_RCUTREE_PREP,
        CPUHP_NOTIFY_PREPARE,
+       CPUHP_TIMERS_DEAD,
        CPUHP_BRINGUP_CPU,
        CPUHP_AP_IDLE_DEAD,
        CPUHP_AP_OFFLINE,
index f24f45915b54c50b8f0ac84231d370983fd9b9b3..341bf80f80bd685d529db77f6c4afdeda05f28ae 100644 (file)
@@ -1200,11 +1200,6 @@ static struct cpuhp_step cpuhp_bp_states[] = {
                .startup = smpcfd_prepare_cpu,
                .teardown = smpcfd_dead_cpu,
        },
-       [CPUHP_TIMERS_DEAD] = {
-               .name = "timers dead",
-               .startup = NULL,
-               .teardown = timers_dead_cpu,
-       },
        [CPUHP_RCUTREE_PREP] = {
                .name = "RCU-tree prepare",
                .startup = rcutree_prepare_cpu,
@@ -1221,6 +1216,16 @@ static struct cpuhp_step cpuhp_bp_states[] = {
                .skip_onerr             = true,
                .cant_stop              = true,
        },
+       /*
+        * On the tear-down path, timers_dead_cpu() must be invoked
+        * before blk_mq_queue_reinit_notify() from notify_dead(),
+        * otherwise a RCU stall occurs.
+        */
+       [CPUHP_TIMERS_DEAD] = {
+               .name = "timers dead",
+               .startup = NULL,
+               .teardown = timers_dead_cpu,
+       },
        /* Kicks the plugged cpu into life */
        [CPUHP_BRINGUP_CPU] = {
                .name                   = "cpu:bringup",