diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -255,9 +255,9 @@ void mi_startup(void) { - struct sysinit *sip; - int last; + struct sysinit *sip, *nip; #if defined(VERBOSE_SYSINIT) + int last; int verbose; #endif @@ -269,9 +269,9 @@ /* Construct and sort sysinit list. */ sysinit_mklist(&sysinit_list, SET_BEGIN(sysinit_set), SET_LIMIT(sysinit_set)); - last = SI_SUB_DUMMY; #if defined(VERBOSE_SYSINIT) TUNABLE_INT_FETCH("debug.verbose_sysinit", &verbose_sysinit); + last = SI_SUB_DUMMY; verbose = 0; #if !defined(DDB) printf("VERBOSE_SYSINIT: DDB not enabled, symbol lookups disabled.\n"); @@ -285,19 +285,19 @@ * STAILQ_FOREACH macro would result in items being skipped if inserted * earlier than the "current item". */ - while ((sip = STAILQ_FIRST(&sysinit_list)) != NULL) { + nip = STAILQ_FIRST(&sysinit_list); + while ((sip = nip) != NULL) { STAILQ_REMOVE_HEAD(&sysinit_list, next); STAILQ_INSERT_TAIL(&sysinit_done_list, sip, next); - if (sip->subsystem == SI_SUB_DUMMY) + if (sip->subsystem == SI_SUB_DUMMY) { + nip = STAILQ_FIRST(&sysinit_list); continue; /* skip dummy task(s)*/ - - if (sip->subsystem > last) - BOOTTRACE_INIT("sysinit 0x%7x", sip->subsystem); - + } #if defined(VERBOSE_SYSINIT) if (verbose_sysinit != 0 && sip->subsystem != last) { verbose = 1; + last = sip->subsystem; printf("subsystem %x\n", sip->subsystem); } if (verbose) { @@ -327,8 +327,9 @@ printf("done.\n"); #endif - /* Check off the one we're just done */ - last = sip->subsystem; + nip = STAILQ_FIRST(&sysinit_list); + if (nip == NULL || nip->subsystem != sip->subsystem) + BOOTTRACE_INIT("sysinit 0x%7x", sip->subsystem); } TSEXIT(); /* Here so we don't overlap with start_init. */ diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -194,7 +194,6 @@ linker_file_sysinit(linker_file_t lf) { struct sysinit **start, **stop, **sipp, **xipp, *save; - int last; KLD_DPF(FILE, ("linker_file_sysinit: calling SYSINITs for %s\n", lf->filename)); @@ -203,6 +202,8 @@ if (linker_file_lookup_set(lf, "sysinit_set", &start, &stop, NULL) != 0) return; + + BOOTTRACE("%s: sysinit start", lf->filename); /* * Perform a bubble sort of the system initialization objects by * their subsystem (primary key) and order (secondary key). @@ -226,20 +227,18 @@ * Traverse the (now) ordered list of system initialization tasks. * Perform each task, and continue on to the next task. */ - last = SI_SUB_DUMMY; sx_xunlock(&kld_sx); mtx_lock(&Giant); for (sipp = start; sipp < stop; sipp++) { if ((*sipp)->subsystem == SI_SUB_DUMMY) continue; /* skip dummy task(s) */ - if ((*sipp)->subsystem > last) - BOOTTRACE("%s: sysinit 0x%7x", lf->filename, - (*sipp)->subsystem); - /* Call function */ (*((*sipp)->func)) ((*sipp)->udata); - last = (*sipp)->subsystem; + + if (sipp + 1 == stop || (*(sipp + 1))->subsystem != (*sipp)->subsystem) + BOOTTRACE("%s: sysinit 0x%7x", lf->filename, + (*sipp)->subsystem); } mtx_unlock(&Giant); sx_xlock(&kld_sx); @@ -249,7 +248,6 @@ linker_file_sysuninit(linker_file_t lf) { struct sysinit **start, **stop, **sipp, **xipp, *save; - int last; KLD_DPF(FILE, ("linker_file_sysuninit: calling SYSUNINITs for %s\n", lf->filename)); @@ -260,6 +258,7 @@ NULL) != 0) return; + BOOTTRACE("%s: sysuninit start", lf->filename); /* * Perform a reverse bubble sort of the system initialization objects * by their subsystem (primary key) and order (secondary key). @@ -285,18 +284,16 @@ */ sx_xunlock(&kld_sx); mtx_lock(&Giant); - last = SI_SUB_DUMMY; for (sipp = start; sipp < stop; sipp++) { if ((*sipp)->subsystem == SI_SUB_DUMMY) continue; /* skip dummy task(s) */ - if ((*sipp)->subsystem > last) - BOOTTRACE("%s: sysuninit 0x%7x", lf->filename, - (*sipp)->subsystem); - /* Call function */ (*((*sipp)->func)) ((*sipp)->udata); - last = (*sipp)->subsystem; + + if (sipp + 1 == stop || (*(sipp + 1))->subsystem != (*sipp)->subsystem) + BOOTTRACE("%s: sysuninit 0x%7x", lf->filename, + (*sipp)->subsystem); } mtx_unlock(&Giant); sx_xlock(&kld_sx);