Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752684AbbFXL2x (ORCPT ); Wed, 24 Jun 2015 07:28:53 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:37568 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751493AbbFXL2o (ORCPT ); Wed, 24 Jun 2015 07:28:44 -0400 Date: Wed, 24 Jun 2015 12:28:39 +0100 From: Lee Jones To: Charles Keepax 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 Message-ID: <20150624112839.GJ15013@x1> References: <1434292910-24919-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1434292910-24919-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2184 Lines: 51 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 > --- > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/