From: "Csókás Bence" <csokas.bence@prolan.hu>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"Varshini Rajendran" <varshini.rajendran@microchip.com>,
Tudor Ambarus <tudor.ambarus@linaro.org>,
Mark Brown <broonie@kernel.org>, <linux-spi@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
"Len Brown" <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Danilo Krummrich <dakr@kernel.org>,
"Alexander Dahl" <ada@thorsis.com>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
Pavel Machek <pavel@kernel.org>
Subject: Re: [PATCH v5 1/2] pm: runtime: Add new devm functions
Date: Thu, 27 Mar 2025 14:24:28 +0100 [thread overview]
Message-ID: <d926d2c2-8cc9-4a71-b8ca-b5f03ac9afb8@prolan.hu> (raw)
In-Reply-To: <CAJZ5v0jka2r9PaKsF0FE2qJaFfnVNGd8sZRE6Aay-Ugpzot44w@mail.gmail.com>
Hi,
On 2025. 03. 27. 12:08, Rafael J. Wysocki wrote:
>>> Now, there is a reason why calling pm_runtime_set_suspended() on a
>>> device after disabling runtime PM for it is a good idea at all.
>>> Namely, disabling runtime PM alone does not release the device's
>>> suppliers or its parent, so if you want to release them after
>>> disabling runtime PM for the device, you need to do something more.
>>> I'm thinking that this is a mistake in the design of the runtime PM
>>> core.
>>
>> Well, this is the order in which the original driver worked before
>> anyways. As a quick fix, would it work if we created a devm function
>> that would pm_runtime_set_active(), immediately followed by
>> pm_runtime_enable(), and on cleanup it would pm_runtime_set_suspended()
>> followed by pm_runtime_disable_action() (i.e.
>> pm_runtime_dont_use_autosuspend() and pm_runtime_disable())?
>
> On cleanup you'd need to ensure that pm_runtime_disable() is followed
> by pm_runtime_set_suspended() (not the other way around). Also
> pm_runtime_dont_use_autosuspend() needs to be called when runtime PM
> is still enabled.
>
> With the above taken into account, it would work.
Ok, so which is the correct order then?
1. the way it is done now in [PATCH v5 2/2] (which is the same order the
driver has been using before anyways):
pm_runtime_use_autosuspend()
/-- devm_pm_runtime_set_active()
| /-- devm_pm_runtime_enable()
| | /-- devm_pm_runtime_get_noresume()
| | |
| | \-> pm_runtime_put_noidle()
| \-> pm_runtime_dont_use_autosuspend() &&
| pm_runtime_disable()
\-> pm_runtime_set_suspended()
or,
2. swapped set_suspended() and runtime_disable()
pm_runtime_use_autosuspend()
/-- devm_pm_runtime_set_active_enabled() [new fn]
| == pm_runtime_set_active() &&
| pm_runtime_enable()
| /-- devm_pm_runtime_get_noresume()
| |
| \-> pm_runtime_put_noidle()
\--> pm_runtime_set_suspended()
pm_runtime_dont_use_autosuspend()
pm_runtime_disable()
Bence
next prev parent reply other threads:[~2025-03-27 13:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-17 9:34 [PATCH v5 0/2] Add more devm_ functions to fix PM imbalance in spi/atmel-quadspi.c Bence Csókás
2025-03-17 9:34 ` [PATCH v5 1/2] pm: runtime: Add new devm functions Bence Csókás
2025-03-26 17:38 ` Rafael J. Wysocki
2025-03-27 9:02 ` Csókás Bence
2025-03-27 11:08 ` Rafael J. Wysocki
2025-03-27 13:24 ` Csókás Bence [this message]
2025-03-27 14:14 ` Rafael J. Wysocki
2025-03-27 16:11 ` Csókás Bence
2025-03-27 16:45 ` Rafael J. Wysocki
2025-03-17 9:34 ` [PATCH v5 2/2] spi: atmel-quadspi: Fix unbalanced pm_runtime by using devm_ API Bence Csókás
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d926d2c2-8cc9-4a71-b8ca-b5f03ac9afb8@prolan.hu \
--to=csokas.bence@prolan.hu \
--cc=ada@thorsis.com \
--cc=alexandre.belloni@bootlin.com \
--cc=broonie@kernel.org \
--cc=claudiu.beznea@tuxon.dev \
--cc=dakr@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=len.brown@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=pavel@kernel.org \
--cc=pavel@ucw.cz \
--cc=rafael@kernel.org \
--cc=tudor.ambarus@linaro.org \
--cc=varshini.rajendran@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®