driver core: Reprobe consumer if it was unbound by dropped device_link
A message that is not in the archive (sent off-list or not yet received): [email protected]
RFC PATCH 1/1 driver core: Reprobe consumer if it was unbound by dropped device_link
Put consumer device to deferred probe list if it is unbound due to a dropped link to a supplier.
When a device link supplier is unbound (either manually or because one of its own suppliers was unbound), its consumers are unbound as well. Currently if the supplier binds again after this the consumer does not automatically probe again. With this patch it does.
If this patch is not acceptable as such, how about adding this behavior behind a new device link flag?
The idea to this patch was gotten from this post by Lucas Wunner:
https://www.spinics.net/lists/dri-devel/msg166318.html
Part of the code and the description is borrowed from him.
--- drivers/base/base.h | 1 + drivers/base/core.c | 2 ++ drivers/base/dd.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/base/base.h +1 -0
@@ -114,6 +114,7 @@ extern void device_release_driver_internal(struct device *dev,extern void driver_detach (struct device_driver *drv);extern int driver_probe_device (struct device_driver *drv,struct device *dev); +extern void driver_deferred_probe_add (struct device *dev);extern void driver_deferred_probe_del (struct device *dev);static inline int driver_match_device (struct device_driver *drv,struct device *dev)
drivers/base/core.c +2 -0
@@ -570,6 +570,8 @@ void device_links_unbind_consumers(struct device *dev)device_release_driver_internal (consumer,NULL , consumer->parent); +driver_deferred_probe_add (consumer); +put_device (consumer); goto start; }
drivers/base/dd.c +1 -1
@@ -140,7 +140,7 @@ static void deferred_probe_work_func(struct work_struct *work) } static DECLARE_WORK(deferred_probe_work, deferred_probe_work_func); -static void driver_deferred_probe_add (struct device *dev) +void driver_deferred_probe_add (struct device *dev) {mutex_lock (&deferred_probe_mutex);if (list_empty (&dev->p->deferred_probe)) {
Signature · 1 line
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Quoted 7 lines · Jyri Sarha
Put consumer device to deferred probe list if it is unbound due to a dropped link to a supplier.
When a device link supplier is unbound (either manually or because one of its own suppliers was unbound), its consumers are unbound as well. Currently if the supplier binds again after this the consumer does not automatically probe again. With this patch it does.
Yes I think this makes sense, based on the rationale that the consumer was automatically unbound, so by symmetry it should also be automatically rebound.
The only thing I don't understand is you wrote in an earlier e-mail of a difference in behavior depending on whether driver_deferred_probe_add() is called before or after device_release_driver_internal(). That's really odd, it shouldn't make a difference.
Thanks,
Lukas
Quoted 57 lines
If this patch is not acceptable as such, how about adding this behavior behind a new device link flag?
The idea to this patch was gotten from this post by Lucas Wunner:
https://www.spinics.net/lists/dri-devel/msg166318.htmlPart of the code and the description is borrowed from him.
cc Lukas Wunner <[email protected]>cc Rafael J. Wysocki <[email protected]>cc Thierry Reding <[email protected]>Signed-off-by Jyri Sarha <[email protected]>--- drivers/base/base.h | 1 + drivers/base/core.c | 2 ++ drivers/base/dd.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-)drivers/base/base.h +1
-0@@ -114,6 +114,7 @@ extern void device_release_driver_internal(struct device *dev,extern void driver_detach (struct device_driver *drv);extern int driver_probe_device (struct device_driver *drv,struct device *dev); +extern void driver_deferred_probe_add (struct device *dev);extern void driver_deferred_probe_del (struct device *dev);static inline int driver_match_device (struct device_driver *drv,struct device *dev)drivers/base/core.c +2
-0@@ -570,6 +570,8 @@ void device_links_unbind_consumers(struct device *dev)device_release_driver_internal (consumer,NULL , consumer->parent); +driver_deferred_probe_add (consumer); +put_device (consumer); goto start; }drivers/base/dd.c +1
-1@@ -140,7 +140,7 @@ static void deferred_probe_work_func(struct work_struct *work) } static DECLARE_WORK(deferred_probe_work, deferred_probe_work_func); -static void driver_deferred_probe_add (struct device *dev) +void driver_deferred_probe_add (struct device *dev) {mutex_lock (&deferred_probe_mutex);if (list_empty (&dev->p->deferred_probe)) {
Quoted 9 lines · Lukas Wunner
Quoted 7 lines · Jyri Sarha
Put consumer device to deferred probe list if it is unbound due to a dropped link to a supplier.
When a device link supplier is unbound (either manually or because one of its own suppliers was unbound), its consumers are unbound as well. Currently if the supplier binds again after this the consumer does not automatically probe again. With this patch it does.
Quoted 9 lines
Yes I think this makes sense, based on the rationale that the consumer was automatically unbound, so by symmetry it should also be automatically rebound.
The only thing I don't understand is you wrote in an earlier e-mail of a difference in behavior depending on whether
driver_deferred_probe_add()is called before or afterdevice_release_driver_internal(). That's really odd, it shouldn't make a difference.
In that version there was a couple of other bugs elsewhere in the system. I tried to reproduce that situation again multiple times, but I could not (even write those bugs back in there, and move the link creation back to panel bridge code). But even from reading the code that difference did not make any sense. I suspect a heisen-bug, after I have read the code and understood that the crash is not possible, it does not happen anymore :).
With the current version I could not find any difference in behaviour depending on the order of device_release_driver_internal() and driver_deferred_probe_add() calls. I just thought having them in this order just lookes nicer.
I stress tested the code by unloading and loading the panel driver in a tight loop, for several minutes, but it simply wont crash (not in this setup anyway). The probe of tilcdc eventually gracefully fails in a CMA failure.
Best regards,
Jyri
Quoted 61 lines
Thanks,
Lukas
Quoted 57 lines
If this patch is not acceptable as such, how about adding this behavior behind a new device link flag?
The idea to this patch was gotten from this post by Lucas Wunner:
https://www.spinics.net/lists/dri-devel/msg166318.htmlPart of the code and the description is borrowed from him.
cc Lukas Wunner <[email protected]>cc Rafael J. Wysocki <[email protected]>cc Thierry Reding <[email protected]>Signed-off-by Jyri Sarha <[email protected]>--- drivers/base/base.h | 1 + drivers/base/core.c | 2 ++ drivers/base/dd.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-)drivers/base/base.h +1
-0@@ -114,6 +114,7 @@ extern void device_release_driver_internal(struct device *dev,extern void driver_detach (struct device_driver *drv);extern int driver_probe_device (struct device_driver *drv,struct device *dev); +extern void driver_deferred_probe_add (struct device *dev);extern void driver_deferred_probe_del (struct device *dev);static inline int driver_match_device (struct device_driver *drv,struct device *dev)drivers/base/core.c +2
-0@@ -570,6 +570,8 @@ void device_links_unbind_consumers(struct device *dev)device_release_driver_internal (consumer,NULL , consumer->parent); +driver_deferred_probe_add (consumer); +put_device (consumer); goto start; }drivers/base/dd.c +1
-1@@ -140,7 +140,7 @@ static void deferred_probe_work_func(struct work_struct *work) } static DECLARE_WORK(deferred_probe_work, deferred_probe_work_func); -static void driver_deferred_probe_add (struct device *dev) +void driver_deferred_probe_add (struct device *dev) {mutex_lock (&deferred_probe_mutex);if (list_empty (&dev->p->deferred_probe)) {
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Quoted 33 lines · Jyri Sarha
Quoted 9 lines · Lukas Wunner
Quoted 7 lines · Jyri Sarha
Put consumer device to deferred probe list if it is unbound due to a dropped link to a supplier.
When a device link supplier is unbound (either manually or because one of its own suppliers was unbound), its consumers are unbound as well. Currently if the supplier binds again after this the consumer does not automatically probe again. With this patch it does.
Quoted 9 lines
Yes I think this makes sense, based on the rationale that the consumer was automatically unbound, so by symmetry it should also be automatically rebound.
The only thing I don't understand is you wrote in an earlier e-mail of a difference in behavior depending on whether
driver_deferred_probe_add()is called before or afterdevice_release_driver_internal(). That's really odd, it shouldn't make a difference.In that version there was a couple of other bugs elsewhere in the system. I tried to reproduce that situation again multiple times, but I could not (even write those bugs back in there, and move the link creation back to panel bridge code). But even from reading the code that difference did not make any sense. I suspect a heisen-bug, after I have read the code and understood that the crash is not possible, it does not happen anymore :).
With the current version I could not find any difference in behaviour depending on the order of
device_release_driver_internal()anddriver_deferred_probe_add()calls. I just thought having them in this order just lookes nicer.
Quoted 4 lines
I stress tested the code by unloading and loading the panel driver in a tight loop, for several minutes, but it simply wont crash (not in this setup anyway). The probe of tilcdc eventually gracefully fails in a CMA failure.
Is this still moving or stuck? Pinging since Sean just brought up the drm_bridge lifetime issues, and I think it'd be nice if we could solve those by using device_link, like we've added already for drm_panel.
Quoted 1 line
From my very layman understanding of the discussions,
device_linknot
quite working for deferred probing is the blocker for this plan.
Also adding Sean.
-Daniel
Quoted 74 lines
Best regards,
JyriQuoted 56 lines
Thanks,
Lukas
Quoted 52 lines
If this patch is not acceptable as such, how about adding this behavior behind a new device link flag?
The idea to this patch was gotten from this post by Lucas Wunner:
https://www.spinics.net/lists/dri-devel/msg166318.htmlPart of the code and the description is borrowed from him.
cc Lukas Wunner <[email protected]>cc Rafael J. Wysocki <[email protected]>cc Thierry Reding <[email protected]>Signed-off-by Jyri Sarha <[email protected]>--- drivers/base/base.h | 1 + drivers/base/core.c | 2 ++ drivers/base/dd.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-)drivers/base/base.h +1
-0@@ -114,6 +114,7 @@ extern void device_release_driver_internal(struct device *dev,extern void driver_detach (struct device_driver *drv);extern int driver_probe_device (struct device_driver *drv,struct device *dev); +extern void driver_deferred_probe_add (struct device *dev);extern void driver_deferred_probe_del (struct device *dev);static inline int driver_match_device (struct device_driver *drv,struct device *dev)drivers/base/core.c +2
-0@@ -570,6 +570,8 @@ void device_links_unbind_consumers(struct device *dev)device_release_driver_internal (consumer,NULL , consumer->parent); +driver_deferred_probe_add (consumer); +put_device (consumer); goto start; }drivers/base/dd.c +0
-0@@ -140,7 +140,7 @@ static void deferred_probe_work_func(struct work_struct *work) } static DECLARE_WORK(deferred_probe_work, deferred_probe_work_func);Quoted 5 lines
drivers/base/dd.c static void deferred_probe_work_func(struct work_struct *work) · line 146
Quoted 5 lines
drivers/base/dd.c +1
-1-static void driver_deferred_probe_add (struct device *dev) +void driver_deferred_probe_add (struct device *dev) {mutex_lock (&deferred_probe_mutex);if (list_empty (&dev->p->deferred_probe)) {--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 39 lines · Daniel Vetter
Quoted 33 lines · Jyri Sarha
Quoted 9 lines · Lukas Wunner
Quoted 7 lines · Jyri Sarha
Put consumer device to deferred probe list if it is unbound due to a dropped link to a supplier.
When a device link supplier is unbound (either manually or because one of its own suppliers was unbound), its consumers are unbound as well. Currently if the supplier binds again after this the consumer does not automatically probe again. With this patch it does.
Quoted 9 lines
Yes I think this makes sense, based on the rationale that the consumer was automatically unbound, so by symmetry it should also be automatically rebound.
The only thing I don't understand is you wrote in an earlier e-mail of a difference in behavior depending on whether
driver_deferred_probe_add()is called before or afterdevice_release_driver_internal(). That's really odd, it shouldn't make a difference.In that version there was a couple of other bugs elsewhere in the system. I tried to reproduce that situation again multiple times, but I could not (even write those bugs back in there, and move the link creation back to panel bridge code). But even from reading the code that difference did not make any sense. I suspect a heisen-bug, after I have read the code and understood that the crash is not possible, it does not happen anymore :).
With the current version I could not find any difference in behaviour depending on the order of
device_release_driver_internal()anddriver_deferred_probe_add()calls. I just thought having them in this order just lookes nicer.Quoted 4 lines
I stress tested the code by unloading and loading the panel driver in a tight loop, for several minutes, but it simply wont crash (not in this setup anyway). The probe of tilcdc eventually gracefully fails in a CMA failure.
Quoted 6 lines
Is this still moving or stuck? Pinging since Sean just brought up the
drm_bridgelifetime issues, and I think it'd be nice if we could solve those by usingdevice_link, like we've added already fordrm_panel. From my very layman understanding of the discussions,device_linknot quite working for deferred probing is the blocker for this plan.
I would say stuck. As there is has not been any traffic regarding this patch after Lukas' reply. And I've been busy with other things since then. Perhaps I did not know to cc the right people.
A reviewed-by or tested-by from someone would probably help to get this spinning again. I am happy to do changes or improvements etc., but for that I would need suggestions.
As far as I can tell the patch is good to apply as it is, but then again I am no device core expert.
Best regards,
Jyri
Quoted 80 lines
Also adding Sean.
-DanielQuoted 74 lines
Best regards,
JyriQuoted 56 lines
Thanks,
Lukas
Quoted 52 lines
If this patch is not acceptable as such, how about adding this behavior behind a new device link flag?
The idea to this patch was gotten from this post by Lucas Wunner:
https://www.spinics.net/lists/dri-devel/msg166318.htmlPart of the code and the description is borrowed from him.
cc Lukas Wunner <[email protected]>cc Rafael J. Wysocki <[email protected]>cc Thierry Reding <[email protected]>Signed-off-by Jyri Sarha <[email protected]>--- drivers/base/base.h | 1 + drivers/base/core.c | 2 ++ drivers/base/dd.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-)drivers/base/base.h +1
-0@@ -114,6 +114,7 @@ extern void device_release_driver_internal(struct device *dev,extern void driver_detach (struct device_driver *drv);extern int driver_probe_device (struct device_driver *drv,struct device *dev); +extern void driver_deferred_probe_add (struct device *dev);extern void driver_deferred_probe_del (struct device *dev);static inline int driver_match_device (struct device_driver *drv,struct device *dev)drivers/base/core.c +2
-0@@ -570,6 +570,8 @@ void device_links_unbind_consumers(struct device *dev)device_release_driver_internal (consumer,NULL , consumer->parent); +driver_deferred_probe_add (consumer); +put_device (consumer); goto start; }drivers/base/dd.c +0
-0@@ -140,7 +140,7 @@ static void deferred_probe_work_func(struct work_struct *work) } static DECLARE_WORK(deferred_probe_work, deferred_probe_work_func);Quoted 5 lines
drivers/base/dd.c static void deferred_probe_work_func(struct work_struct *work) · line 146
Quoted 5 lines
drivers/base/dd.c +1
-1-static void driver_deferred_probe_add (struct device *dev) +void driver_deferred_probe_add (struct device *dev) {mutex_lock (&deferred_probe_mutex);if (list_empty (&dev->p->deferred_probe)) {--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Quoted 51 lines · Jyri Sarha
Quoted 39 lines · Daniel Vetter
Quoted 33 lines · Jyri Sarha
Quoted 9 lines · Lukas Wunner
Quoted 7 lines · Jyri Sarha
Put consumer device to deferred probe list if it is unbound due to a dropped link to a supplier.
When a device link supplier is unbound (either manually or because one of its own suppliers was unbound), its consumers are unbound as well. Currently if the supplier binds again after this the consumer does not automatically probe again. With this patch it does.
Quoted 9 lines
Yes I think this makes sense, based on the rationale that the consumer was automatically unbound, so by symmetry it should also be automatically rebound.
The only thing I don't understand is you wrote in an earlier e-mail of a difference in behavior depending on whether
driver_deferred_probe_add()is called before or afterdevice_release_driver_internal(). That's really odd, it shouldn't make a difference.In that version there was a couple of other bugs elsewhere in the system. I tried to reproduce that situation again multiple times, but I could not (even write those bugs back in there, and move the link creation back to panel bridge code). But even from reading the code that difference did not make any sense. I suspect a heisen-bug, after I have read the code and understood that the crash is not possible, it does not happen anymore :).
With the current version I could not find any difference in behaviour depending on the order of
device_release_driver_internal()anddriver_deferred_probe_add()calls. I just thought having them in this order just lookes nicer.Quoted 4 lines
I stress tested the code by unloading and loading the panel driver in a tight loop, for several minutes, but it simply wont crash (not in this setup anyway). The probe of tilcdc eventually gracefully fails in a CMA failure.
Quoted 6 lines
Is this still moving or stuck? Pinging since Sean just brought up the
drm_bridgelifetime issues, and I think it'd be nice if we could solve those by usingdevice_link, like we've added already fordrm_panel. From my very layman understanding of the discussions,device_linknot quite working for deferred probing is the blocker for this plan.I would say stuck. As there is has not been any traffic regarding this patch after Lukas' reply. And I've been busy with other things since then. Perhaps I did not know to cc the right people.
Quoted 6 lines
A reviewed-by or tested-by from someone would probably help to get this spinning again. I am happy to do changes or improvements etc., but for that I would need suggestions.
As far as I can tell the patch is good to apply as it is, but then again I am no device core expert.
I do think the cc list is good and has all the stakeholders on it (Greg/Rafeal are the main ones I think).
Maybe this also didn't get much attention since it's not (yet) a big problem in drm? Only drm_panel uses device_link, the discussion to add that for drm_bridge also seems to have died down. But from my far-away observer vantage point (we don't use device_link nor panel or bridge in drm/i915) it does all sound like a good approach.
Interest from i915 side might go up, since we're using component already and device_link will probably happen eventually too (for better handling the suspend/resume ordering of i915 vs. snd-hda and other stuff), and then I guess we'll need this? Otoh we're not big on EPROBE_DEFER in x86 :-)
Cheers, Daniel
Quoted 89 lines
Best regards,
JyriQuoted 80 lines
Also adding Sean.
-DanielQuoted 74 lines
Best regards,
JyriQuoted 56 lines
Thanks,
Lukas
Quoted 52 lines
If this patch is not acceptable as such, how about adding this behavior behind a new device link flag?
The idea to this patch was gotten from this post by Lucas Wunner:
https://www.spinics.net/lists/dri-devel/msg166318.htmlPart of the code and the description is borrowed from him.
cc Lukas Wunner <[email protected]>cc Rafael J. Wysocki <[email protected]>cc Thierry Reding <[email protected]>Signed-off-by Jyri Sarha <[email protected]>--- drivers/base/base.h | 1 + drivers/base/core.c | 2 ++ drivers/base/dd.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-)drivers/base/base.h +1
-0@@ -114,6 +114,7 @@ extern void device_release_driver_internal(struct device *dev,extern void driver_detach (struct device_driver *drv);extern int driver_probe_device (struct device_driver *drv,struct device *dev); +extern void driver_deferred_probe_add (struct device *dev);extern void driver_deferred_probe_del (struct device *dev);static inline int driver_match_device (struct device_driver *drv,struct device *dev)drivers/base/core.c +2
-0@@ -570,6 +570,8 @@ void device_links_unbind_consumers(struct device *dev)device_release_driver_internal (consumer,NULL , consumer->parent); +driver_deferred_probe_add (consumer); +put_device (consumer); goto start; }drivers/base/dd.c +0
-0@@ -140,7 +140,7 @@ static void deferred_probe_work_func(struct work_struct *work) } static DECLARE_WORK(deferred_probe_work, deferred_probe_work_func);Quoted 5 lines
drivers/base/dd.c static void deferred_probe_work_func(struct work_struct *work) · line 146
Quoted 5 lines
drivers/base/dd.c +1
-1-static void driver_deferred_probe_add (struct device *dev) +void driver_deferred_probe_add (struct device *dev) {mutex_lock (&deferred_probe_mutex);if (list_empty (&dev->p->deferred_probe)) {--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-develSignature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch