mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <johannes.goede@oss.qualcomm.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] driver core: Make deferred_probe_timeout default a Kconfig option
Date: Thu, 5 Feb 2026 10:14:30 +0100	[thread overview]
Message-ID: <63fa1288-c472-4cdd-ae64-dbb32fc6574f@oss.qualcomm.com> (raw)
In-Reply-To: <20260204150045.32892-1-johannes.goede@oss.qualcomm.com>

Hi all,

On 4-Feb-26 16:00, Hans de Goede wrote:
> Code using driver_deferred_probe_check_state() differs from most
> EPROBE_DEFER handling in the kernel. Where other EPROBE_DEFER handling
> (e.g. clks, gpios and regulators) waits indefinitely for suppliers to
> show up, code using driver_deferred_probe_check_state() will fail
> after the deferred_probe_timeout.
> 
> This is a problem for generic distro kernels which want to support many
> boards using a single kernel build. These kernels want as much drivers to
> be modular as possible. The initrd also should be as small as possible,
> so the initrd will *not* have drivers not needing to get the rootfs.
> 
> Combine this with waiting for a full-disk encryption password in
> the initrd and it is pretty much guaranteed that the default 10s timeout
> will be hit, causing probe() failures when drivers on the rootfs happen
> to get modprobe-d before other rootfs modules providing their suppliers.
> 
> Make the default timeout configurable from Kconfig to allow distro kernel
> configs where many of the supplier drivers are modules to set the default
> through Kconfig and allow using a value of -1 to disable the timeout
> (wait indefinitely).
> 
> Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
> ---
>  Documentation/admin-guide/kernel-parameters.txt | 2 +-
>  drivers/base/Kconfig                            | 9 +++++++++
>  drivers/base/dd.c                               | 9 ++++-----
>  3 files changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 1058f2a6d6a8..80d300c4e16b 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1250,7 +1250,7 @@ Kernel parameters
>  			out hasn't expired, it'll be restarted by each
>  			successful driver registration. This option will also
>  			dump out devices still on the deferred probe list after
> -			retrying.
> +			retrying. Set to -1 to wait indefinitely.
>  
>  	delayacct	[KNL] Enable per-task delay accounting
>  
> diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
> index 1786d87b29e2..f7d385cbd3ba 100644
> --- a/drivers/base/Kconfig
> +++ b/drivers/base/Kconfig
> @@ -73,6 +73,15 @@ config DEVTMPFS_SAFE
>  	  with the PROT_EXEC flag. This can break, for example, non-KMS
>  	  video drivers.
>  
> +config DRIVER_DEFERRED_PROBE_TIMEOUT
> +	int "Default value for deferred_probe_timeout"
> +	default 0 if !MODULES
> +	default 10 if MODULES
> +	help
> +	  Set the default value for the deferred_probe_timeout kernel parameter.
> +	  See Documentation/admin-guide/kernel-parameters.txt for a description
> +	  of the deferred_probe_timeout kernel parameter.
> +
>  config STANDALONE
>  	bool "Select only drivers that don't need compile-time external firmware"
>  	default y
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index bea8da5f8a3a..e57144aa168d 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -257,11 +257,7 @@ static int deferred_devs_show(struct seq_file *s, void *data)
>  }
>  DEFINE_SHOW_ATTRIBUTE(deferred_devs);
>  
> -#ifdef CONFIG_MODULES
> -static int driver_deferred_probe_timeout = 10;
> -#else
> -static int driver_deferred_probe_timeout;
> -#endif
> +static int driver_deferred_probe_timeout = CONFIG_DRIVER_DEFERRED_PROBE_TIMEOUT;
>  
>  static int __init deferred_probe_timeout_setup(char *str)
>  {

> @@ -323,6 +319,9 @@ static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_
>  
>  void deferred_probe_extend_timeout(void)
>  {
> +	if (driver_deferred_probe_timeout < 0)
> +		return;
> +
>  	/*
>  	 * If the work hasn't been queued yet or if the work expired, don't
>  	 * start a new one.

I just realized that this last bit adding the < 0 check is not necessary.
The work never gets scheduled if driver_deferred_probe_timeout < 0 so
the existing "if (cancel_delayed_work(&deferred_probe_timeout_work))"
check is enough to not re-schedule in this case.

I'll drop this for v2. Note I'm waiting with sending a v2 for a bit
on case there are more remarks.

Regards,

Hans



      parent reply	other threads:[~2026-02-05  9:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04 15:00 Hans de Goede
2026-02-04 21:52 ` Bjorn Andersson
2026-02-05  9:17   ` Hans de Goede
2026-02-05 13:15     ` Bjorn Andersson
2026-02-08  1:06     ` Saravana Kannan
2026-02-05  9:14 ` Hans de Goede [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63fa1288-c472-4cdd-ae64-dbb32fc6574f@oss.qualcomm.com \
    --to=johannes.goede@oss.qualcomm.com \
    --cc=dakr@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®