* [PATCH v2] mmc: sdhci-msm: fix mutex while in spinlock
@ 2019-07-01 15:01 Jorge Ramirez-Ortiz
2019-07-01 15:22 ` Vinod Koul
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-07-01 15:01 UTC (permalink / raw)
To: jorge.ramirez-ortiz, agross, adrian.hunter, ulf.hansson
Cc: bjorn.andersson, linux-arm-msm, linux-mmc, linux-kernel,
khasim.mohammed, vinod.koul
mutexes can sleep and therefore should not be taken while holding a
spinlock. move clk_get_rate (can sleep) outside the spinlock protected
region.
Fixes: 83736352e0ca ("mmc: sdhci-msm: Update DLL reset sequence")
Cc: stable@vger.kernel.org
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
drivers/mmc/host/sdhci-msm.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 5fc76a1993d0..9cf14b359c14 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -575,11 +575,14 @@ static int msm_init_cm_dll(struct sdhci_host *host)
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
int wait_cnt = 50;
- unsigned long flags;
+ unsigned long flags, xo_clk = 0;
u32 config;
const struct sdhci_msm_offset *msm_offset =
msm_host->offset;
+ if (msm_host->use_14lpp_dll_reset && !IS_ERR_OR_NULL(msm_host->xo_clk))
+ xo_clk = clk_get_rate(msm_host->xo_clk);
+
spin_lock_irqsave(&host->lock, flags);
/*
@@ -627,10 +630,10 @@ static int msm_init_cm_dll(struct sdhci_host *host)
config &= CORE_FLL_CYCLE_CNT;
if (config)
mclk_freq = DIV_ROUND_CLOSEST_ULL((host->clock * 8),
- clk_get_rate(msm_host->xo_clk));
+ xo_clk);
else
mclk_freq = DIV_ROUND_CLOSEST_ULL((host->clock * 4),
- clk_get_rate(msm_host->xo_clk));
+ xo_clk);
config = readl_relaxed(host->ioaddr +
msm_offset->core_dll_config_2);
--
2.21.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] mmc: sdhci-msm: fix mutex while in spinlock
2019-07-01 15:01 [PATCH v2] mmc: sdhci-msm: fix mutex while in spinlock Jorge Ramirez-Ortiz
@ 2019-07-01 15:22 ` Vinod Koul
2019-07-02 7:07 ` Adrian Hunter
2019-07-08 11:55 ` Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2019-07-01 15:22 UTC (permalink / raw)
To: Jorge Ramirez-Ortiz
Cc: agross, adrian.hunter, ulf.hansson, bjorn.andersson,
linux-arm-msm, linux-mmc, linux-kernel, khasim.mohammed
On 01-07-19, 17:01, Jorge Ramirez-Ortiz wrote:
> mutexes can sleep and therefore should not be taken while holding a
> spinlock. move clk_get_rate (can sleep) outside the spinlock protected
> region.
Reviewed-by: Vinod Koul <vkoul@kernel.org>
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] mmc: sdhci-msm: fix mutex while in spinlock
2019-07-01 15:01 [PATCH v2] mmc: sdhci-msm: fix mutex while in spinlock Jorge Ramirez-Ortiz
2019-07-01 15:22 ` Vinod Koul
@ 2019-07-02 7:07 ` Adrian Hunter
2019-07-08 11:55 ` Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Adrian Hunter @ 2019-07-02 7:07 UTC (permalink / raw)
To: Jorge Ramirez-Ortiz, agross, ulf.hansson
Cc: bjorn.andersson, linux-arm-msm, linux-mmc, linux-kernel,
khasim.mohammed, vinod.koul
On 1/07/19 6:01 PM, Jorge Ramirez-Ortiz wrote:
> mutexes can sleep and therefore should not be taken while holding a
> spinlock. move clk_get_rate (can sleep) outside the spinlock protected
> region.
>
> Fixes: 83736352e0ca ("mmc: sdhci-msm: Update DLL reset sequence")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/mmc/host/sdhci-msm.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
> index 5fc76a1993d0..9cf14b359c14 100644
> --- a/drivers/mmc/host/sdhci-msm.c
> +++ b/drivers/mmc/host/sdhci-msm.c
> @@ -575,11 +575,14 @@ static int msm_init_cm_dll(struct sdhci_host *host)
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
> int wait_cnt = 50;
> - unsigned long flags;
> + unsigned long flags, xo_clk = 0;
> u32 config;
> const struct sdhci_msm_offset *msm_offset =
> msm_host->offset;
>
> + if (msm_host->use_14lpp_dll_reset && !IS_ERR_OR_NULL(msm_host->xo_clk))
> + xo_clk = clk_get_rate(msm_host->xo_clk);
> +
> spin_lock_irqsave(&host->lock, flags);
>
> /*
> @@ -627,10 +630,10 @@ static int msm_init_cm_dll(struct sdhci_host *host)
> config &= CORE_FLL_CYCLE_CNT;
> if (config)
> mclk_freq = DIV_ROUND_CLOSEST_ULL((host->clock * 8),
> - clk_get_rate(msm_host->xo_clk));
> + xo_clk);
> else
> mclk_freq = DIV_ROUND_CLOSEST_ULL((host->clock * 4),
> - clk_get_rate(msm_host->xo_clk));
> + xo_clk);
>
> config = readl_relaxed(host->ioaddr +
> msm_offset->core_dll_config_2);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] mmc: sdhci-msm: fix mutex while in spinlock
2019-07-01 15:01 [PATCH v2] mmc: sdhci-msm: fix mutex while in spinlock Jorge Ramirez-Ortiz
2019-07-01 15:22 ` Vinod Koul
2019-07-02 7:07 ` Adrian Hunter
@ 2019-07-08 11:55 ` Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2019-07-08 11:55 UTC (permalink / raw)
To: Jorge Ramirez-Ortiz
Cc: agross, Adrian Hunter, Bjorn Andersson, linux-arm-msm, linux-mmc,
Linux Kernel Mailing List, Khasim Syed Mohammed, vinod.koul
On Mon, 1 Jul 2019 at 17:01, Jorge Ramirez-Ortiz
<jorge.ramirez-ortiz@linaro.org> wrote:
>
> mutexes can sleep and therefore should not be taken while holding a
> spinlock. move clk_get_rate (can sleep) outside the spinlock protected
> region.
>
> Fixes: 83736352e0ca ("mmc: sdhci-msm: Update DLL reset sequence")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/sdhci-msm.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
> index 5fc76a1993d0..9cf14b359c14 100644
> --- a/drivers/mmc/host/sdhci-msm.c
> +++ b/drivers/mmc/host/sdhci-msm.c
> @@ -575,11 +575,14 @@ static int msm_init_cm_dll(struct sdhci_host *host)
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
> int wait_cnt = 50;
> - unsigned long flags;
> + unsigned long flags, xo_clk = 0;
> u32 config;
> const struct sdhci_msm_offset *msm_offset =
> msm_host->offset;
>
> + if (msm_host->use_14lpp_dll_reset && !IS_ERR_OR_NULL(msm_host->xo_clk))
> + xo_clk = clk_get_rate(msm_host->xo_clk);
> +
> spin_lock_irqsave(&host->lock, flags);
>
> /*
> @@ -627,10 +630,10 @@ static int msm_init_cm_dll(struct sdhci_host *host)
> config &= CORE_FLL_CYCLE_CNT;
> if (config)
> mclk_freq = DIV_ROUND_CLOSEST_ULL((host->clock * 8),
> - clk_get_rate(msm_host->xo_clk));
> + xo_clk);
> else
> mclk_freq = DIV_ROUND_CLOSEST_ULL((host->clock * 4),
> - clk_get_rate(msm_host->xo_clk));
> + xo_clk);
>
> config = readl_relaxed(host->ioaddr +
> msm_offset->core_dll_config_2);
> --
> 2.21.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-07-08 11:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-01 15:01 [PATCH v2] mmc: sdhci-msm: fix mutex while in spinlock Jorge Ramirez-Ortiz
2019-07-01 15:22 ` Vinod Koul
2019-07-02 7:07 ` Adrian Hunter
2019-07-08 11:55 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).