From: Lee Jones <lee.jones@linaro.org>
To: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: sameo@linux.intel.com, patches@opensource.wolfsonmicro.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mfd: arizona: Fix race between runtime suspend and IRQs
Date: Wed, 24 Jun 2015 12:28:39 +0100 [thread overview]
Message-ID: <20150624112839.GJ15013@x1> (raw)
In-Reply-To: <1434292910-24919-1-git-send-email-ckeepax@opensource.wolfsonmicro.com>
On Sun, 14 Jun 2015, Charles Keepax wrote:
> 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(-)
Applied, thanks.
> 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);
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
prev parent reply other threads:[~2015-06-24 11:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Lee Jones [this message]
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=20150624112839.GJ15013@x1 \
--to=lee.jones@linaro.org \
--cc=ckeepax@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.