From: Coia Prant <coiaprant@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
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 09:53:53 +0800 [thread overview]
Message-ID: <7BA9366A-3243-4A46-BA8F-BB170C8AD912@gmail.com> (raw)
In-Reply-To: <20260720172433.77b83dc7@kernel.org>
On July 21, 2026 8:24:33 AM GMT+08:00, Jakub Kicinski <kuba@kernel.org> wrote:
>On Sun, 5 Jul 2026 05:48:08 +0800 Coia Prant wrote:
>> The driver calls `pm_runtime_set_active()` before runtime PM is enabled,
>> and before the clock is prepared and enabled.
>>
>> This causes the clock to be unprepared/disabled later in the suspend
>> callback even though it was never prepared/enabled, resulting in warnings:
>>
>> clk_csr already disabled
>> clk_csr already unprepared
>>
>> Fix this by setting the initial runtime PM status to SUSPENDED instead
>> of ACTIVE.
>>
>> The clock will be properly enabled when the device is first resumed
>> via runtime PM (e.g., during MDIO access).
>
>Seems a bit odd that this hasn't been discovered until now.
>Could you add more details about your platform and maybe
>a hypothesis why we haven't noticed?
Hi,
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.
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.
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.
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.
I'm happy to send a follow-up patch addressing these points if you
agree with the direction. Let me know what you think.
Thanks,
Coia
next prev parent reply other threads:[~2026-07-21 1:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-04 21:48 Coia Prant
2026-07-21 0:24 ` Jakub Kicinski
2026-07-21 1:53 ` Coia Prant [this message]
2026-07-21 13:49 ` Jakub Kicinski
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=7BA9366A-3243-4A46-BA8F-BB170C8AD912@gmail.com \
--to=coiaprant@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fancer.lancer@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--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 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®