Fix issues with deferred_probe_timeout being non-zero
cover Fix issues with deferred_probe_timeout being non-zero
Setting deferred_probe_timeout to a non-zero default used to cause issues with NFS rootfs. But the fix for that is causing other problem. So revert the fix and set the default deferred_probe_timeout back to zero.
Most of the Cc list if from commit 35a672363ab3. Please let me know if you want to be removed from future patches related to deferred_probe_timeout and NFS rootfs issues.
-Saravana
Saravana Kannan (2):
driver core: Fix wait_for_device_probe() & deferred_probe_timeout
interaction
driver core: Set default deferred_probe_timeout back to 0.
drivers/base/dd.c | 10 ---------- 1 file changed, 10 deletions(-)
Signature · 1 line
2.36.1.124.g0e6072fb45-goog
PATCH 1/2 driver core: Fix wait_for_device_probe() & deferred_probe_timeout interaction
Mounting NFS rootfs was timing out when deferred_probe_timeout was non-zero [1]. This was because ip_auto_config() initcall times out waiting for the network interfaces to show up when deferred_probe_timeout was non-zero. While ip_auto_config() calls wait_for_device_probe() to make sure any currently running deferred probe work or asynchronous probe finishes, that wasn't sufficient to account for devices being deferred until deferred_probe_timeout.
Commit 35a672363ab3 ("driver core: Ensure wait_for_device_probe() waits until the deferred_probe_timeout fires") tried to fix that by making sure wait_for_device_probe() waits for deferred_probe_timeout to expire before returning.
However, if wait_for_device_probe() is called from the kernel_init() context:
- Before deferred_probe_initcall() [2], it causes the boot process to hang due to a deadlock.
- After deferred_probe_initcall() [3], it blocks kernel_init() from continuing till deferred_probe_timeout expires and beats the point of deferred_probe_timeout that's trying to wait for userspace to load modules.
Neither of this is good. So revert the changes towait_for_device_probe().
[1] - https://lore.kernel.org/lkml/TYAPR01MB45443DF63B9EF29054F7C41FD8C60@TYAPR01MB4544.jpnprd01.prod.outlook.com/
[2] - https://lore.kernel.org/lkml/[email protected]/
[3] - https://lore.kernel.org/lkml/[email protected]/
---
drivers/base/dd.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/base/dd.c +0 -5
@@ -263,7 +263,6 @@ int driver_deferred_probe_timeout;#endif EXPORT_SYMBOL_GPL (driver_deferred_probe_timeout); -static DECLARE_WAIT_QUEUE_HEAD (probe_timeout_waitqueue);static int __init deferred_probe_timeout_setup (char *str) {
@@ -318,7 +317,6 @@ static void deferred_probe_timeout_work_func(struct work_struct *work)list_for_each_entry (p, &deferred_probe_pending_list, deferred_probe)dev_info (p->device,"deferred probe pending\n" );mutex_unlock (&deferred_probe_mutex); -wake_up_all (&probe_timeout_waitqueue); } static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func);
@@ -736,9 +734,6 @@ int driver_probe_done(void)*/ void wait_for_device_probe (void ) { -/* wait for probe timeout */ -wait_event (probe_timeout_waitqueue, !driver_deferred_probe_timeout); -/* wait for the deferred probe workqueue to finish */ flush_work (&deferred_probe_work);
Signature · 1 line
2.36.1.124.g0e6072fb45-goog
Re: [PATCH v1 1/2] driver core: Fix wait_for_device_probe() & deferred_probe_timeout interaction
Quoted 47 lines · Saravana Kannan
Mounting NFS rootfs was timing out when
deferred_probe_timeoutwas non-zero [1]. This was becauseip_auto_config()initcall times out waiting for the network interfaces to show up whendeferred_probe_timeoutwas non-zero. Whileip_auto_config()callswait_for_device_probe()to make sure any currently running deferred probe work or asynchronous probe finishes, that wasn't sufficient to account for devices being deferred untildeferred_probe_timeout.Commit
35a672363ab3("driver core: Ensurewait_for_device_probe()waits until thedeferred_probe_timeoutfires") tried to fix that by making surewait_for_device_probe()waits fordeferred_probe_timeoutto expire before returning.However, if
wait_for_device_probe()is called from thekernel_init()context:- Before
deferred_probe_initcall()[2], it causes the boot process to hang due to a deadlock.- After
deferred_probe_initcall()[3], it blockskernel_init()from continuing tilldeferred_probe_timeoutexpires and beats the point ofdeferred_probe_timeoutthat's trying to wait for userspace to load modules.Neither of this is good. So revert the changes to
wait_for_device_probe().[1] - https://lore.kernel.org/lkml/TYAPR01MB45443DF63B9EF29054F7C41FD8C60@TYAPR01MB4544.jpnprd01.prod.outlook.com/
[2] - https://lore.kernel.org/lkml/[email protected]/
[3] - https://lore.kernel.org/lkml/[email protected]/Cc John Stultz <[email protected]>Cc "David S. Miller" <[email protected]>Cc Alexey Kuznetsov <[email protected]>Cc Hideaki YOSHIFUJI <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Rafael J. Wysocki <[email protected]>Cc Rob Herring <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Yoshihiro Shimoda <[email protected]>Cc Robin Murphy <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Sudeep Holla <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Naresh Kamboju <[email protected]>Cc Basil Eljuse <[email protected]>
Quoted 8 lines
Cc Ferry Toth <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Anders Roxell <[email protected]>Fixes 35a672363ab3 ("driver core: Ensure wait_for_device_probe() waits until the deferred_probe_timeout fires")Reported-by Nathan Chancellor <[email protected]>Reported-by Sebastian Andrzej Siewior <[email protected]>Signed-off-by Saravana Kannan <[email protected]>
Apologies for the trouble this caused. Thanks for chasing it down!
thanks
-john
PATCH 2/2 driver core: Set default deferred_probe_timeout back to 0.
In reply to Saravana KannanSince we had to effectively reverted
commit 35a672363ab3 ("driver core: Ensure wait_for_device_probe() waits until the deferred_probe_timeout fires") in an earlier patch, a non-zero deferred_probe_timeout will break NFS rootfs mounting [1] again. So, set the default back to zero until we can fix that.
--- drivers/base/dd.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/base/dd.c +0 -5
@@ -256,12 +256,7 @@ static int deferred_devs_show(struct seq_file *s, void *data) }DEFINE_SHOW_ATTRIBUTE (deferred_devs); -#ifdef CONFIG_MODULES -int driver_deferred_probe_timeout =10 ; -#else int driver_deferred_probe_timeout; -#endif -EXPORT_SYMBOL_GPL (driver_deferred_probe_timeout);static int __init deferred_probe_timeout_setup (char *str)
Signature · 1 line
2.36.1.124.g0e6072fb45-goog
Hi Saravana,
Quoted 8 lines · Saravana Kannan
Setting
deferred_probe_timeoutto a non-zero default used to cause issues with NFS rootfs. But the fix for that is causing other problem. So revert the fix and set the defaultdeferred_probe_timeoutback to zero.Most of the Cc list if from commit
35a672363ab3. Please let me know if you want to be removed from future patches related todeferred_probe_timeoutand NFS rootfs issues.
Thanks for your series!
On Salvator-XS, Micrel KSZ9031 Gigabit PHY probe is no longer delayed by 9s after applying this series.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds