Message ID | 20181002215223.20453-4-bvanassche@acm.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | sd: Rely on the driver core for asynchronous probing | expand |
On Tue, Oct 02, 2018 at 02:52:23PM -0700, Bart Van Assche wrote: > Since __device_release_driver() is called with the device lock held > and since the same device lock is obtained by the functions that > perform asynchronous probing (driver_attach_async() and > __device_attach_async_helper()), asynchronous probing is already > serialized against __device_release_driver(). Remove the > async_synchronize_full() call from __device_release_driver() to > avoid that a deadlock is triggered. Hmm, I see. Well, the idea was to let all outstanding async probes (scheduled but not yet running) to complete before releasing the driver. I am not sure if anyone actually needs this behavior and implementing it in deadlock free way is nigh impossible, so Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> > > See also commit 765230b5f084 ("driver-core: add asynchronous probing > support for drivers"). Should probably be "Fixes: 765230b5f084 ..." > > Signed-off-by: Bart Van Assche <bvanassche@acm.org> > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> > Cc: Lee Duncan <lduncan@suse.com> > Cc: Hannes Reinecke <hare@suse.com> > Cc: Luis R. Rodriguez <mcgrof@suse.com> > Cc: Johannes Thumshirn <jthumshirn@suse.de> > Cc: Christoph Hellwig <hch@lst.de> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > --- > drivers/base/dd.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/base/dd.c b/drivers/base/dd.c > index edfc9f0b1180..d6520de659bd 100644 > --- a/drivers/base/dd.c > +++ b/drivers/base/dd.c > @@ -926,9 +926,6 @@ static void __device_release_driver(struct device *dev, struct device *parent) > > drv = dev->driver; > if (drv) { > - if (driver_allows_async_probing(drv)) > - async_synchronize_full(); > - > while (device_links_busy(dev)) { > device_unlock(dev); > if (parent) > -- > 2.19.0.605.g01d371f741-goog > Thanks.
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index edfc9f0b1180..d6520de659bd 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -926,9 +926,6 @@ static void __device_release_driver(struct device *dev, struct device *parent) drv = dev->driver; if (drv) { - if (driver_allows_async_probing(drv)) - async_synchronize_full(); - while (device_links_busy(dev)) { device_unlock(dev); if (parent)
Since __device_release_driver() is called with the device lock held and since the same device lock is obtained by the functions that perform asynchronous probing (driver_attach_async() and __device_attach_async_helper()), asynchronous probing is already serialized against __device_release_driver(). Remove the async_synchronize_full() call from __device_release_driver() to avoid that a deadlock is triggered. See also commit 765230b5f084 ("driver-core: add asynchronous probing support for drivers"). Signed-off-by: Bart Van Assche <bvanassche@acm.org> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Lee Duncan <lduncan@suse.com> Cc: Hannes Reinecke <hare@suse.com> Cc: Luis R. Rodriguez <mcgrof@suse.com> Cc: Johannes Thumshirn <jthumshirn@suse.de> Cc: Christoph Hellwig <hch@lst.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/base/dd.c | 3 --- 1 file changed, 3 deletions(-)