public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: core: Clarify EPROBE_DEFER retry mechanism
@ 2024-11-05  4:55 anish kumar
  2024-11-07 17:18 ` anish kumar
  2024-11-12 20:21 ` Jonathan Corbet
  0 siblings, 2 replies; 5+ messages in thread
From: anish kumar @ 2024-11-05  4:55 UTC (permalink / raw)
  To: corbet; +Cc: linux-kernel, linux-doc, 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.

Signed-off-by: anish kumar <yesanishhere@gmail.com>
---
 Documentation/driver-api/driver-model/driver.rst | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Documentation/driver-api/driver-model/driver.rst b/Documentation/driver-api/driver-model/driver.rst
index 06f818b1d622..c86b948d0dfe 100644
--- a/Documentation/driver-api/driver-model/driver.rst
+++ b/Documentation/driver-api/driver-model/driver.rst
@@ -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)


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drivers: core: Clarify EPROBE_DEFER retry mechanism
  2024-11-05  4:55 [PATCH] drivers: core: Clarify EPROBE_DEFER retry mechanism anish kumar
@ 2024-11-07 17:18 ` anish kumar
  2024-11-07 19:12   ` Jonathan Corbet
  2024-11-12 20:21 ` Jonathan Corbet
  1 sibling, 1 reply; 5+ messages in thread
From: anish kumar @ 2024-11-07 17:18 UTC (permalink / raw)
  To: corbet; +Cc: linux-kernel, linux-doc

Hello Jonathan,

Wondering if you have any comments?

On Mon, Nov 4, 2024 at 8:55 PM anish kumar <yesanishhere@gmail.com> wrote:
>
> 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.
>
> Signed-off-by: anish kumar <yesanishhere@gmail.com>
> ---
>  Documentation/driver-api/driver-model/driver.rst | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/driver-api/driver-model/driver.rst b/Documentation/driver-api/driver-model/driver.rst
> index 06f818b1d622..c86b948d0dfe 100644
> --- a/Documentation/driver-api/driver-model/driver.rst
> +++ b/Documentation/driver-api/driver-model/driver.rst
> @@ -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)
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drivers: core: Clarify EPROBE_DEFER retry mechanism
  2024-11-07 17:18 ` anish kumar
@ 2024-11-07 19:12   ` Jonathan Corbet
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Corbet @ 2024-11-07 19:12 UTC (permalink / raw)
  To: anish kumar; +Cc: linux-kernel, linux-doc

anish kumar <yesanishhere@gmail.com> writes:

> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drivers: core: Clarify EPROBE_DEFER retry mechanism
  2024-11-05  4:55 [PATCH] drivers: core: Clarify EPROBE_DEFER retry mechanism anish kumar
  2024-11-07 17:18 ` anish kumar
@ 2024-11-12 20:21 ` Jonathan Corbet
  2024-11-12 20:25   ` anish kumar
  1 sibling, 1 reply; 5+ messages in thread
From: Jonathan Corbet @ 2024-11-12 20:21 UTC (permalink / raw)
  To: anish kumar; +Cc: linux-kernel, linux-doc, anish kumar

anish kumar <yesanishhere@gmail.com> writes:

> 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.
>
> Signed-off-by: anish kumar <yesanishhere@gmail.com>
> ---
>  Documentation/driver-api/driver-model/driver.rst | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/driver-api/driver-model/driver.rst b/Documentation/driver-api/driver-model/driver.rst
> index 06f818b1d622..c86b948d0dfe 100644
> --- a/Documentation/driver-api/driver-model/driver.rst
> +++ b/Documentation/driver-api/driver-model/driver.rst
> @@ -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.

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

jon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drivers: core: Clarify EPROBE_DEFER retry mechanism
  2024-11-12 20:21 ` Jonathan Corbet
@ 2024-11-12 20:25   ` anish kumar
  0 siblings, 0 replies; 5+ messages in thread
From: anish kumar @ 2024-11-12 20:25 UTC (permalink / raw)
  To: Jonathan Corbet; +Cc: linux-kernel, linux-doc

On Tue, Nov 12, 2024 at 12:21 PM Jonathan Corbet <corbet@lwn.net> wrote:
>
> anish kumar <yesanishhere@gmail.com> writes:
>
> > 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.
> >
> > Signed-off-by: anish kumar <yesanishhere@gmail.com>
> > ---
> >  Documentation/driver-api/driver-model/driver.rst | 11 +++++++----
> >  1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/Documentation/driver-api/driver-model/driver.rst b/Documentation/driver-api/driver-model/driver.rst
> > index 06f818b1d622..c86b948d0dfe 100644
> > --- a/Documentation/driver-api/driver-model/driver.rst
> > +++ b/Documentation/driver-api/driver-model/driver.rst
> > @@ -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.
>
> 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.

>
> jon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-12 20:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-05  4:55 [PATCH] drivers: core: Clarify EPROBE_DEFER retry mechanism anish kumar
2024-11-07 17:18 ` anish kumar
2024-11-07 19:12   ` Jonathan Corbet
2024-11-12 20:21 ` Jonathan Corbet
2024-11-12 20:25   ` anish kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox