This is a note to let you know that I've just added the patch titled

    mmc: sdhci-pxav3: fix race between runtime pm and irq

to the 3.19-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mmc-sdhci-pxav3-fix-race-between-runtime-pm-and-irq.patch
and it can be found in the queue-3.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 3bb10f60933e84abfe2be69f60b3486f9b96348b Mon Sep 17 00:00:00 2001
From: Jisheng Zhang <[email protected]>
Date: Fri, 23 Jan 2015 18:08:21 +0800
Subject: mmc: sdhci-pxav3: fix race between runtime pm and irq

From: Jisheng Zhang <[email protected]>

commit 3bb10f60933e84abfe2be69f60b3486f9b96348b upstream.

This patch is to fix a race condition that may cause an unhandled irq,
which results in big sdhci interrupt numbers and endless "mmc1: got irq
while runtime suspended" msgs before v3.15.

Consider following scenario:

      CPU0                            CPU1
                              sdhci_pxav3_runtime_suspend()
                               spin_lock_irqsave(&host->lock, flags);
 sdhci_irq()
  spining on the &host->lock
                               host->runtime_suspended = true;
                               spin_unlock_irqrestore(&host->lock, flags);
  get the &host->lock
  runtime_suspended is true now
  return IRQ_NONE;

Fix this race by using the core sdhci.c supplied sdhci_runtime_suspend_host()
in runtime suspend hook which will disable card interrupts. We also use the
sdhci_runtime_resume_host() in the runtime resume hook accordingly.

Signed-off-by: Jisheng Zhang <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/mmc/host/sdhci-pxav3.c |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -458,11 +458,11 @@ static int sdhci_pxav3_runtime_suspend(s
        struct sdhci_host *host = dev_get_drvdata(dev);
        struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
        struct sdhci_pxa *pxa = pltfm_host->priv;
-       unsigned long flags;
+       int ret;
 
-       spin_lock_irqsave(&host->lock, flags);
-       host->runtime_suspended = true;
-       spin_unlock_irqrestore(&host->lock, flags);
+       ret = sdhci_runtime_suspend_host(host);
+       if (ret)
+               return ret;
 
        clk_disable_unprepare(pxa->clk_io);
        if (!IS_ERR(pxa->clk_core))
@@ -476,17 +476,12 @@ static int sdhci_pxav3_runtime_resume(st
        struct sdhci_host *host = dev_get_drvdata(dev);
        struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
        struct sdhci_pxa *pxa = pltfm_host->priv;
-       unsigned long flags;
 
        clk_prepare_enable(pxa->clk_io);
        if (!IS_ERR(pxa->clk_core))
                clk_prepare_enable(pxa->clk_core);
 
-       spin_lock_irqsave(&host->lock, flags);
-       host->runtime_suspended = false;
-       spin_unlock_irqrestore(&host->lock, flags);
-
-       return 0;
+       return sdhci_runtime_resume_host(host);
 }
 #endif
 


Patches currently in stable-queue which might be from [email protected] are

queue-3.19/mmc-sdhci-pxav3-fix-race-between-runtime-pm-and-irq.patch
queue-3.19/mmc-sdhci-pxav3-fix-setting-of-pdata-clk_delay_cycles.patch
queue-3.19/mmc-sdhci-pxav3-fix-unbalanced-clock-issues-during-probe.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to