Linux Power Management development
 help / color / mirror / Atom feed
From: Brian Norris <briannorris@chromium.org>
To: "Rafael J. Wysocki (Intel)" <rafael@kernel.org>
Cc: Ulf Hansson <ulf.hansson@oss.qualcomm.com>,
	Linux PM <linux-pm@vger.kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Linux Driver Core Development <driver-core@lists.linux.dev>,
	Javen Xu <javen_xu@realsil.com.cn>, Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH v2 2/2] PM: runtime: Call rpm_idle() in rpm_resume() for active devices
Date: Tue, 1 Dec 2026 12:13:41 -0800	[thread overview]
Message-ID: <aw8qdYUopKDRKZK2@google.com> (raw)
In-Reply-To: <CAJZ5v0hdk=zaiJw-kWZ0v6CdJJy=C2JOv4-Jojz6dNwXZ0hbhQ@mail.gmail.com>

On Tue, Dec 01, 2026 at 03:08:13PM +0100, Rafael J. Wysocki (Intel) wrote:
> On Tue, Dec 1, 2026 at 1:37 AM Brian Norris <briannorris@chromium.org> wrote:
> > e.g., the dedicated wakeirq stuff here makes me scratch my head some:
> >
> >   56f487c78015 PM / Runtime: Update last_busy in rpm_resume
> >   4990d4fe327b PM / Wakeirq: Add automated device wake IRQ handling
> >
> > Commit 56f487c78015 seems to suggest it's relying on a non-zero
> > autosuspend delay to avoid problems. (Very sketchy IMO.) I can't tell if
> > those are actual functional problems, or if that was just a suboptimal
> > behavior / performance problem.
> 
> Wakeup IRQs are a special case to some extent because they occur
> during system suspend-resume while runtime PM is disabled anyway and
> their role is mostly to wake up the system as a whole rather than to
> wake up a specific device.

Mostly but not entirely. They clearly care about runtime-PM scenarios
too; otherwise commit 56f487c78015 wouldn't really be important. (It was
intentionally provided as a prerequiste to commit 4990d4fe327b.)

> There are also other places where pm_runtime_resume() is called in
> response to a device wakeup signal, but those cases rely on the
> .runtime_resume() callback to recognize whether or not the wakeup was
> genuine and do something to prevent the device from suspending again.

Sure. And presumably "dedicated wake IRQ" devices should also be doing
something similar, but it's not clear that they uniformly do so
correctly. And as I interpret it, I think commit 56f487c78015 implies
the use case in question did not do that.

> Resuming a device without taking a reference to it doesn't guarantee
> anything in any case because user space may toggle power/control to
> "on" and back to "auto" at any time which will at least start an
> autosuspend timer for the device.  This way or another, rpm_suspend()
> may run for the given device at any time and if it is not actively
> prevented from suspending the device, it will do that.

Ack. I think we all agree there are many reasons this stuff is fragile,
if anyone is relying on it :)

> > But drivers/net/ethernet/realtek/r8169_main.c is a similar one, that I
> > believe is functionally wrong today, and possibly made worse with your
> > patch.
> >
> > Specifically, see:
> >
> >   phylink_link_up -> rtl_mac_link_up() -> pm_request_resume()
> >
> > In that context, netif_carrier_on() has not yet run, and so
> > rtl8169_runtime_idle() may still rearm its suspend timer
> > (pm_schedule_suspend()). Because rtl8169_runtime_suspend() does *not*
> > recheck netif_carrier_ok(), this means that 10 seconds later, we may
> > runtime-suspend an active link.
> 
> That's correct.
> 
> > I believe this technically regressed with commit 8a3c76523e44 ("r8169:
> > add support for phylink"), where the calling conditions for
> > pm_request_resume() changed.
> >
> > I'm no netdev / phylink expert, but it feels like maybe the driver
> > should be doing get()/put() in .mac_link_{up,down}(), rather than
> > relying only on carefully crafted .runtime_idle() + pm_request_resume().
> 
> I agree.

OK, I sent a bugfix here:

[PATCH net-next 1/2] r8169: hold runtime PM reference while link is up
https://lore.kernel.org/all/20261201115920.net-next.1.Idb20d02896f15f4a79b68a9fee4f3bed1ea49543@changeid/

and paired that with converting to autosuspend / dropping
.runtime_idle().

Brian

  reply	other threads:[~2026-12-01 20:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 15:01 [PATCH v2 0/2] PM: runtime: Consolidation of last_busy updates and calling rpm_idle() in rpm_resume() Rafael J. Wysocki
2026-11-30 15:04 ` [PATCH v2 1/2] PM: runtime: Drop redundant last_busy update from rpm_resume() Rafael J. Wysocki
2026-11-30 17:09   ` Ulf Hansson
2026-11-30 15:07 ` [PATCH v2 2/2] PM: runtime: Call rpm_idle() in rpm_resume() for active devices Rafael J. Wysocki
2026-11-30 17:08   ` Ulf Hansson
2026-11-30 17:24     ` Rafael J. Wysocki (Intel)
2026-11-30 19:25       ` Rafael J. Wysocki (Intel)
2026-12-01  0:37         ` Brian Norris
2026-12-01 14:08           ` Rafael J. Wysocki (Intel)
2026-12-01 20:13             ` Brian Norris [this message]
2026-12-01  9:16       ` Ulf Hansson
2026-12-01 13:36         ` Rafael J. Wysocki (Intel)
2026-12-01 15:15   ` 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=aw8qdYUopKDRKZK2@google.com \
    --to=briannorris@chromium.org \
    --cc=andrew@lunn.ch \
    --cc=driver-core@lists.linux.dev \
    --cc=javen_xu@realsil.com.cn \
    --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