Skip to contentSkip to conversation

drivers: core: Clarify EPROBE_DEFER retry mechanism

PATCH In review anish kumar 2 participants 5 messages Nov 5, 2024 – Nov 12, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: core: Clarify EPROBE_DEFER retry mechanism

The existing documentation for EPROBE_DEFER explains its purpose and usage, but does not specify when deferred probes are retried. This patch adds information about the retry mechanism to provide a more complete explanation of how EPROBE_DEFER works.

Specifically, it clarifies that:

1. Deferred probes are added to a pending list
2. A successful probe of any device triggers moving all devices from the pending list to an active list
3. A workqueue processes the active list to retry deferred probes

This additional context helps developers better understand the behavior and implications of using EPROBE_DEFER in their drivers.

---
 Documentation/driver-api/driver-model/driver.rst | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
Documentation/driver-api/driver-model/driver.rst +7 -4
index 06f818b1d622..c86b948d0dfe 100644
@@ -171,10 +171,13 @@ released all resources it allocated.
 Optionally, probe() may return -EPROBE_DEFER if the driver depends on
 resources that are not yet available (e.g., supplied by a driver that
 hasn't initialized yet).  The driver core will put the device onto the
-deferred probe list and will try to call it again later. If a driver
-must defer, it should return -EPROBE_DEFER as early as possible to
-reduce the amount of time spent on setup work that will need to be
-unwound and reexecuted at a later time.
+deferred probe list and will retry again as and when a device or driver
+gets added to the system. A successful probe of any device will trigger
+moving all devices from pending list to active list. A workqueue processes
+the active list to retry deferred probes. If a driver must defer, it
+should return -EPROBE_DEFER as early as possible to reduce the amount
+of time spent on setup work that will need to be unwound and reexecuted
+at a later time.
 
 .. warning::
       -EPROBE_DEFER must not be returned if probe() has already created
Signature · 1 line
2.39.3 (Apple Git-146)
#1 lore raw

Hello Jonathan,

Wondering if you have any comments?

Quoted 46 lines · anish kumar

The existing documentation for EPROBE_DEFER explains its purpose and usage, but does not specify when deferred probes are retried. This patch adds information about the retry mechanism to provide a more complete explanation of how EPROBE_DEFER works.

Specifically, it clarifies that:

1. Deferred probes are added to a pending list
2. A successful probe of any device triggers moving all devices from the pending list to an active list
3. A workqueue processes the active list to retry deferred probes

This additional context helps developers better understand the behavior and implications of using EPROBE_DEFER in their drivers.

---
 Documentation/driver-api/driver-model/driver.rst | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
Documentation/driver-api/driver-model/driver.rst +7 -5
index 06f818b1d622..c86b948d0dfe 100644
@@ -171,10 +171,13 @@ released all resources it allocated.
 Optionally, probe() may return -EPROBE_DEFER if the driver depends on
 resources that are not yet available (e.g., supplied by a driver that
 hasn't initialized yet).  The driver core will put the device onto the
-deferred probe list and will try to call it again later. If a driver
-must defer, it should return -EPROBE_DEFER as early as possible to
-reduce the amount of time spent on setup work that will need to be
-unwound and reexecuted at a later time.
+deferred probe list and will retry again as and when a device or driver
+gets added to the system. A successful probe of any device will trigger
+moving all devices from pending list to active list. A workqueue processes
+the active list to retry deferred probes. If a driver must defer, it
+should return -EPROBE_DEFER as early as possible to reduce the amount
+of time spent on setup work that will need to be unwound and reexecuted
+at a later time.
 
 .. warning::
       -EPROBE_DEFER must not be returned if probe() has already created
--

2.39.3 (Apple Git-146)

maintainer
#2 lore raw
Quoted 3 lines · anish kumar

Hello Jonathan,

Wondering if you have any comments?

It has been three days - and not the nicest days at that. Please be more patient.

jon

maintainer
#3 lore raw
In reply to anish kumar
Quoted 29 lines · anish kumar

The existing documentation for EPROBE_DEFER explains its purpose and usage, but does not specify when deferred probes are retried. This patch adds information about the retry mechanism to provide a more complete explanation of how EPROBE_DEFER works.

Specifically, it clarifies that:

1. Deferred probes are added to a pending list
2. A successful probe of any device triggers moving all devices from the pending list to an active list
3. A workqueue processes the active list to retry deferred probes

This additional context helps developers better understand the behavior and implications of using EPROBE_DEFER in their drivers.

---
 Documentation/driver-api/driver-model/driver.rst | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
Documentation/driver-api/driver-model/driver.rst +0 -1
index 06f818b1d622..c86b948d0dfe 100644
@@ -171,10 +171,13 @@ released all resources it allocated.
 Optionally, probe() may return -EPROBE_DEFER if the driver depends on
 resources that are not yet available (e.g., supplied by a driver that
 hasn't initialized yet).  The driver core will put the device onto the
-deferred probe list and will try to call it again later. If a driver

Documentation/driver-api/driver-model/driver.rst released all resources it allocated. · line 180

Quoted 10 lines
Documentation/driver-api/driver-model/driver.rst +7 -3
-must defer, it should return -EPROBE_DEFER as early as possible to
-reduce the amount of time spent on setup work that will need to be
-unwound and reexecuted at a later time.
+deferred probe list and will retry again as and when a device or driver
+gets added to the system. A successful probe of any device will trigger
+moving all devices from pending list to active list. A workqueue processes
+the active list to retry deferred probes. If a driver must defer, it
+should return -EPROBE_DEFER as early as possible to reduce the amount
+of time spent on setup work that will need to be unwound and reexecuted
+at a later time.

Honestly, I don't see how this improves the situation? How does this improve a driver developer's work?

jon

#4 lore raw
Quoted 37 lines · Jonathan Corbet
Quoted 34 lines · anish kumar

The existing documentation for EPROBE_DEFER explains its purpose and usage, but does not specify when deferred probes are retried. This patch adds information about the retry mechanism to provide a more complete explanation of how EPROBE_DEFER works.

Specifically, it clarifies that:

1. Deferred probes are added to a pending list
2. A successful probe of any device triggers moving all devices from the pending list to an active list
3. A workqueue processes the active list to retry deferred probes

This additional context helps developers better understand the behavior and implications of using EPROBE_DEFER in their drivers.

---
 Documentation/driver-api/driver-model/driver.rst | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
Documentation/driver-api/driver-model/driver.rst +2 -4
index 06f818b1d622..c86b948d0dfe 100644
@@ -171,10 +171,13 @@ released all resources it allocated.
 Optionally, probe() may return -EPROBE_DEFER if the driver depends on
 resources that are not yet available (e.g., supplied by a driver that
 hasn't initialized yet).  The driver core will put the device onto the
-deferred probe list and will try to call it again later. If a driver
-must defer, it should return -EPROBE_DEFER as early as possible to
-reduce the amount of time spent on setup work that will need to be
-unwound and reexecuted at a later time.
+deferred probe list and will retry again as and when a device or driver
+gets added to the system. A successful probe of any device will trigger
Quoted 8 lines

Documentation/driver-api/driver-model/driver.rst released all resources it allocated. · line 180

Quoted 5 lines
Documentation/driver-api/driver-model/driver.rst +5 -0
+moving all devices from pending list to active list. A workqueue processes
+the active list to retry deferred probes. If a driver must defer, it
+should return -EPROBE_DEFER as early as possible to reduce the amount
+of time spent on setup work that will need to be unwound and reexecuted
+at a later time.

Honestly, I don't see how this improves the situation? How does this improve a driver developer's work?

It talks about when the retry mechanism executes. In my workplace we had the discussion about this and some of the developers were assuming EPROBE_DEFER gets called a fixed number of times which is not the case. This explains when EPROBE_DEFER gets called and the mechanism for the same.

Quoted 2 lines

jon