From: Chuansheng Liu <chuansheng.liu@intel.com>
To: broonie@opensource.wolfsonmicro.com, sameo@linux.intel.com
Cc: linux-kernel@vger.kernel.org,
patches@opensource.wolfsonmicro.com, chuansheng.liu@intel.com
Subject: mfd, arizona: Fix the deadlock between interrupt handler and dpm_suspend
Date: Wed, 10 Apr 2013 20:39:09 +0800 [thread overview]
Message-ID: <1365597549.12565.4.camel@cliu38-desktop-build> (raw)
When system try to do the suspend:
T1:suspend_thread T2: interrupt thread handler
enter_state() arizona_irq_thread()
suspend_devices_and_enter() regmap_read()
__device_suspend()
regmap_spi_read()
spi_write_then_read()
spi_sync()
__spi_sync()
wait_for_completion()
T2 <== Blocked here due to spi suspended
suspend_enter()
dpm_suspend_end()
dpm_suspend_noirq()
suspend_device_irqs()
synchronize_irq()
T1 <== Blocked here due waiting for T2 finished
Then T1 and T2 is deadlocked there.
Here the arizona irq is not NOSUSPEND irq, so when doing device suspend,
we can disable the arizona irq, and enable it until devices resuming finished.
Signed-off-by: liu chuansheng <chuansheng.liu@intel.com>
---
drivers/mfd/arizona-core.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index b562c7b..b11bd01 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -264,11 +264,11 @@ static int arizona_runtime_suspend(struct device *dev)
#endif
#ifdef CONFIG_PM_SLEEP
-static int arizona_resume_noirq(struct device *dev)
+static int arizona_suspend(struct device *dev)
{
struct arizona *arizona = dev_get_drvdata(dev);
- dev_dbg(arizona->dev, "Early resume, disabling IRQ\n");
+ dev_dbg(arizona->dev, "Suspend, disabling IRQ\n");
disable_irq(arizona->irq);
return 0;
@@ -278,7 +278,7 @@ static int arizona_resume(struct device *dev)
{
struct arizona *arizona = dev_get_drvdata(dev);
- dev_dbg(arizona->dev, "Late resume, reenabling IRQ\n");
+ dev_dbg(arizona->dev, "Resume, reenabling IRQ\n");
enable_irq(arizona->irq);
return 0;
@@ -289,10 +289,7 @@ const struct dev_pm_ops arizona_pm_ops = {
SET_RUNTIME_PM_OPS(arizona_runtime_suspend,
arizona_runtime_resume,
NULL)
- SET_SYSTEM_SLEEP_PM_OPS(NULL, arizona_resume)
-#ifdef CONFIG_PM_SLEEP
- .resume_noirq = arizona_resume_noirq,
-#endif
+ SET_SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume)
};
EXPORT_SYMBOL_GPL(arizona_pm_ops);
--
1.7.0.4
next reply other threads:[~2013-04-10 3:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 12:39 Chuansheng Liu [this message]
2013-04-10 12:30 ` mfd, arizona: Fix the deadlock between interrupt handler and dpm_suspend Mark Brown
2013-04-10 12:46 ` Liu, Chuansheng
2013-04-10 12:52 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1365597549.12565.4.camel@cliu38-desktop-build \
--to=chuansheng.liu@intel.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.wolfsonmicro.com \
--cc=sameo@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox