Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Sep 2023 15:47:58 GMT
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c31f2b5e6b59 - stable/14 - init_main: Record completed SYSINITs
Message-ID:  <202309131547.38DFlwhk065688@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=c31f2b5e6b591c61711018c3d6e52067ae860e9c

commit c31f2b5e6b591c61711018c3d6e52067ae860e9c
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2023-09-05 23:47:57 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2023-09-13 15:47:36 +0000

    init_main: Record completed SYSINITs
    
    When removing them from sysinit_list, append them to sysinit_done_list;
    print this list from 'show sysinit' along with the list of future
    sysinits.
    
    Reviewed by:    jhb, gallatin (previous version)
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D41749
    
    (cherry picked from commit 1926d5cef6eaa1302024d6471271c930ad65f9b2)
---
 sys/kern/init_main.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index a6b327339c80..a8df9f84a29a 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -163,9 +163,11 @@ SYSINIT(placeholder, SI_SUB_DUMMY, SI_ORDER_ANY, NULL, NULL);
 SET_DECLARE(sysinit_set, struct sysinit);
 
 /*
- * The sysinit list itself.  Items are removed as they are run.
+ * The sysinit lists.  Items are moved to sysinit_done_list when done.
  */
 static STAILQ_HEAD(sysinitlist, sysinit) sysinit_list;
+static struct sysinitlist sysinit_done_list =
+    STAILQ_HEAD_INITIALIZER(sysinit_done_list);
 
 /*
  * Compare two sysinits; return -1, 0, or 1 if a comes before, at the same time
@@ -289,6 +291,7 @@ mi_startup(void)
 	 */
 	while ((sip = STAILQ_FIRST(&sysinit_list)) != NULL) {
 		STAILQ_REMOVE_HEAD(&sysinit_list, next);
+		STAILQ_INSERT_TAIL(&sysinit_done_list, sip, next);
 
 		if (sip->subsystem == SI_SUB_DUMMY)
 			continue;	/* skip dummy task(s)*/
@@ -904,6 +907,11 @@ DB_SHOW_COMMAND_FLAGS(sysinit, db_show_sysinit, DB_CMD_MEMSAFE)
 	db_printf("SYSINIT vs Name(Ptr)\n");
 	db_printf("  Subsystem  Order\n");
 	db_printf("  Function(Name)(Arg)\n");
+	STAILQ_FOREACH(sip, &sysinit_done_list, next) {
+		db_show_print_syinit(sip, true);
+		if (db_pager_quit)
+			return;
+	}
 	STAILQ_FOREACH(sip, &sysinit_list, next) {
 		db_show_print_syinit(sip, true);
 		if (db_pager_quit)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202309131547.38DFlwhk065688>