From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Alan Stern <stern@rowland.harvard.edu>,
Ulf Hansson <ulf.hansson@linaro.org>,
Johan Hovold <johan@kernel.org>,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
Jon Hunter <jonathanh@nvidia.com>
Subject: [PATCH v1 3/3] PM: core: Tweak pm_runtime_block_if_disabled() return value
Date: Thu, 27 Feb 2025 11:49:12 +0100 [thread overview]
Message-ID: <13718674.uLZWGnKmhe@rjwysocki.net> (raw)
In-Reply-To: <5000287.31r3eYUQgx@rjwysocki.net>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Modify pm_runtime_block_if_disabled() to return true when runtime PM
is disabled for the device, regardless of the power.last_status value.
This effectively prevents "smart suspend" from being enabled for
devices with runtime PM disabled in device_prepare(), even transiently,
so update the related comment in that function accordingly.
If a device has runtime PM disabled in device_prepare(), it is not
actually known whether or not runtime PM will be enabled for that
device going forward, so it is more appropriate to postpone the
"smart suspend" optimization for the device in the given system
suspend-resume cycle than to enable it and get confused going
forward.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/base/power/main.c | 2 +-
drivers/base/power/runtime.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1891,7 +1891,7 @@
pm_runtime_put(dev);
return ret;
}
- /* Do not enable "smart suspend" for devices without runtime PM. */
+ /* Do not enable "smart suspend" for devices with disabled runtime PM. */
if (smart_suspend)
smart_suspend = device_prepare_smart_suspend(dev);
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -1466,8 +1466,8 @@
spin_lock_irq(&dev->power.lock);
- ret = dev->power.disable_depth && dev->power.last_status == RPM_INVALID;
- if (ret)
+ ret = !pm_runtime_enabled(dev);
+ if (ret && dev->power.last_status == RPM_INVALID)
dev->power.last_status = RPM_BLOCKED;
spin_unlock_irq(&dev->power.lock);
next prev parent reply other threads:[~2025-02-27 11:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 10:44 [PATCH v1 0/3] PM: Tweaks on top of "smart suspend" handling changes Rafael J. Wysocki
2025-02-27 10:45 ` [PATCH v1 1/3] PM: sleep: Update power.smart_suspend under PM spinlock Rafael J. Wysocki
2025-02-27 10:47 ` [PATCH v1 2/3] PM: runtime: Convert pm_runtime_blocked() to static inline Rafael J. Wysocki
2025-02-27 10:49 ` Rafael J. Wysocki [this message]
2025-03-03 11:55 ` [PATCH v1 0/3] PM: Tweaks on top of "smart suspend" handling changes Ulf Hansson
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=13718674.uLZWGnKmhe@rjwysocki.net \
--to=rjw@rjwysocki.net \
--cc=johan@kernel.org \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=stern@rowland.harvard.edu \
--cc=ulf.hansson@linaro.org \
/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®