[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGETcx9E5DB4UtdjjAO2=XfTNXdXocj7uk0JkVZ8hf9YadwNcA@mail.gmail.com>
Date: Thu, 12 Jun 2025 10:56:55 -0700
From: Saravana Kannan <saravanak@...gle.com>
To: Sean Anderson <sean.anderson@...ux.dev>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J . Wysocki" <rafael@...nel.org>,
Danilo Krummrich <dakr@...nel.org>, linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
Christoph Hellwig <hch@....de>, Rob Herring <robh+dt@...nel.org>, Grant Likely <grant.likely@...aro.org>
Subject: Re: [PATCH] driver core: Prevent deferred probe loops
On Thu, Jun 12, 2025 at 8:53 AM Sean Anderson <sean.anderson@...ux.dev> wrote:
>
> On 6/11/25 08:23, Greg Kroah-Hartman wrote:
> > On Tue, Jun 10, 2025 at 07:44:27PM -0400, Sean Anderson wrote:
> >> On 6/10/25 19:32, Saravana Kannan wrote:
> >> > On Tue, Jun 10, 2025 at 11:35 AM Sean Anderson <sean.anderson@...ux.dev> wrote:
> >> >>
> >> >> A deferred probe loop can occur when a device returns EPROBE_DEFER after
> >> >> registering a bus with children:
> >> >
> >> > This is a broken driver. A parent device shouldn't register child
> >> > devices unless it is fully read itself. It's not logical to say the
> >> > child devices are available, if the parent itself isn't fully ready.
> >> > So, adding child devices/the bus should be the last thing done in the
> >> > parent's probe function.
> >> >
> >> > I know there are odd exceptions where the parent depends on the child,
> >> > so they might add the child a bit earlier in the probe
> >>
> >> This is exactly the case here. So the bus probing cannot happen any
> >> later than it already does.
> >
> > Please fix the driver not to do this.
>
> How? The driver needs the PCS to work. And the PCS can live on the MDIO
> bus.
Obviously I don't know the full details, but you could implement it as
MFD. So the bus part would not get removed even if the PCS fails to
probe. Then the PCS can probe when whatever it needs ends up probing.
>
> >> > but in those cases, the parent's probe should still do all the checks
> >> > ahead of time.
> >>
> >> Such as what? How is the parent going to know the resource is missing
> >> without checking for it?
> >>
> >> > Can you be more specific about the actual failure you are seeing?
> >>
> >> MAC is looking for a PCS that's on its internal MDIO bus, but that PCS's
> >> driver isn't loaded. The PCS has to be loaded at probe time because
> >> phylink_create needs it, and phylink is necessary to register the
> >> netdev. The latter situation is not ideal, but it would be quite a bit
> >> of work to untangle.
I meant, point to a specific device in a DT and the driver. Provide
logs of the failure if possible, etc. Tell me which device is failing
and why, etc. That way, I can take a closer look or give you other
suggestions.
-Saravana
> >
> > Please untangle, don't put stuff in the driver core for broken
> > subsystems. That is just pushing the maintaince of this from the driver
> > authors to the driver core maintainers for the next 20+ years :(
>
> What makes it broken? The "mess" has already been made in netdev. The driver
> authors have already pushed it off onto phylink.
>
> And by "quite a bit of work to untangle" I mean the PCS affects settings
> (ethtool ksettings, MII IOCTL) that are exposed to userspace as soon as
> the netdev is registered. So we cannot move to a "delayed" lookup
> without breaking reading/modifying the settings. We could of course fake
> it, but what happens when e.g. userspace looks at the settings and
> breaks because we are not reporting the right capabilities (which would
> have been reported in the past)?
>
> --Sean
Powered by blists - more mailing lists