public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mfd: arizona: Fix race between runtime suspend and IRQs
@ 2015-06-14 14:41 Charles Keepax
  2015-06-14 14:41 ` [PATCH 2/2] mfd: arizona: Fix initialisation of the PM runtime Charles Keepax
  2015-06-24 11:28 ` [PATCH 1/2] mfd: arizona: Fix race between runtime suspend and IRQs Lee Jones
  0 siblings, 2 replies; 4+ messages in thread
From: Charles Keepax @ 2015-06-14 14:41 UTC (permalink / raw)
  To: lee.jones; +Cc: sameo, patches, linux-kernel

The function arizona_irq_thread (the threaded handler for the arizona
IRQs) calls pm_runtime_get_sync at the start to ensure that the chip is
active as we handle the IRQ. If the chip is part way through a runtime
suspend when an IRQ arrives the PM core will wait for the suspend to
complete, before resuming. However, since commit 4f0216409f7c
("mfd: arizona: Add better support for system suspend") the runtime
suspend function may call disable_irq, if the chip is going to fully
power off, which will try to wait for any outstanding IRQs to complete.
This results in deadlock as the IRQ thread is waiting for the PM
operation to complete and the PM thread is waiting for the IRQ to
complete.

To avoid this situation we use disable_irq_nosync, which allows the
suspending thread to finish the suspend without waiting for the IRQ to
complete. This is safe because if an IRQ is being processed it can only
be blocked at the pm_runtime_get_sync at the start of the handler
otherwise it wouldn't be possible to suspend.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 drivers/mfd/arizona-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index bebf58a..e60bcd9 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -651,7 +651,7 @@ static int arizona_runtime_suspend(struct device *dev)
 
 		arizona->has_fully_powered_off = true;
 
-		disable_irq(arizona->irq);
+		disable_irq_nosync(arizona->irq);
 		arizona_enable_reset(arizona);
 		regulator_bulk_disable(arizona->num_core_supplies,
 				       arizona->core_supplies);
-- 
1.7.2.5


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

end of thread, other threads:[~2015-06-24 11:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-14 14:41 [PATCH 1/2] mfd: arizona: Fix race between runtime suspend and IRQs Charles Keepax
2015-06-14 14:41 ` [PATCH 2/2] mfd: arizona: Fix initialisation of the PM runtime Charles Keepax
2015-06-24 11:29   ` Lee Jones
2015-06-24 11:28 ` [PATCH 1/2] mfd: arizona: Fix race between runtime suspend and IRQs Lee Jones

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