lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jeY3dFRCZr0h874q=dFQ7CvPy2XnemGQ6Zh5xB_Bu+ZQ@mail.gmail.com>
Date:   Thu, 4 Feb 2021 19:41:12 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Saravana Kannan <saravanak@...gle.com>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        Marc Zyngier <maz@...nel.org>,
        Tudor Ambarus <Tudor.Ambarus@...rochip.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        Martin Kaiser <martin@...ser.cx>,
        Rob Herring <robh+dt@...nel.org>,
        Frank Rowand <frowand.list@...il.com>,
        Len Brown <lenb@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        "Cc: Android Kernel" <kernel-team@...roid.com>
Subject: Re: [PATCH v2 2/3] driver core: fw_devlink: Handle missing drivers
 for optional suppliers

On Tue, Feb 2, 2021 at 8:47 PM Saravana Kannan <saravanak@...gle.com> wrote:
>
> On Tue, Feb 2, 2021 at 6:34 AM Rafael J. Wysocki <rafael@...nel.org> wrote:
> >
> > On Tue, Feb 2, 2021 at 5:33 AM Saravana Kannan <saravanak@...gle.com> wrote:
> > >

[cut]

> >
> > > + *
> > > + * This function requests fw_devlink to set itself up for a deferred probe
> > > + * retry. This allows fw_devlink to ignore device links it created to
> > > + * suppliers that'll never probe. This is necessary in case some of the
> > > + * suppliers are optional and their consumers can probe without them.
> > > + *
> > > + * Returns true if deferred probe retry is likely to make any difference.
> > > + */
> > > +bool fw_devlink_deferred_probe_retry(void)
> > > +{
> > > +       if (IS_ENABLED(CONFIG_MODULES))
> > > +               return false;
> >
> > To make the above more visible, I'd fold this function into the caller.
>
> I had written it this way because I'm thinking of adding a timeout
> heuristic for MODULES in here. I can move it to the caller if you feel
> strongly about it.

Not really strongly, but then moving it back when you need doesn't
sound particularly troublesome to me. :-)

> >
> > > +
> > > +       fw_devlink_def_probe_retry = true;
> > > +       return fw_devlink_get_flags() && !fw_devlink_is_permissive();
> > > +}
> > > +
> > >  /**
> > >   * fw_devlink_create_devlink - Create a device link from a consumer to fwnode
> > >   * @con - Consumer device for the device link
> > > diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> > > index 9179825ff646..11325df2327f 100644
> > > --- a/drivers/base/dd.c
> > > +++ b/drivers/base/dd.c
> > > @@ -317,6 +317,11 @@ static int deferred_probe_initcall(void)
> > >         driver_deferred_probe_trigger();
> > >         /* Sort as many dependencies as possible before exiting initcalls */
> > >         flush_work(&deferred_probe_work);
> > > +
> > > +       if (fw_devlink_deferred_probe_retry()) {
> > > +               driver_deferred_probe_trigger();
> > > +               flush_work(&deferred_probe_work);
> > > +       }
> > >         initcalls_done = true;
> > >
> > >         /*
> > > --
> >
> > Overall, the "let's do nothing if modules are not enabled" approach is
> > a bit disappointing, because what if somebody builds all of the
> > drivers needed for boot in and enables modules anyway, for example to
> > allow USB drivers to be probed dynamically?
>
> Yeah, I'm disappointed too :( But I'm trying to get it to work for
> !MODULES so that we can enable fw_devlink=on by default at least for
> !MODULES to make sure drivers don't introduce more issues going
> forward. And then I plan to continue working on making it work
> correctly for MODULES case too.
>
> Getting fw_devlink=on to work perfectly for MODULES and !MODULES is
> not a problem at all. But it needs fixing a bunch of drivers (mostly
> simple fixes like setting the right flag, handling deferred probes
> correctly, etc), but I'm hitting a catch-22 here. I can't find the
> drivers without setting fw_devlink=on by default. But if I did that,
> it's going to break a bunch of boards.
>
> What's your thought on leaving fw_devlink=on by default on 5.12 and
> fixing drivers as issues are reported?

If there are any issues known today that need to be addressed, I'd fix
them first and then try to enable fw_devlink=on maybe just for
!MODULES to start with.

> If that's a no, do you have any other ideas on how to deal with this catch-22?

Try to enable, fix issues as they show up in linux-next.  If there are
still outstanding issues before the next release, back off and try in
the next cycle.  Repeat.

This doesn't sound particularly attractive, but I don't have any
better idea, sorry.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ