All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pandey, Radhey Shyam" <radheys@amd.com>
To: Vinod Koul <vkoul@kernel.org>,
	Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Cc: tomi.valkeinen@ideasonboard.com, neil.armstrong@linaro.org,
	michal.simek@amd.com, linux-kernel@vger.kernel.org,
	linux-phy@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, git@amd.com,
	Sashiko <sashiko-bot@kernel.org>
Subject: Re: [PATCH] phy: zynqmp: register PHY provider after probe initialization
Date: Tue, 11 Aug 2026 21:20:27 +0530	[thread overview]
Message-ID: <f0e8a9be-6767-4cd5-9c92-c5e6c33332db@amd.com> (raw)
In-Reply-To: <ansFRgkKgEHVVFJL@vaman>

On 8/11/2026 4:49 PM, Vinod Koul wrote:
> On 07-08-26, 21:55, Radhey Shyam Pandey wrote:
>> Register the OF PHY provider only after saved_regs allocation and
>> runtime PM setup complete successfully. Publishing the provider
>> mid-probe allowed concurrent consumers to obtain a phy via xpsgtr_xlate()
>> while probe could still fail, leaving them with references into driver
>> state that devres would free on the error path.
> 
> That fails for me!
> 
Thanks for the review. I assume you mean build failure? If yes, I will
rebase it on the latest linux-phy next branch and send out v2.

Also to add - this is a theoretical race identified through sashiko and
not something hit in practice. fw_devlink does enforce the ordering, but
since it can be disabled, it seemed better to make the driver itself
robust rather than depend on that.

>>
>> Reported-by: Sashiko <sashiko-bot@kernel.org>
>> Link: https://lore.kernel.org/all/20260720155732.9DA581F000E9@smtp.kernel.org
>> Fixes: b3db66f62446 ("phy: xilinx: add runtime PM support")
>> Fixes: 5af9b304bc60 ("phy: xilinx: phy-zynqmp: Fix SGMII linkup failure on resume")
>> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
>> ---
>>   drivers/phy/xilinx/phy-zynqmp.c | 15 ++++++++-------
>>   1 file changed, 8 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c
>> index 240626b55475..8930cbe24b5a 100644
>> --- a/drivers/phy/xilinx/phy-zynqmp.c
>> +++ b/drivers/phy/xilinx/phy-zynqmp.c
>> @@ -1060,13 +1060,6 @@ static int xpsgtr_probe(struct platform_device *pdev)
>>   					    xpsgtr_status_read);
>>   	}
>>   
>> -	/* Register the PHY provider. */
>> -	provider = devm_of_phy_provider_register(&pdev->dev, xpsgtr_xlate);
>> -	if (IS_ERR(provider)) {
>> -		dev_err(&pdev->dev, "registering provider failed\n");
>> -		return PTR_ERR(provider);
>> -	}
>> -
>>   	gtr_dev->saved_regs = devm_kmalloc(gtr_dev->dev,
>>   					   sizeof(save_reg_address),
>>   					   GFP_KERNEL);
>> @@ -1082,6 +1075,14 @@ static int xpsgtr_probe(struct platform_device *pdev)
>>   		return ret;
>>   	}
>>   
>> +	provider = devm_of_phy_provider_register(&pdev->dev, xpsgtr_xlate);
>> +	if (IS_ERR(provider)) {
>> +		dev_err(&pdev->dev, "registering provider failed\n");
>> +		pm_runtime_put(gtr_dev->dev);
>> +		pm_runtime_disable(gtr_dev->dev);
>> +		return PTR_ERR(provider);
>> +	}
>> +
>>   	return 0;
>>   }
>>   
>>
>> base-commit: ea2bff00da89d7767d677bb68470130ba96f4928
> 
> and this does not exist for me!

oh i see , this was on linux-next, will fix it in v2.

Thanks,
Radhey

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

WARNING: multiple messages have this Message-ID (diff)
From: "Pandey, Radhey Shyam" <radheys@amd.com>
To: Vinod Koul <vkoul@kernel.org>,
	Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Cc: tomi.valkeinen@ideasonboard.com, neil.armstrong@linaro.org,
	michal.simek@amd.com, linux-kernel@vger.kernel.org,
	linux-phy@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, git@amd.com,
	Sashiko <sashiko-bot@kernel.org>
Subject: Re: [PATCH] phy: zynqmp: register PHY provider after probe initialization
Date: Tue, 11 Aug 2026 21:20:27 +0530	[thread overview]
Message-ID: <f0e8a9be-6767-4cd5-9c92-c5e6c33332db@amd.com> (raw)
In-Reply-To: <ansFRgkKgEHVVFJL@vaman>

On 8/11/2026 4:49 PM, Vinod Koul wrote:
> On 07-08-26, 21:55, Radhey Shyam Pandey wrote:
>> Register the OF PHY provider only after saved_regs allocation and
>> runtime PM setup complete successfully. Publishing the provider
>> mid-probe allowed concurrent consumers to obtain a phy via xpsgtr_xlate()
>> while probe could still fail, leaving them with references into driver
>> state that devres would free on the error path.
> 
> That fails for me!
> 
Thanks for the review. I assume you mean build failure? If yes, I will
rebase it on the latest linux-phy next branch and send out v2.

Also to add - this is a theoretical race identified through sashiko and
not something hit in practice. fw_devlink does enforce the ordering, but
since it can be disabled, it seemed better to make the driver itself
robust rather than depend on that.

>>
>> Reported-by: Sashiko <sashiko-bot@kernel.org>
>> Link: https://lore.kernel.org/all/20260720155732.9DA581F000E9@smtp.kernel.org
>> Fixes: b3db66f62446 ("phy: xilinx: add runtime PM support")
>> Fixes: 5af9b304bc60 ("phy: xilinx: phy-zynqmp: Fix SGMII linkup failure on resume")
>> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
>> ---
>>   drivers/phy/xilinx/phy-zynqmp.c | 15 ++++++++-------
>>   1 file changed, 8 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c
>> index 240626b55475..8930cbe24b5a 100644
>> --- a/drivers/phy/xilinx/phy-zynqmp.c
>> +++ b/drivers/phy/xilinx/phy-zynqmp.c
>> @@ -1060,13 +1060,6 @@ static int xpsgtr_probe(struct platform_device *pdev)
>>   					    xpsgtr_status_read);
>>   	}
>>   
>> -	/* Register the PHY provider. */
>> -	provider = devm_of_phy_provider_register(&pdev->dev, xpsgtr_xlate);
>> -	if (IS_ERR(provider)) {
>> -		dev_err(&pdev->dev, "registering provider failed\n");
>> -		return PTR_ERR(provider);
>> -	}
>> -
>>   	gtr_dev->saved_regs = devm_kmalloc(gtr_dev->dev,
>>   					   sizeof(save_reg_address),
>>   					   GFP_KERNEL);
>> @@ -1082,6 +1075,14 @@ static int xpsgtr_probe(struct platform_device *pdev)
>>   		return ret;
>>   	}
>>   
>> +	provider = devm_of_phy_provider_register(&pdev->dev, xpsgtr_xlate);
>> +	if (IS_ERR(provider)) {
>> +		dev_err(&pdev->dev, "registering provider failed\n");
>> +		pm_runtime_put(gtr_dev->dev);
>> +		pm_runtime_disable(gtr_dev->dev);
>> +		return PTR_ERR(provider);
>> +	}
>> +
>>   	return 0;
>>   }
>>   
>>
>> base-commit: ea2bff00da89d7767d677bb68470130ba96f4928
> 
> and this does not exist for me!

oh i see , this was on linux-next, will fix it in v2.

Thanks,
Radhey

  reply	other threads:[~2026-08-11 15:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 16:25 [PATCH] phy: zynqmp: register PHY provider after probe initialization Radhey Shyam Pandey
2026-08-07 16:25 ` Radhey Shyam Pandey
2026-08-07 16:31 ` sashiko-bot
2026-08-11 11:19 ` Vinod Koul
2026-08-11 11:19   ` Vinod Koul
2026-08-11 15:50   ` Pandey, Radhey Shyam [this message]
2026-08-11 15:50     ` Pandey, Radhey Shyam

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=f0e8a9be-6767-4cd5-9c92-c5e6c33332db@amd.com \
    --to=radheys@amd.com \
    --cc=git@amd.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=michal.simek@amd.com \
    --cc=neil.armstrong@linaro.org \
    --cc=radhey.shyam.pandey@amd.com \
    --cc=sashiko-bot@kernel.org \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=vkoul@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.