diff options
author | Colin Cross <ccross@android.com> | 2012-08-15 16:10:50 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2012-08-17 13:37:01 -0400 |
commit | 63c6ba4352009a5f85b32307c001abeb5baebd28 (patch) | |
tree | a3cf120e9c5caf74dd4704bc484f0f3930d433fa | |
parent | 55d7ec4520e86d735d178c15d7df33d507bd43c6 (diff) |
cpuidle: coupled: fix sleeping while atomic in cpu notifier
The cpu hotplug notifier gets called in both atomic and non-atomic
contexts, it is not always safe to lock a mutex. Filter out all events
except the six necessary ones, which are all sleepable, before taking
the mutex.
Signed-off-by: Colin Cross <ccross@android.com>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
-rw-r--r-- | drivers/cpuidle/coupled.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c index 2c9bf2692232..c24dda03c143 100644 --- a/drivers/cpuidle/coupled.c +++ b/drivers/cpuidle/coupled.c | |||
@@ -678,6 +678,18 @@ static int cpuidle_coupled_cpu_notify(struct notifier_block *nb, | |||
678 | int cpu = (unsigned long)hcpu; | 678 | int cpu = (unsigned long)hcpu; |
679 | struct cpuidle_device *dev; | 679 | struct cpuidle_device *dev; |
680 | 680 | ||
681 | switch (action & ~CPU_TASKS_FROZEN) { | ||
682 | case CPU_UP_PREPARE: | ||
683 | case CPU_DOWN_PREPARE: | ||
684 | case CPU_ONLINE: | ||
685 | case CPU_DEAD: | ||
686 | case CPU_UP_CANCELED: | ||
687 | case CPU_DOWN_FAILED: | ||
688 | break; | ||
689 | default: | ||
690 | return NOTIFY_OK; | ||
691 | } | ||
692 | |||
681 | mutex_lock(&cpuidle_lock); | 693 | mutex_lock(&cpuidle_lock); |
682 | 694 | ||
683 | dev = per_cpu(cpuidle_devices, cpu); | 695 | dev = per_cpu(cpuidle_devices, cpu); |