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]
Date:   Tue, 14 Sep 2021 09:01:32 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Saravana Kannan <saravanak@...gle.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        John Stultz <john.stultz@...aro.org>,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        Rob Herring <robh+dt@...nel.org>, Andrew Lunn <andrew@...n.ch>,
        Vladimir Oltean <olteanv@...il.com>,
        Android Kernel Team <kernel-team@...roid.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1 2/5] driver core: Set deferred probe reason when
 deferred by driver core

Hi Saravana,

On Tue, Sep 14, 2021 at 6:39 AM Saravana Kannan <saravanak@...gle.com> wrote:
> When the driver core defers the probe of a device, set the deferred
> probe reason so that it's easier to debug. The deferred probe reason is
> available in debugfs under devices_deferred.
>
> Signed-off-by: Saravana Kannan <saravanak@...gle.com>

Thanks for your patch!

> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -955,6 +955,29 @@ static void device_links_missing_supplier(struct device *dev)
>         }
>  }
>
> +/**
> + * dev_set_def_probe_reason - Set the deferred probe reason for a device
> + * @dev: the pointer to the struct device
> + * @fmt: printf-style format string
> + * @...: arguments as specified in the format string
> + *
> + * This is a more caller-friendly version of device_set_deferred_probe_reason()
> + * that takes variable argument inputs similar to dev_info().
> + */
> +static void dev_set_def_probe_reason(const struct device *dev, const char *fmt, ...)

So this is indeed similar to device_set_deferred_probe_reason(),
but the function's name is completely different, unlike e.g.
(v)printf()?

> +{
> +       struct va_format vaf;
> +       va_list args;
> +
> +       va_start(args, fmt);
> +       vaf.fmt = fmt;
> +       vaf.va = &args;
> +
> +       device_set_deferred_probe_reason(dev, &vaf);
> +
> +       va_end(args);
> +}

I think you can just make this a macro wrapper calling
dev_err_probe(dev, -EPROBE_DEFER, fmt, ...).
Or open-code that below.

> +
>  /**
>   * device_links_check_suppliers - Check presence of supplier drivers.
>   * @dev: Consumer device.
> @@ -975,6 +998,7 @@ int device_links_check_suppliers(struct device *dev)
>  {
>         struct device_link *link;
>         int ret = 0;
> +       struct fwnode_handle *sup_fw;
>
>         /*
>          * Device waiting for supplier to become available is not allowed to
> @@ -983,10 +1007,13 @@ int device_links_check_suppliers(struct device *dev)
>         mutex_lock(&fwnode_link_lock);
>         if (dev->fwnode && !list_empty(&dev->fwnode->suppliers) &&
>             !fw_devlink_is_permissive()) {
> +               sup_fw = list_first_entry(&dev->fwnode->suppliers,
> +                                         struct fwnode_link,
> +                                         c_hook)->supplier;
>                 dev_dbg(dev, "probe deferral - wait for supplier %pfwP\n",
> -                       list_first_entry(&dev->fwnode->suppliers,
> -                       struct fwnode_link,
> -                       c_hook)->supplier);
> +                       sup_fw);
> +               dev_set_def_probe_reason(dev,
> +                       "wait for supplier %pfwP\n", sup_fw);

dev_err_probe() would replace both the dev_dbg() and the
dev_set_def_probe_reason().

>                 mutex_unlock(&fwnode_link_lock);
>                 return -EPROBE_DEFER;
>         }
> @@ -1003,6 +1030,9 @@ int device_links_check_suppliers(struct device *dev)
>                         device_links_missing_supplier(dev);
>                         dev_dbg(dev, "probe deferral - supplier %s not ready\n",
>                                 dev_name(link->supplier));
> +                       dev_set_def_probe_reason(dev,
> +                               "supplier %s not ready\n",
> +                               dev_name(link->supplier));

Likewise.

>                         ret = -EPROBE_DEFER;
>                         break;
>                 }

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ