public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpuidle: coupled: fix sleeping while atomic in cpu notifier
@ 2012-07-25 21:20 Colin Cross
  2012-07-26  7:25 ` Shilimkar, Santosh
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Colin Cross @ 2012-07-25 21:20 UTC (permalink / raw)
  To: Len Brown
  Cc: Colin Cross, Len Brown, Kevin Hilman, Santosh Shilimkar,
	Rafael J. Wysocki, linux-kernel

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>
---
 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 2c9bf26..c24dda0 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,
 	int cpu = (unsigned long)hcpu;
 	struct cpuidle_device *dev;
 
+	switch (action & ~CPU_TASKS_FROZEN) {
+	case CPU_UP_PREPARE:
+	case CPU_DOWN_PREPARE:
+	case CPU_ONLINE:
+	case CPU_DEAD:
+	case CPU_UP_CANCELED:
+	case CPU_DOWN_FAILED:
+		break;
+	default:
+		return NOTIFY_OK;
+	}
+
 	mutex_lock(&cpuidle_lock);
 
 	dev = per_cpu(cpuidle_devices, cpu);
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-08-15 20:10 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-25 21:20 [PATCH] cpuidle: coupled: fix sleeping while atomic in cpu notifier Colin Cross
2012-07-26  7:25 ` Shilimkar, Santosh
2012-07-26 22:54   ` Shilimkar, Santosh
2012-07-26 19:55 ` Rafael J. Wysocki
2012-07-26 19:51   ` Colin Cross
2012-07-26 20:15     ` Rafael J. Wysocki
2012-07-26 20:16       ` Rafael J. Wysocki
2012-07-31 15:43 ` Srivatsa S. Bhat
2012-07-31 18:27   ` Colin Cross
2012-08-01  5:59     ` Srivatsa S. Bhat
2012-08-07 22:15 ` Rafael J. Wysocki
2012-08-08  0:54   ` Colin Cross
2012-08-15 20:16     ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox