diff mbox series

driver core: Don't try to create links if they are not needed

Message ID 20240910130019.35081-1-jonathanh@nvidia.com
State New
Headers show
Series driver core: Don't try to create links if they are not needed | expand

Commit Message

Jon Hunter Sept. 10, 2024, 1 p.m. UTC
The following error messages are observed on boot with the Tegra234
Jetson AGX Orin board ...

 tegra-xusb-padctl 3520000.padctl: Failed to create device link (0x180)
   with 1-0008
 tegra-xusb-padctl 3520000.padctl: Failed to create device link (0x180)
   with 1-0008
 tegra-xusb-padctl 3520000.padctl: Failed to create device link (0x180)
   with 1-0008

In the above case, device_link_add() intentionally returns NULL because
these are SYNC_STATE_ONLY links and the device is already probed.
Therefore, the above messages are not actually errors. Fix this by
replicating the test from device_link_add() in the function
fw_devlink_create_devlink() and don't call device_link_add() if there
are no links to create.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
I am not sure if there is a better way to fix, but given that the
function device_link_add() is exported, I figured we could not just
move the test. Anyway, if there is a better way to fix this, let me
know.

 drivers/base/core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Greg Kroah-Hartman Sept. 11, 2024, 2:32 p.m. UTC | #1
On Tue, Sep 10, 2024 at 02:00:19PM +0100, Jon Hunter wrote:
> The following error messages are observed on boot with the Tegra234
> Jetson AGX Orin board ...
> 
>  tegra-xusb-padctl 3520000.padctl: Failed to create device link (0x180)
>    with 1-0008
>  tegra-xusb-padctl 3520000.padctl: Failed to create device link (0x180)
>    with 1-0008
>  tegra-xusb-padctl 3520000.padctl: Failed to create device link (0x180)
>    with 1-0008
> 
> In the above case, device_link_add() intentionally returns NULL because
> these are SYNC_STATE_ONLY links and the device is already probed.
> Therefore, the above messages are not actually errors. Fix this by
> replicating the test from device_link_add() in the function
> fw_devlink_create_devlink() and don't call device_link_add() if there
> are no links to create.
> 
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>

What commit id does this fix?

thanks,

greg k-h
Jon Hunter Sept. 16, 2024, 2:50 p.m. UTC | #2
On 11/09/2024 15:32, Greg Kroah-Hartman wrote:
> On Tue, Sep 10, 2024 at 02:00:19PM +0100, Jon Hunter wrote:
>> The following error messages are observed on boot with the Tegra234
>> Jetson AGX Orin board ...
>>
>>   tegra-xusb-padctl 3520000.padctl: Failed to create device link (0x180)
>>     with 1-0008
>>   tegra-xusb-padctl 3520000.padctl: Failed to create device link (0x180)
>>     with 1-0008
>>   tegra-xusb-padctl 3520000.padctl: Failed to create device link (0x180)
>>     with 1-0008
>>
>> In the above case, device_link_add() intentionally returns NULL because
>> these are SYNC_STATE_ONLY links and the device is already probed.
>> Therefore, the above messages are not actually errors. Fix this by
>> replicating the test from device_link_add() in the function
>> fw_devlink_create_devlink() and don't call device_link_add() if there
>> are no links to create.
>>
>> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> 
> What commit id does this fix?


Hard to say exactly. The above error message was first added with commit 
3fb16866b51d ("driver core: fw_devlink: Make cycle detection more 
robust") but at this time we did not have the support in place for 
Tegra234 USB. I am guessing we first started seeing this when I enabled 
support for the type-c controller in commit 16744314ee57 ("arm64: tegra: 
Populate USB Type-C Controller for Jetson AGX Orin"). I can confirm if 
that is helpful?

Jon
Greg Kroah-Hartman Sept. 16, 2024, 5:49 p.m. UTC | #3
On Mon, Sep 16, 2024 at 03:50:34PM +0100, Jon Hunter wrote:
> 
> On 11/09/2024 15:32, Greg Kroah-Hartman wrote:
> > On Tue, Sep 10, 2024 at 02:00:19PM +0100, Jon Hunter wrote:
> > > The following error messages are observed on boot with the Tegra234
> > > Jetson AGX Orin board ...
> > > 
> > >   tegra-xusb-padctl 3520000.padctl: Failed to create device link (0x180)
> > >     with 1-0008
> > >   tegra-xusb-padctl 3520000.padctl: Failed to create device link (0x180)
> > >     with 1-0008
> > >   tegra-xusb-padctl 3520000.padctl: Failed to create device link (0x180)
> > >     with 1-0008
> > > 
> > > In the above case, device_link_add() intentionally returns NULL because
> > > these are SYNC_STATE_ONLY links and the device is already probed.
> > > Therefore, the above messages are not actually errors. Fix this by
> > > replicating the test from device_link_add() in the function
> > > fw_devlink_create_devlink() and don't call device_link_add() if there
> > > are no links to create.
> > > 
> > > Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> > 
> > What commit id does this fix?
> 
> 
> Hard to say exactly. The above error message was first added with commit
> 3fb16866b51d ("driver core: fw_devlink: Make cycle detection more robust")
> but at this time we did not have the support in place for Tegra234 USB. I am
> guessing we first started seeing this when I enabled support for the type-c
> controller in commit 16744314ee57 ("arm64: tegra: Populate USB Type-C
> Controller for Jetson AGX Orin"). I can confirm if that is helpful?
> 

That helps, I'll look at this after -rc1 is out, thanks!

greg k-h
diff mbox series

Patch

diff --git a/drivers/base/core.c b/drivers/base/core.c
index b69b82da8837..5d6575e63e8b 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2181,6 +2181,15 @@  static int fw_devlink_create_devlink(struct device *con,
 			goto out;
 		}
 
+		/*
+		 * SYNC_STATE_ONLY links are useless once a consumer device has probed.
+		 * So, only create it if the consumer hasn't probed yet.
+		 */
+		if (flags & DL_FLAG_SYNC_STATE_ONLY &&
+		    con->links.status != DL_DEV_NO_DRIVER &&
+		    con->links.status != DL_DEV_PROBING)
+			goto out;
+
 		if (con != sup_dev && !device_link_add(con, sup_dev, flags)) {
 			dev_err(con, "Failed to create device link (0x%x) with %s\n",
 				flags, dev_name(sup_dev));