diff mbox

mmc: core: add missing pm event in mmc_pm_notify to fix hib restore

Message ID 1429785823-16939-1-git-send-email-grygorii.strashko@linaro.org
State New
Headers show

Commit Message

Grygorii.Strashko@linaro.org April 23, 2015, 10:43 a.m. UTC
From: Grygorii Strashko <Grygorii.Strashko@linaro.org>

The PM_RESTORE_PREPARE is not handled now in mmc_pm_notify(),
as result mmc_rescan() could be scheduled and executed at
late hibernation restore stages when MMC device is suspended
already - which, in turn, will lead to system crash on TI dra7-evm board:

WARNING: CPU: 0 PID: 3188 at drivers/bus/omap_l3_noc.c:148 l3_interrupt_handler+0x258/0x374()
44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4_PER1_P3 (Idle): Data Access in User mode during Functional access

Hence, add missed PM_RESTORE_PREPARE PM event in mmc_pm_notify().

Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
---
 drivers/mmc/core/core.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Ulf Hansson April 23, 2015, 1:19 p.m. UTC | #1
On 23 April 2015 at 12:43,  <grygorii.strashko@linaro.org> wrote:
> From: Grygorii Strashko <Grygorii.Strashko@linaro.org>
>
> The PM_RESTORE_PREPARE is not handled now in mmc_pm_notify(),
> as result mmc_rescan() could be scheduled and executed at
> late hibernation restore stages when MMC device is suspended
> already - which, in turn, will lead to system crash on TI dra7-evm board:
>
> WARNING: CPU: 0 PID: 3188 at drivers/bus/omap_l3_noc.c:148 l3_interrupt_handler+0x258/0x374()
> 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4_PER1_P3 (Idle): Data Access in User mode during Functional access
>
> Hence, add missed PM_RESTORE_PREPARE PM event in mmc_pm_notify().
>
> Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>

Huh, that was an old bug you found. :-)

I have applied it for fixes and added the below fixes tag.

Fixes: 4c2ef25fe0b8 (mmc: fix all hangs related to mmc/sd card
insert/removal during suspend/resume)

Thanks and kind regards!
Uffe

> ---
>  drivers/mmc/core/core.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index c296bc0..92e7671 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2651,6 +2651,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
>         switch (mode) {
>         case PM_HIBERNATION_PREPARE:
>         case PM_SUSPEND_PREPARE:
> +       case PM_RESTORE_PREPARE:
>                 spin_lock_irqsave(&host->lock, flags);
>                 host->rescan_disable = 1;
>                 spin_unlock_irqrestore(&host->lock, flags);
> --
> 1.9.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Grygorii.Strashko@linaro.org April 24, 2015, 10:52 a.m. UTC | #2
On 04/23/2015 04:19 PM, Ulf Hansson wrote:
> On 23 April 2015 at 12:43,  <grygorii.strashko@linaro.org> wrote:
>> From: Grygorii Strashko <Grygorii.Strashko@linaro.org>
>>
>> The PM_RESTORE_PREPARE is not handled now in mmc_pm_notify(),
>> as result mmc_rescan() could be scheduled and executed at
>> late hibernation restore stages when MMC device is suspended
>> already - which, in turn, will lead to system crash on TI dra7-evm board:
>>
>> WARNING: CPU: 0 PID: 3188 at drivers/bus/omap_l3_noc.c:148 l3_interrupt_handler+0x258/0x374()
>> 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4_PER1_P3 (Idle): Data Access in User mode during Functional access
>>
>> Hence, add missed PM_RESTORE_PREPARE PM event in mmc_pm_notify().
>>
>> Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
> 
> Huh, that was an old bug you found. :-)

oh yes. it's happened thanks to HW issue on my board which
generates a flood of SDCD IRQs :)

It's the worst case ever to track wrong/missed PM notifiers (

> 
> I have applied it for fixes and added the below fixes tag.
> 
> Fixes: 4c2ef25fe0b8 (mmc: fix all hangs related to mmc/sd card
> insert/removal during suspend/resume)

Thanks.
diff mbox

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index c296bc0..92e7671 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2651,6 +2651,7 @@  int mmc_pm_notify(struct notifier_block *notify_block,
 	switch (mode) {
 	case PM_HIBERNATION_PREPARE:
 	case PM_SUSPEND_PREPARE:
+	case PM_RESTORE_PREPARE:
 		spin_lock_irqsave(&host->lock, flags);
 		host->rescan_disable = 1;
 		spin_unlock_irqrestore(&host->lock, flags);