Skip to contentSkip to conversation

mmc: tmio: properly balance RPM on remove

RFC PATCH In review Wolfram Sang 3 participants 4 messages May 13, 2020 – May 15, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 mmc: tmio: properly balance RPM on remove

From: Wolfram Sang <[email protected]>

Because we enabled the device with _noresume, we should disable it with _noidle to match the ref counting of the clocks during remove().

---

I think this is the proper fix to the problem Geert reported [1]. I am not sure about a proper Fixes-tag, though. The corresponding _noidle call in the probe()-error-path was added with:

aa86f1a38875 ("mmc: tmio: Fixup runtime PM management during probe")

However, from my understanding this is more fitting?

1b32999e205b ("mmc: tmio: Avoid boilerplate code in ->runtime_suspend()")

But maybe my understanding of the situation is still not perfect and even the commit message is bogus? Ulf, since both mentioned commits are from you, could you have a look? Thanks in advance!

Wolfram

[1] Message-ID: <[email protected]>

 drivers/mmc/host/tmio_mmc_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/tmio_mmc_core.c +1 -1
index 9520bd94cf43..9a4ae954553b 100644
@@ -1235,7 +1235,7 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
 	pm_runtime_dont_use_autosuspend(&pdev->dev);
 	if (host->native_hotplug)
 		pm_runtime_put_noidle(&pdev->dev);
-	pm_runtime_put_sync(&pdev->dev);
+	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 }
 EXPORT_SYMBOL_GPL(tmio_mmc_host_remove);
Signature · 1 line
2.20.1
#1 lore raw
Quoted 16 lines · Wolfram Sang

From: Wolfram Sang <[email protected]>

Because we enabled the device with _noresume, we should disable it with _noidle to match the ref counting of the clocks during remove().

---

I think this is the proper fix to the problem Geert reported [1]. I am not sure about a proper Fixes-tag, though. The corresponding _noidle call in the probe()-error-path was added with:

aa86f1a38875 ("mmc: tmio: Fixup runtime PM management during probe")

Quoted 7 lines

However, from my understanding this is more fitting?

1b32999e205b ("mmc: tmio: Avoid boilerplate code in ->runtime_suspend()")

But maybe my understanding of the situation is still not perfect and even the commit message is bogus? Ulf, since both mentioned commits are from you, could you have a look? Thanks in advance!

I did start to look at it, but got sidetracked with other things. Anyway, I will check in the next couple of days.

Kind regards
Uffe

Quoted 24 lines

Wolfram

[1] Message-ID: <[email protected]>

 drivers/mmc/host/tmio_mmc_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/tmio_mmc_core.c +1 -2
index 9520bd94cf43..9a4ae954553b 100644
@@ -1235,7 +1235,7 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
        pm_runtime_dont_use_autosuspend(&pdev->dev);
        if (host->native_hotplug)
                pm_runtime_put_noidle(&pdev->dev);
-       pm_runtime_put_sync(&pdev->dev);
+       pm_runtime_put_noidle(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
 }
 EXPORT_SYMBOL_GPL(tmio_mmc_host_remove);
--

2.20.1

#2 lore raw
Quoted 3 lines

I did start to look at it, but got sidetracked with other things. Anyway, I will check in the next couple of days.

Much appreciated, thanks!

Reviewed-by Tested-by on v1 1/1
#3 lore raw
In reply to Wolfram Sang

Hi Wolfram,

Quoted 7 lines · Wolfram Sang

From: Wolfram Sang <[email protected]>

Because we enabled the device with _noresume, we should disable it with _noidle to match the ref counting of the clocks during remove().

Quoted 1 line

I think this is the proper fix to the problem Geert reported [1]. I am

Thanks, I can confirm this fixes the issue on unbind, so

Quoted 4 lines

not sure about a proper Fixes-tag, though. The corresponding _noidle call in the probe()-error-path was added with:

aa86f1a38875 ("mmc: tmio: Fixup runtime PM management during probe")

That one also added a pm_runtime_put() call to the normal probe path, but a pm_runtime_put_noidle() call to the error path, causing another possible imbalance, which is still there.
So I guess the former has to be replaced by a _noidle call, too?

Also, the conditional

        if (_host->native_hotplug)
                pm_runtime_get_noresume(&pdev->dev);

in probe() is not undone in the error path.

Quoted 11 lines

However, from my understanding this is more fitting?

1b32999e205b ("mmc: tmio: Avoid boilerplate code in ->runtime_suspend()")

But maybe my understanding of the situation is still not perfect and even the commit message is bogus? Ulf, since both mentioned commits are from you, could you have a look? Thanks in advance!

Wolfram

[1] Message-ID: <[email protected]>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds