Linux driver-core infrastructure
 help / color / mirror / Atom feed
From: Brian Norris <briannorris@chromium.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Linux PM <linux-pm@vger.kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Ulf Hansson <ulf.hansson@oss.qualcomm.com>,
	Linux Driver Core Development <driver-core@lists.linux.dev>
Subject: Re: [PATCH v2 3/4] PM: runtime: Update last_busy in all rpm_idle() paths
Date: Mon, 30 Nov 2026 14:31:09 -0800	[thread overview]
Message-ID: <aw35LVH_PdigTAlC@google.com> (raw)
In-Reply-To: <2373315.iZASKD2KPV@rafael.j.wysocki>

On Tue, Nov 24, 2026 at 04:37:51PM +0100, Rafael J. Wysocki wrote:
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
> 
> The changelog of commit 26236a3e8803 ("PM: runtime: Update last_busy
> before calling rpm_suspend() in rpm_idle()") stated that rpm_idle() only
> needed to update last_busy when it was about to call rpm_suspend(), but
> that is incorrect.  There are still cases in which a device may be
> autosuspended earlier than expected.
> 
> Namely, when rpm_idle() returns without calling rpm_suspend(), for example
> because the callback has returned a transient error, while an autosuspend
> timer is running, the timer may suspend the device without respecting the
> autosuspend delay.  Moreover, an autosuspend timer may fire while the
> callback is running in rpm_idle() and it will not see the new last_busy
> value in that case.
> 
> To address these cases, add one more pm_runtime_mark_last_busy() call to
> rpm_idle(), before the first retval check, and add a comment next to it
> to explain the rationale for updating last_busy at that point.
> 
> Fixes: 26236a3e8803 ("PM: runtime: Update last_busy before calling rpm_suspend() in rpm_idle()")
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> v1 -> v2:
>    * Address only one case addressed by the v1 (out of two)
>    * Add a new last_busy update instead of moving the existing one in case the
>      runtime idle callback waits for the device to become idle or similar

I think there's a lot of noise in here about potentially-redundant
last_busy updates, but I suppose that's a better problem to have than
inconsistent/missing updates. I think we'd be in a happier world once
rpm_idle() is gone.

Reviewed-by: Brian Norris <briannorris@chromium.org>

  reply	other threads:[~2026-11-30 22:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 15:29 [PATCH v2 0/4] PM: runtime: Fix issues related to autosuspend Rafael J. Wysocki
2026-11-24 15:31 ` [PATCH v2 1/4] PM: runtime: Add memory barrier before reading last_busy Rafael J. Wysocki
2026-11-26  1:43   ` Brian Norris
2026-11-26 14:04     ` Rafael J. Wysocki (Intel)
2026-11-30 22:36       ` Brian Norris
2026-11-24 15:35 ` [PATCH v2 2/4] PM: runtime: Avoid suspends without respecting autosuspend delay Rafael J. Wysocki
2026-11-30 22:38   ` Brian Norris
2026-11-24 15:37 ` [PATCH v2 3/4] PM: runtime: Update last_busy in all rpm_idle() paths Rafael J. Wysocki
2026-11-30 22:31   ` Brian Norris [this message]
2026-11-24 15:39 ` [PATCH v2 4/4] PM: runtime: Update stale pm_runtime_put_sync() kerneldoc comment Rafael J. Wysocki
2026-11-30 22:39   ` Brian Norris
2026-11-26 11:51 ` [PATCH v2 0/4] PM: runtime: Fix issues related to autosuspend Ulf Hansson
2026-11-26 12:50   ` Rafael J. Wysocki (Intel)
2026-11-26 13:28     ` 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=aw35LVH_PdigTAlC@google.com \
    --to=briannorris@chromium.org \
    --cc=driver-core@lists.linux.dev \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=stern@rowland.harvard.edu \
    --cc=ulf.hansson@oss.qualcomm.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