Re: [PATCH] driver core: Fix double failed probing with fw_devlink=on
From: Saravana Kannan
Date: Mon Feb 15 2021 - 13:28:34 EST
On Mon, Feb 15, 2021 at 6:59 AM Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote:
>
> On Mon, Feb 15, 2021 at 12:16 PM Geert Uytterhoeven
> <geert+renesas@xxxxxxxxx> wrote:
> >
> > With fw_devlink=permissive, devices are added to the deferred probe
> > pending list if their driver's .probe() method returns -EPROBE_DEFER.
> >
> > With fw_devlink=on, devices are added to the deferred probe pending list
> > if they are determined to be a consumer,
If they are determined to be a consumer or if they are determined to
have a supplier that hasn't probed yet?
> > which happens before their
> > driver's .probe() method is called. If the actual probe fails later
> > (real failure, not -EPROBE_DEFER), the device will still be on the
> > deferred probe pending list, and it will be probed again when deferred
> > probing kicks in, which is futile.
> >
> > Fix this by explicitly removing the device from the deferred probe
> > pending list in case of probe failures.
> >
> > Fixes: e590474768f1cc04 ("driver core: Set fw_devlink=on by default")
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
>
> Good catch:
>
> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Geert,
The issue is real and needs to be fixed. But I'm confused how this can
happen. We won't even enter really_probe() if the driver isn't ready.
We also won't get to run the driver's .probe() if the suppliers aren't
ready. So how does the device get added to the deferred probe list
before the driver is ready? Is this due to device_links_driver_bound()
on the supplier?
Can you give a more detailed step by step on the case you are hitting?
Greg/Rafael,
Let's hold off picking this patch till I get to take a closer look
(within a day or two) please.
-Saravana
>
> > ---
> > Seen on various Renesas R-Car platforms, cfr.
> > https://lore.kernel.org/linux-acpi/CAMuHMdVL-1RKJ5u-HDVA4F4w_+8yGvQQuJQBcZMsdV4yXzzfcw@xxxxxxxxxxxxxx
> > ---
> > drivers/base/dd.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> > index 9179825ff646f4e3..91c4181093c43709 100644
> > --- a/drivers/base/dd.c
> > +++ b/drivers/base/dd.c
> > @@ -639,11 +639,13 @@ static int really_probe(struct device *dev, struct device_driver *drv)
> > case -ENXIO:
> > pr_debug("%s: probe of %s rejects match %d\n",
> > drv->name, dev_name(dev), ret);
> > + driver_deferred_probe_del(dev);
> > break;
> > default:
> > /* driver matched but the probe failed */
> > pr_warn("%s: probe of %s failed with error %d\n",
> > drv->name, dev_name(dev), ret);
> > + driver_deferred_probe_del(dev);
> > }
> > /*
> > * Ignore errors returned by ->probe so that the next driver can try
> > --
> > 2.25.1
> >