All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Coia Prant <coiaprant@gmail.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Serge Semin <fancer.lancer@gmail.com>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] net: pcs: xpcs-plat: fix runtime PM initialization
Date: Tue, 21 Jul 2026 06:49:10 -0700	[thread overview]
Message-ID: <20260721064910.217a6af7@kernel.org> (raw)
In-Reply-To: <7BA9366A-3243-4A46-BA8F-BB170C8AD912@gmail.com>

On Tue, 21 Jul 2026 09:53:53 +0800 Coia Prant wrote:
> I came across what looks like a runtime PM initialization issue while
> using pcs-xpcs-plat.c as a reference for the Rockchip XPCS glue driver
> (drivers/net/pcs/pcs-xpcs-rk.c).
> 
> The current code in pcs-xpcs-plat.c does:
> 
>     pm_runtime_set_active(dev);
>     ret = devm_pm_runtime_enable(dev);
> 
> This sets the initial PM state to ACTIVE before runtime PM is fully
> enabled, and before the clock is prepared and enabled.
> 
> If the device is later suspended (e.g., during unbind), the suspend
> callback may try to disable a clock that was never enabled, leading to:
> 
>     clk_csr already disabled
>     clk_csr already unprepared
> 
> On Rockchip platforms, the CSR clock (PCLK_XPCS) is required for register
> access, and this pattern seems problematic when a clock is actually
> provided.

Thanks for a clear explanation! A couple of sentences to this effect in
the commit msg could help backporters understand the severity of the
issue.

> I have a few questions:
> 
> 1. Is there a reason this hasn't been noticed before?
>    As far as I can tell, there is currently no mainline device tree
>    user that enables this driver on a platform with a real clock
>    dependency. Out-of-tree users might be using it without any clock
>    at all, or ACPI users might behave differently.

Ditto. I think we should drop the Fixes / CC: stable and instead
add a sentence that no upstream platform can currently trigger this.

> 2. Should we select PM in Kconfig and drop __maybe_unused from the
>    PM callbacks? Since this driver relies on runtime PM for clock
>    management, it seems odd to allow !PM builds.

I'm no PM expert but if it works for current users I don't see the need
to force the dependency?

> 3. Should we add a .remove callback to force suspend the device on
>    unbind? Otherwise the clock might remain enabled if the driver is
>    removed while active.

Embedded experts would have to chime in on this one. AFAIK this is a bit
of a gray area. Some users may want the link to stay up, eg to allow
WoL or avoid link training, maybe?

> I'm happy to send a follow-up patch addressing these points if you
> agree with the direction. Let me know what you think.

  reply	other threads:[~2026-07-21 13:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-04 21:48 [PATCH] net: pcs: xpcs-plat: fix runtime PM initialization Coia Prant
2026-07-21  0:24 ` Jakub Kicinski
2026-07-21  1:53   ` Coia Prant
2026-07-21 13:49     ` Jakub Kicinski [this message]
2026-07-21 15:00       ` Maxime Chevallier
2026-07-21 18:39         ` Coia Prant

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=20260721064910.217a6af7@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=coiaprant@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fancer.lancer@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.