]>
Commit | Line | Data |
---|---|---|
9547e94c SL |
1 | From bbe2c87d36fb253b9d025ffe8452afde01284514 Mon Sep 17 00:00:00 2001 |
2 | From: Lianwei Wang <lianwei.wang@gmail.com> | |
3 | Date: Thu, 9 Jun 2016 23:43:28 -0700 | |
4 | Subject: cpu/hotplug: Handle unbalanced hotplug enable/disable | |
5 | ||
6 | [ Upstream commit 01b41159066531cc8d664362ff0cd89dd137bbfa ] | |
7 | ||
8 | When cpu_hotplug_enable() is called unbalanced w/o a preceeding | |
9 | cpu_hotplug_disable() the code emits a warning, but happily decrements the | |
10 | disabled counter. This causes the next operations to malfunction. | |
11 | ||
12 | Prevent the decrement and just emit a warning. | |
13 | ||
14 | Signed-off-by: Lianwei Wang <lianwei.wang@gmail.com> | |
15 | Cc: peterz@infradead.org | |
16 | Cc: linux-pm@vger.kernel.org | |
17 | Cc: oleg@redhat.com | |
18 | Link: http://lkml.kernel.org/r/1465541008-12476-1-git-send-email-lianwei.wang@gmail.com | |
19 | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> | |
20 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
21 | --- | |
22 | kernel/cpu.c | 11 +++++++++-- | |
23 | 1 file changed, 9 insertions(+), 2 deletions(-) | |
24 | ||
25 | diff --git a/kernel/cpu.c b/kernel/cpu.c | |
26 | index 40d20bf5de28..42ce0b0ae5c5 100644 | |
27 | --- a/kernel/cpu.c | |
28 | +++ b/kernel/cpu.c | |
29 | @@ -183,10 +183,17 @@ void cpu_hotplug_disable(void) | |
30 | } | |
31 | EXPORT_SYMBOL_GPL(cpu_hotplug_disable); | |
32 | ||
33 | +static void __cpu_hotplug_enable(void) | |
34 | +{ | |
35 | + if (WARN_ONCE(!cpu_hotplug_disabled, "Unbalanced cpu hotplug enable\n")) | |
36 | + return; | |
37 | + cpu_hotplug_disabled--; | |
38 | +} | |
39 | + | |
40 | void cpu_hotplug_enable(void) | |
41 | { | |
42 | cpu_maps_update_begin(); | |
43 | - WARN_ON(--cpu_hotplug_disabled < 0); | |
44 | + __cpu_hotplug_enable(); | |
45 | cpu_maps_update_done(); | |
46 | } | |
47 | EXPORT_SYMBOL_GPL(cpu_hotplug_enable); | |
48 | @@ -626,7 +633,7 @@ void enable_nonboot_cpus(void) | |
49 | ||
50 | /* Allow everyone to use the CPU hotplug again */ | |
51 | cpu_maps_update_begin(); | |
52 | - WARN_ON(--cpu_hotplug_disabled < 0); | |
53 | + __cpu_hotplug_enable(); | |
54 | if (cpumask_empty(frozen_cpus)) | |
55 | goto out; | |
56 | ||
57 | -- | |
58 | 2.19.1 | |
59 |