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: <CAHp75VdSrZU9VozQnLh0YUZVjGHXqfCXkCQMd06y=kST_bhVfg@mail.gmail.com>
Date:   Tue, 29 May 2018 20:08:08 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Martin Liu <liumartin@...gle.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Krogerus, Heikki" <heikki.krogerus@...ux.intel.com>,
        Johan Hovold <johan@...nel.org>,
        Alan Stern <stern@...land.harvard.edu>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        USB <linux-usb@...r.kernel.org>, jenhaochen@...gle.com
Subject: Re: [RFC PATCH v3] driver core: hold dev's parent lock when needed

On Tue, May 29, 2018 at 7:34 PM, Martin Liu <liumartin@...gle.com> wrote:
> SOC have internal I/O buses that can't be proved for devices. The

Perhaps SoC as a common abbr for system-on-chip.

> devices on the buses can be accessed directly without additinal
> configuration required. This type of bus is represented as
> "simple-bus". In some platforms, we name "soc" with "simple-bus"
> attribute and many devices are hooked under it desribed in DT
> (device tree).

described


>
> In commit 'bf74ad5bc417 introduce ("[PATCH] Hold the device's
> parent's lock during probe and remove")'

The formal commit reference doesn't include '' (surrounding quotes)
and words in square brackets (like [PATCH] here).

> to solve USB subsystem
> lock sequence since usb device's characteristic. Thus "soc"

usb or USB ?

> needs to be locked whenever a device and driver's probing
> happen under "soc" bus. During this period, an async driver
> tries to probe a device which is under the "soc" bus would be
> blocked until previous driver finish the probing and release "soc"
> lock. And the next probing under the "soc" bus need to wait for
> async finish. Because of that, driver's async probe for init
> time improvement will be shadowed.
>
> Since many devices don't have USB devices' characteristic, they
> actually don't need parent's lock. Thus, we introduce a lock flag
> in bus_type struct and driver core would lock the parent lock base
> on the flag. For usbsystem, we set this flag in usb relatvie

USB system

USB

relative

> bus_type struct to keep original lock behavior in driver core.
>
> Async probe could have more benefit after this patch.


> -               if (dev->parent)        /* Needed for USB */
> +               if (dev->parent && dev->bus->need_parent_lock)

So, why not to use bus directly like bus->...?

>                         device_lock(dev->parent);
>                 device_release_driver(dev);
> -               if (dev->parent)
> +               if (dev->parent && dev->bus->need_parent_lock)
>                         device_unlock(dev->parent);

Ditto here and everywhere else in the patch where applicable.

> +       .need_parent_lock = 1,
> +       .need_parent_lock =     1,
> +       .need_parent_lock =     1,

It's boolean, you need to use true or false. Check and fix your code
correspondingly.

> +       bool need_parent_lock;

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ