Hi,

I've noticed that now the "autoconfiguration print" error messages
are printing "autoconfiguration error: " we have a situation where
aprint_ calls are happening outside the autoconfiguration process.
This is confusing. What makes this difficult to fix is:

        1. Some of the calls can happen during the autoconfiguration
           phase and also later (during normal operations). For example
           the iffoo_init() routine and its children calls.
        2. We don't have a non-autoconfig-related family of printf
           calls to handle errors outside autoconfiguration.

I propose to go for the simplest fix for now, which is to only print
"autoconfiguration error: " during the autoconfiguration process (i.e.
once autoconfiguration is done, to skip printing it. This again is
wrong in some cases (hotplug), but something simplistic such as the
following might take care of the majority of the cases:

Index: subr_prf.c
===================================================================
RCS file: /cvsroot/src/sys/kern/subr_prf.c,v
retrieving revision 1.176
diff -u -u -r1.176 subr_prf.c
--- subr_prf.c  14 Jan 2019 19:21:54 -0000      1.176
+++ subr_prf.c  19 Feb 2019 15:48:26 -0000
@@ -105,6 +105,7 @@
 extern struct tty *constty;    /* pointer to console "window" tty */
 extern int log_open;   /* subr_log: is /dev/klog open? */
 extern krndsource_t    rnd_printf_source;
+extern int config_pending;
 const  char *panicstr; /* arg to first call to panic (used as a flag
                           to indicate that panic has already been called). */
 struct cpu_info *paniccpu;     /* cpu that first paniced */
@@ -865,7 +866,8 @@
 
        if (prefix)
                kprintf_internal("%s: ", flags, NULL, NULL, prefix);
-       kprintf_internal("autoconfiguration error: ", TOLOG, NULL, NULL);
+       if (config_pending)
+               kprintf_internal("autoconfiguration error: ", TOLOG, NULL, 
NULL);
        kprintf(fmt, flags, NULL, NULL, ap);
 
        kprintf_unlock();
Index: subr_autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/kern/subr_autoconf.c,v
retrieving revision 1.265
diff -u -u -r1.265 subr_autoconf.c
--- subr_autoconf.c     1 Dec 2018 02:08:16 -0000       1.265
+++ subr_autoconf.c     19 Feb 2019 15:48:26 -0000
@@ -224,7 +224,7 @@
 static int alldevs_nwrite = 0;
 static bool alldevs_garbage = false;
 
-static int config_pending;             /* semaphore for mountroot */
+int config_pending;            /* semaphore for mountroot */
 static kmutex_t config_misc_lock;
 static kcondvar_t config_misc_cv;
 

christos

Reply via email to