]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
driver core: Make deferred_probe_timeout default a Kconfig option
authorHans de Goede <johannes.goede@oss.qualcomm.com>
Sat, 14 Mar 2026 08:49:16 +0000 (09:49 +0100)
committerDanilo Krummrich <dakr@kernel.org>
Mon, 30 Mar 2026 18:45:27 +0000 (20:45 +0200)
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.

Reviewed-by: Saravana Kannan <saravanak@kernel.org>
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Link: https://patch.msgid.link/20260314084916.10868-1-johannes.goede@oss.qualcomm.com
[ Drop deferred_probe_timeout documentation change in
  kernel-parameters.txt. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
drivers/base/Kconfig
drivers/base/dd.c

index 1786d87b29e227e2b6e8ecb4a0ece00be34f37fe..f7d385cbd3ba4b2b533220dbb2c462fee42e24de 100644 (file)
@@ -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
index a46e28236068a3180c7122ffd7700d84819a0141..cb5046f0634de9f6dfdfa380843a0025b9b7ecd2 100644 (file)
@@ -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)
 {