public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: martin_liu <liumartin@google.com>
Cc: stern@rowland.harvard.edu, heikki.krogerus@linux.intel.com,
	johan@kernel.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org, jenhaochen@google.com
Subject: Re: [RFC PATCH v2] driver core: hold dev's parent lock when needed
Date: Tue, 29 May 2018 09:47:30 +0200	[thread overview]
Message-ID: <20180529074730.GA23486@kroah.com> (raw)
In-Reply-To: <20180529070719.164626-1-liumartin@google.com>

On Tue, May 29, 2018 at 03:07:20PM +0800, martin_liu wrote:
> SOC have internal I/O buses that can't be proved for devices. The
> 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).
> 
> In commit 'bf74ad5bc417 introduce ("[PATCH] Hold the device's
> parent's lock during probe and remove")' to solve USB subsystem
> lock sequence since usb device's characteristic. Thus "soc"
> 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 device struct and driver core would lock the parent lock base
> on the flag. For usbsystem, we set this flag when its device and
> driver is matched and to keep original lock behavior in driver
> core.
> 
> Async probe could have more benefit after this patch.
> 
> Signed-off-by: martin_liu <liumartin@google.com>

Nit, your name here is probably not what you sign legal documents with.
Please use your "real name" in this line, and in your From: email line
(hint, no '_').  This prevents me from accepting the patch at all.

> Suggested-by: Alan Stern <stern@rowland.harvard.edu>

Changes were suggested, I don't know if the whole idea was :)

> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -992,6 +992,7 @@ struct device {
>  	bool			offline_disabled:1;
>  	bool			offline:1;
>  	bool			of_node_reused:1;
> +	bool			need_parent_lock:1;

Shouldn't this be a bus type flag, and not a device-specific flag?  You
are only ever caring about this based on the type of bus the device is
on, the rule would not be different for different devices on the same
bus from what I can tell.

thanks,

greg k-h

  reply	other threads:[~2018-05-29  7:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-22 14:12 [RFC] driver core: don't hold dev's parent lock when using async probe martin_liu
2018-05-22 17:09 ` Alan Stern
2018-05-24 14:00   ` Martin Liu
2018-05-24 15:02     ` Alan Stern
2018-05-24 16:05       ` Martin Liu
2018-05-29  7:07       ` [RFC PATCH v2] driver core: hold dev's parent lock when needed martin_liu
2018-05-29  7:47         ` Greg KH [this message]
2018-05-29 14:07         ` Alan Stern
2018-05-29 16:34           ` [RFC PATCH v3] " Martin Liu
2018-05-29 16:59             ` Greg KH
2018-05-29 17:08             ` Andy Shevchenko
2018-05-29 18:49             ` Alan Stern
2018-05-30 16:31               ` [PATCH v4] " Martin Liu
2018-05-30 17:21                 ` Alan Stern
2018-05-31  6:31                   ` Greg KH
2018-05-31  7:27                     ` Martin Liu
2018-05-31 18:55                       ` Andy Shevchenko
2018-05-29 15:28         ` [RFC PATCH v2] " Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180529074730.GA23486@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jenhaochen@google.com \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=liumartin@google.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox