From: "Lucero Palau, Alejandro" <alejandro.lucero-palau@amd.com>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>,
alucerop@amd.com, linux-cxl@vger.kernel.org,
netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, ecree.xilinx@gmail.com, icheng@nvidia.com,
rafael@kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>
Subject: Re: [PATCH v1 1/4] driver core: Rely on supplier driver binding at link creation
Date: Thu, 24 Sep 2026 09:59:45 +0100 [thread overview]
Message-ID: <574bd4c5-62a1-4004-9b35-21fc05b5a2c1@amd.com> (raw)
In-Reply-To: <5e60ed2c-b50f-4949-9edb-ede80436f501@amd.com>
On 23/09/2026 10:58, Lucero Palau, Alejandro wrote:
>
> On 23/09/2026 09:49, Lucero Palau, Alejandro wrote:
>>
>> On 22/09/2026 22:39, Maxime Chevallier wrote:
>>> Hi,
>>>
>>> On 9/21/26 21:12, alucerop@amd.com wrote:
>>>> From: Alejandro Lucero <alucerop@amd.com>
>>>>
>>>> Differentiate between driver binding from PM dependency when a device
>>>> link is created. Rely on the device being bound to a driver for
>>>> validating
>>>> the supplier as some device drivers could not support PM.
>>>>
>>>> Check for supplier's PM state only if consumer specifies PM_RUNTIME
>>>> flag.
>>
>>
>> Hi Maxime,
>>
>>
>>> Hmmm this patch seems to have broken pretty much all the boards I'm
>>> running that
>>> boot with DT. I'm getting logs such as :
>>>
>>> platform 16100000.serial: Failed to create device link (0x124) with
>>> supplier
>>> 16000400.clock-controller
>>>
>>> Some are just hanging at "Starting kernel..." from u-boot.
>>>
>>> Then boards go silent as the uart dies, and I'm using that uart to
>>> access the
>>> device's console :(
>>>
>>> Found with a WIP stmmac runner for netdev CI.
>>>
>>> Unfortunately I don't have much logs to share, as this just prevents
>>> the boards
>>> from booting :( With this patch reverted, all boards boot fine
>>
>>
>> It is obvious I did not understand well the implications ...
>>
>>
>> I think the supplier device lock could be the problem behind the
>> hanging and how the supplier initialization is checked now based on
>> the driver bound behind the console issue ...
>>
>>
>> I have a couple of embedded boards to play with so I will try to
>> reproduce the problem for getting more info. FWIW, all was fine with
>> the server I tested this, no device link errors at all.
>>
>
> I have to amend my words ... the server had not exactly the same code
> :-) I have to copy things in and out due to security measures and
> sometimes is hard to have all synced.
>
>
> I think the sashiko reports could be a good start to fixing this.
>
FWIW, the problem seems to be the scoped guard. I had a plain
device_lock for using device_is_bound as required then device_unlock
after it, but moved to scoped_guard blindly ... .
I think for my impending multipf support I only need something like this:
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -761,7 +761,7 @@ struct device_link *device_link_add(struct device
*consumer,
* SYNC_STATE_ONLY link, we don't check for reverse dependencies
* because it only affects sync_state() callbacks.
*/
- if (!device_pm_initialized(supplier)
+ if ((!device_pm_not_required(supplier) &&
!device_pm_initialized(supplier))
|| (!(flags & DL_FLAG_SYNC_STATE_ONLY) &&
device_is_dependent(consumer, supplier))) {
link = NULL;
but when I studied the code I thought checking for "the supplier has not
been fully registered yet" was not being achieved if the registration
meant driver binding, what honestly confuses me because checking for
device_pm_initialized implies looking at the dev->power.in_dpm_list what
seems to only happen at device_add time ... so I wonder how the
device_link_add could use a supplier device without device_add completed.
Anyway, I will go with the simpler change posted above in v2, and keep
studying the other potential problem not directly connected to my
multipf support.
>
> Apologies for the any inconvenient.
>
> Thanks,
>
> Alejandro.
>
>
>>
>> Thank you for testing it!
>>
>>
>>
>>>
>>> Maxime
>>>
>>>> Signed-off-by: Alejandro Lucero <alucerop@amd.com>
>>>> ---
>>>> drivers/base/core.c | 27 +++++++++++++++++++--------
>>>> 1 file changed, 19 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/drivers/base/core.c b/drivers/base/core.c
>>>> index 4c0c373998a1..eb6d87e35d76 100644
>>>> --- a/drivers/base/core.c
>>>> +++ b/drivers/base/core.c
>>>> @@ -834,15 +834,26 @@ struct device_link *device_link_add(struct
>>>> device *consumer,
>>>> device_pm_lock();
>>>> /*
>>>> - * If the supplier has not been fully registered yet or there
>>>> is a
>>>> - * reverse (non-SYNC_STATE_ONLY) dependency between the
>>>> consumer and
>>>> - * the supplier already in the graph, return NULL. If the link
>>>> is a
>>>> - * SYNC_STATE_ONLY link, we don't check for reverse dependencies
>>>> - * because it only affects sync_state() callbacks.
>>>> + * If the supplier has not been fully registered yet with a
>>>> driver
>>>> + * return NULL.
>>>> */
>>>> - if (!device_pm_initialized(supplier)
>>>> - || (!(flags & DL_FLAG_SYNC_STATE_ONLY) &&
>>>> - device_is_dependent(consumer, supplier))) {
>>>> + scoped_guard(device, supplier) {
>>>> + if (!device_is_bound(supplier)) {
>>>> + link = NULL;
>>>> + goto out;
>>>> + }
>>>> + }
>>>> + /*
>>>> + * If consumer asks for PM to use the link and the supplier
>>>> has not
>>>> + * PM initialized, or if there is a reverse (non-SYNC_STATE_ONLY)
>>>> + * dependency between the consumer and the supplier already in
>>>> the
>>>> + * graph, return NULL. If the link is a SYNC_STATE_ONLY link, we
>>>> + * don't check for reverse dependencies because it only affects
>>>> + * sync_state() callbacks.
>>>> + */
>>>> + if (((flags & DL_FLAG_PM_RUNTIME) &&
>>>> !device_pm_initialized(supplier)) ||
>>>> + (!(flags & DL_FLAG_SYNC_STATE_ONLY) &&
>>>> + device_is_dependent(consumer, supplier))) {
>>>> link = NULL;
>>>> goto out;
>>>> }
next prev parent reply other threads:[~2026-09-24 8:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 19:12 [PATCH v1 0/4] Type2 multipf support alucerop
2026-09-21 19:12 ` [PATCH v1 1/4] driver core: Rely on supplier driver binding at link creation alucerop
2026-09-22 21:39 ` Maxime Chevallier
2026-09-23 8:49 ` Lucero Palau, Alejandro
2026-09-23 9:58 ` Lucero Palau, Alejandro
2026-09-24 8:59 ` Lucero Palau, Alejandro [this message]
2026-09-21 19:12 ` [PATCH v1 2/4] cxl/region: Add region reference in memdev attach alucerop
2026-09-21 19:12 ` [PATCH v1 3/4] cxl/memdev: Add support for multi PF devices alucerop
2026-09-21 23:07 ` Dave Jiang
2026-09-22 14:07 ` Lucero Palau, Alejandro
2026-09-22 16:39 ` Dave Jiang
2026-09-21 19:12 ` [PATCH v1 4/4] sfc: add multipf support alucerop
2026-09-24 1:15 ` Jonathan Cameron
2026-09-25 11:16 ` Lucero Palau, Alejandro
2026-09-25 20:24 ` Jonathan Cameron
2026-09-23 20:00 ` [syzbot ci] Re: Type2 " syzbot ci
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=574bd4c5-62a1-4004-9b35-21fc05b5a2c1@amd.com \
--to=alejandro.lucero-palau@amd.com \
--cc=alucerop@amd.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=ecree.xilinx@gmail.com \
--cc=edumazet@google.com \
--cc=icheng@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rafael@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