* Re: [PATCH v3] driver core: Move device_links_purge() after bus_remove_device()
2017-10-20 1:23 [PATCH v3] driver core: Move device_links_purge() after bus_remove_device() Jeffy Chen
@ 2017-10-20 1:22 ` Rafael J. Wysocki
2017-10-20 6:22 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2017-10-20 1:22 UTC (permalink / raw)
To: Jeffy Chen, gregkh
Cc: linux-kernel, briannorris, heiko, dmitry.torokhov, dianders,
tfiga, broonie, seanpaul, thierry.reding
On Friday, October 20, 2017 3:23:16 AM CEST Jeffy Chen wrote:
> The current ordering of code in device_del() triggers a WARN_ON()
> in device_links_purge(), because of an unexpected link status.
>
> The device_links_unbind_consumers() call in device_release_driver()
> has to take place before device_links_purge() for the status of all
> links to be correct, so move the device_links_purge() call in
> device_del() after the invocation of bus_remove_device() which calls
> device_release_driver().
>
> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
OK, thanks.
Greg, will you take this?
> ---
>
> Changes in v3:
> Remove wrong signed-off-by.
>
> Changes in v2:
> Update commit message provided by Rafael.
>
> drivers/base/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 12ebd055724c..2e683cdf4a08 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -1958,7 +1958,6 @@ void device_del(struct device *dev)
> blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
> BUS_NOTIFY_DEL_DEVICE, dev);
>
> - device_links_purge(dev);
> dpm_sysfs_remove(dev);
> if (parent)
> klist_del(&dev->p->knode_parent);
> @@ -1986,6 +1985,7 @@ void device_del(struct device *dev)
> device_pm_remove(dev);
> driver_deferred_probe_del(dev);
> device_remove_properties(dev);
> + device_links_purge(dev);
>
> /* Notify the platform of the removal, in case they
> * need to do anything...
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3] driver core: Move device_links_purge() after bus_remove_device()
@ 2017-10-20 1:23 Jeffy Chen
2017-10-20 1:22 ` Rafael J. Wysocki
0 siblings, 1 reply; 5+ messages in thread
From: Jeffy Chen @ 2017-10-20 1:23 UTC (permalink / raw)
To: linux-kernel
Cc: briannorris, heiko, gregkh, dmitry.torokhov, rjw, dianders,
tfiga, broonie, seanpaul, thierry.reding, Jeffy Chen
The current ordering of code in device_del() triggers a WARN_ON()
in device_links_purge(), because of an unexpected link status.
The device_links_unbind_consumers() call in device_release_driver()
has to take place before device_links_purge() for the status of all
links to be correct, so move the device_links_purge() call in
device_del() after the invocation of bus_remove_device() which calls
device_release_driver().
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
Changes in v3:
Remove wrong signed-off-by.
Changes in v2:
Update commit message provided by Rafael.
drivers/base/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 12ebd055724c..2e683cdf4a08 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1958,7 +1958,6 @@ void device_del(struct device *dev)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
BUS_NOTIFY_DEL_DEVICE, dev);
- device_links_purge(dev);
dpm_sysfs_remove(dev);
if (parent)
klist_del(&dev->p->knode_parent);
@@ -1986,6 +1985,7 @@ void device_del(struct device *dev)
device_pm_remove(dev);
driver_deferred_probe_del(dev);
device_remove_properties(dev);
+ device_links_purge(dev);
/* Notify the platform of the removal, in case they
* need to do anything...
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3] driver core: Move device_links_purge() after bus_remove_device()
2017-10-20 1:22 ` Rafael J. Wysocki
@ 2017-10-20 6:22 ` Greg KH
2017-10-20 11:17 ` Rafael J. Wysocki
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2017-10-20 6:22 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Jeffy Chen, linux-kernel, briannorris, heiko, dmitry.torokhov,
dianders, tfiga, broonie, seanpaul, thierry.reding
On Fri, Oct 20, 2017 at 03:22:07AM +0200, Rafael J. Wysocki wrote:
> On Friday, October 20, 2017 3:23:16 AM CEST Jeffy Chen wrote:
> > The current ordering of code in device_del() triggers a WARN_ON()
> > in device_links_purge(), because of an unexpected link status.
> >
> > The device_links_unbind_consumers() call in device_release_driver()
> > has to take place before device_links_purge() for the status of all
> > links to be correct, so move the device_links_purge() call in
> > device_del() after the invocation of bus_remove_device() which calls
> > device_release_driver().
> >
> > Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
> > Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> OK, thanks.
>
> Greg, will you take this?
Yes I will. But I don't understand if this is a bugfix that needs to go
to all stable kernels to resolve a problem that has always been there,
or it is ok for 4.15-rc1, as it's just a "do things in the correct
order" type of change.
Any hints?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] driver core: Move device_links_purge() after bus_remove_device()
2017-10-20 6:22 ` Greg KH
@ 2017-10-20 11:17 ` Rafael J. Wysocki
2017-10-20 12:01 ` jeffy
0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2017-10-20 11:17 UTC (permalink / raw)
To: Greg KH
Cc: Jeffy Chen, linux-kernel, briannorris, heiko, dmitry.torokhov,
dianders, tfiga, broonie, seanpaul, thierry.reding
On Friday, October 20, 2017 8:22:01 AM CEST Greg KH wrote:
> On Fri, Oct 20, 2017 at 03:22:07AM +0200, Rafael J. Wysocki wrote:
> > On Friday, October 20, 2017 3:23:16 AM CEST Jeffy Chen wrote:
> > > The current ordering of code in device_del() triggers a WARN_ON()
> > > in device_links_purge(), because of an unexpected link status.
> > >
> > > The device_links_unbind_consumers() call in device_release_driver()
> > > has to take place before device_links_purge() for the status of all
> > > links to be correct, so move the device_links_purge() call in
> > > device_del() after the invocation of bus_remove_device() which calls
> > > device_release_driver().
> > >
> > > Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
> > > Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > OK, thanks.
> >
> > Greg, will you take this?
>
> Yes I will. But I don't understand if this is a bugfix that needs to go
> to all stable kernels to resolve a problem that has always been there,
> or it is ok for 4.15-rc1, as it's just a "do things in the correct
> order" type of change.
>
> Any hints?
Technically the problem has always been there, but it is only visible if
device links are used in a specific way and I'm not sure whether or not
there is any code in the tree where that's the case.
That said AFAICS it should be safe to add
Fixes: 9ed9895370ae (driver core: Functional dependencies tracking support)
to it and handle it accordingly.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] driver core: Move device_links_purge() after bus_remove_device()
2017-10-20 11:17 ` Rafael J. Wysocki
@ 2017-10-20 12:01 ` jeffy
0 siblings, 0 replies; 5+ messages in thread
From: jeffy @ 2017-10-20 12:01 UTC (permalink / raw)
To: Rafael J. Wysocki, Greg KH
Cc: linux-kernel, briannorris, heiko, dmitry.torokhov, dianders,
tfiga, broonie, seanpaul, thierry.reding
Hi Rafael,
On 10/20/2017 07:17 PM, Rafael J. Wysocki wrote:
> Technically the problem has always been there, but it is only visible if
> device links are used in a specific way and I'm not sure whether or not
> there is any code in the tree where that's the case.
>
> That said AFAICS it should be safe to add
>
> Fixes: 9ed9895370ae (driver core: Functional dependencies tracking support)
right, forgot to do so, thanks for noticing :)
>
> to it and handle it accordingly.
>
> Thanks,
> Rafael
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-20 12:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-20 1:23 [PATCH v3] driver core: Move device_links_purge() after bus_remove_device() Jeffy Chen
2017-10-20 1:22 ` Rafael J. Wysocki
2017-10-20 6:22 ` Greg KH
2017-10-20 11:17 ` Rafael J. Wysocki
2017-10-20 12:01 ` jeffy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.