Mon Oct 11 10:59:09 2021 UTC ()
Squash "holding up boot" messages into a single line, and only print the
device list if no progress has been made in 1 second.


(jmcneill)
diff -r1.289 -r1.290 src/sys/kern/subr_autoconf.c

cvs diff -r1.289 -r1.290 src/sys/kern/subr_autoconf.c (expand / switch to unified diff)

--- src/sys/kern/subr_autoconf.c 2021/08/07 16:19:18 1.289
+++ src/sys/kern/subr_autoconf.c 2021/10/11 10:59:09 1.290
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: subr_autoconf.c,v 1.289 2021/08/07 16:19:18 thorpej Exp $ */ 1/* $NetBSD: subr_autoconf.c,v 1.290 2021/10/11 10:59:09 jmcneill Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, 2000 Christopher G. Demetriou 4 * Copyright (c) 1996, 2000 Christopher G. Demetriou
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -67,27 +67,27 @@ @@ -67,27 +67,27 @@
67 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 67 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 68 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 69 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 70 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 71 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72 * SUCH DAMAGE. 72 * SUCH DAMAGE.
73 * 73 *
74 * from: Header: subr_autoconf.c,v 1.12 93/02/01 19:31:48 torek Exp (LBL) 74 * from: Header: subr_autoconf.c,v 1.12 93/02/01 19:31:48 torek Exp (LBL)
75 * 75 *
76 * @(#)subr_autoconf.c 8.3 (Berkeley) 5/17/94 76 * @(#)subr_autoconf.c 8.3 (Berkeley) 5/17/94
77 */ 77 */
78 78
79#include <sys/cdefs.h> 79#include <sys/cdefs.h>
80__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.289 2021/08/07 16:19:18 thorpej Exp $"); 80__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.290 2021/10/11 10:59:09 jmcneill Exp $");
81 81
82#ifdef _KERNEL_OPT 82#ifdef _KERNEL_OPT
83#include "opt_ddb.h" 83#include "opt_ddb.h"
84#include "drvctl.h" 84#include "drvctl.h"
85#endif 85#endif
86 86
87#include <sys/param.h> 87#include <sys/param.h>
88#include <sys/device.h> 88#include <sys/device.h>
89#include <sys/disklabel.h> 89#include <sys/disklabel.h>
90#include <sys/conf.h> 90#include <sys/conf.h>
91#include <sys/kauth.h> 91#include <sys/kauth.h>
92#include <sys/kmem.h> 92#include <sys/kmem.h>
93#include <sys/systm.h> 93#include <sys/systm.h>
@@ -2396,29 +2396,36 @@ config_finalize(void) @@ -2396,29 +2396,36 @@ config_finalize(void)
2396{ 2396{
2397 struct finalize_hook *f; 2397 struct finalize_hook *f;
2398 struct pdevinit *pdev; 2398 struct pdevinit *pdev;
2399 extern struct pdevinit pdevinit[]; 2399 extern struct pdevinit pdevinit[];
2400 int errcnt, rv; 2400 int errcnt, rv;
2401 2401
2402 /* 2402 /*
2403 * Now that device driver threads have been created, wait for 2403 * Now that device driver threads have been created, wait for
2404 * them to finish any deferred autoconfiguration. 2404 * them to finish any deferred autoconfiguration.
2405 */ 2405 */
2406 mutex_enter(&config_misc_lock); 2406 mutex_enter(&config_misc_lock);
2407 while (!TAILQ_EMPTY(&config_pending)) { 2407 while (!TAILQ_EMPTY(&config_pending)) {
2408 device_t dev; 2408 device_t dev;
2409 TAILQ_FOREACH(dev, &config_pending, dv_pending_list) 2409 int error;
2410 aprint_debug_dev(dev, "holding up boot\n"); 2410
2411 cv_wait(&config_misc_cv, &config_misc_lock); 2411 error = cv_timedwait(&config_misc_cv, &config_misc_lock,
 2412 mstohz(1000));
 2413 if (error == EWOULDBLOCK) {
 2414 aprint_debug("waiting for devices:");
 2415 TAILQ_FOREACH(dev, &config_pending, dv_pending_list)
 2416 aprint_debug(" %s", device_xname(dev));
 2417 aprint_debug("\n");
 2418 }
2412 } 2419 }
2413 mutex_exit(&config_misc_lock); 2420 mutex_exit(&config_misc_lock);
2414 2421
2415 KERNEL_LOCK(1, NULL); 2422 KERNEL_LOCK(1, NULL);
2416 2423
2417 /* Attach pseudo-devices. */ 2424 /* Attach pseudo-devices. */
2418 for (pdev = pdevinit; pdev->pdev_attach != NULL; pdev++) 2425 for (pdev = pdevinit; pdev->pdev_attach != NULL; pdev++)
2419 (*pdev->pdev_attach)(pdev->pdev_count); 2426 (*pdev->pdev_attach)(pdev->pdev_count);
2420 2427
2421 /* Run the hooks until none of them does any work. */ 2428 /* Run the hooks until none of them does any work. */
2422 do { 2429 do {
2423 rv = 0; 2430 rv = 0;
2424 TAILQ_FOREACH(f, &config_finalize_list, f_list) 2431 TAILQ_FOREACH(f, &config_finalize_list, f_list)