Re: [PATCH] driver core: Don't try to create links if they are not needed

From: Nícolas F. R. A. Prado
Date: Thu Oct 03 2024 - 11:00:02 EST


On Thu, Oct 03, 2024 at 11:25:22AM +0100, Jon Hunter wrote:
>
> On 02/10/2024 21:38, Saravana Kannan wrote:
> > On Wed, Oct 2, 2024 at 11:30 AM Jon Hunter <jonathanh@xxxxxxxxxx> wrote:
> > >
> > > Hi Greg,
> > >
> > > On 16/09/2024 18:49, Greg Kroah-Hartman wrote:
> > > > 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@xxxxxxxxxx>
> > > > > >
> > > > > > 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!
> > >
> > >
> > > Let me know if there is anything else I can answer on this one.
> >
> > Hi Jon,
> >
> > See this.
> > https://lore.kernel.org/all/c622df86-0372-450e-b3dd-ab93cd051d6f@notapiano/
> >
> > Ignore my point 1. My point 2 still stands. I got busy and forgot to
> > reply to Nícolas.
> >
> > I'm fine with either one of your patches as long as we define a
> > "useless link" function and use it in all the places.
>
>
> Thanks! Yes I am also fine with Nicolas' fix too. I quite like the dev_dbg()
> in Nicolas' version. I was wondering if we should define a function for this
> check too.
>
> Nicolas do you want to update your patch with a 'useless link' function? I
> will be happy to test on my side. Looks like you identified the exact patch
> that introduced this and have the appropriate fixes tag too.

Hi Jon,

I just sent a reply to that thread yesterday going a bit further down the rabbit
hole to try and answer if there's an underlying issue there that the log
messages are just exposing, but I still don't understand all the devlink details
involved so was hoping for some feedback from Saravana.

But if there's no feedback I can surely update the patch with the commonized
function to fix the immediate problem. I'll wait a couple days to give Saravana
(and others) some time to respond.

Thanks,
Nícolas