git: 4f2465260f03 - main - SYSINIT: add SI_SUB_FIRST

Gleb Smirnoff <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.current.scm
Message-ID <[email protected]>
The branch main has been updated by glebius:

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

commit 4f2465260f035fa0095e73b34a74851ef2efaa83
Author:     Gleb Smirnoff <[email protected]>
AuthorDate: 2026-08-11 14:40:06 +0000
Commit:     Gleb Smirnoff <[email protected]>
CommitDate: 2026-08-11 14:40:06 +0000

    SYSINIT: add SI_SUB_FIRST
    
    This allows to initialize mp_maxid, mp_ncpus and register APICs at the
    most early stage, guaranteeing that those values will already be available
    at SI_SUB_TUNABLES.
    
    Reviewed by:            markj
    Differential Revision:  https://reviews.freebsd.org/D58712
---
 sys/kern/subr_smp.c      | 2 +-
 sys/sys/kernel.h         | 1 +
 sys/x86/acpica/madt.c    | 2 +-
 sys/x86/x86/local_apic.c | 2 +-
 sys/x86/x86/mptable.c    | 3 +--
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index dd2e829aefbf..a58a179336f3 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -179,7 +179,7 @@ mp_setmaxid(void *dummy)
 
 	cpusetsizemin = howmany(mp_maxid + 1, NBBY);
 }
-SYSINIT(cpu_mp_setmaxid, SI_SUB_TUNABLES, SI_ORDER_FIRST, mp_setmaxid, NULL);
+SYSINIT(cpu_mp_setmaxid, SI_SUB_FIRST, SI_ORDER_ANY, mp_setmaxid, NULL);
 
 /*
  * Call the MD SMP initialization code.
diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h
index 139a570c7ac6..2e1b1bd537cd 100644
--- a/sys/sys/kernel.h
+++ b/sys/sys/kernel.h
@@ -94,6 +94,7 @@ extern volatile long ticksl;
  */
 enum sysinit_sub_id {
 	SI_SUB_DUMMY		= 0x0000000,	/* not executed; for linker */
+	SI_SUB_FIRST		= 0x0600000,	/* mp_maxid, etc... */
 	SI_SUB_TUNABLES		= 0x0700000,	/* establish tunable values */
 	SI_SUB_COPYRIGHT	= 0x0800001,	/* first use of console */
 	SI_SUB_VM		= 0x1000000,	/* virtual memory system init */
diff --git a/sys/x86/acpica/madt.c b/sys/x86/acpica/madt.c
index a593028ffb5a..0b3d07e54f8a 100644
--- a/sys/x86/acpica/madt.c
+++ b/sys/x86/acpica/madt.c
@@ -327,7 +327,7 @@ madt_register(void *dummy __unused)
 
 	apic_register_enumerator(&madt_enumerator);
 }
-SYSINIT(madt_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, madt_register, NULL);
+SYSINIT(madt_register, SI_SUB_FIRST, SI_ORDER_FIRST, madt_register, NULL);
 
 /*
  * Call the handler routine for each entry in the MADT table.
diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
index 405db4fcc550..824ff6b3c37b 100644
--- a/sys/x86/x86/local_apic.c
+++ b/sys/x86/x86/local_apic.c
@@ -2142,7 +2142,7 @@ apic_init(void *dummy __unused)
 		    best_enum->apic_name, retval);
 
 }
-SYSINIT(apic_init, SI_SUB_TUNABLES - 1, SI_ORDER_SECOND, apic_init, NULL);
+SYSINIT(apic_init, SI_SUB_FIRST, SI_ORDER_SECOND, apic_init, NULL);
 
 /*
  * Setup the local APIC.  We have to do this prior to starting up the APs
diff --git a/sys/x86/x86/mptable.c b/sys/x86/x86/mptable.c
index 4f078fd05ec6..9df200320ecb 100644
--- a/sys/x86/x86/mptable.c
+++ b/sys/x86/x86/mptable.c
@@ -466,8 +466,7 @@ mptable_register(void *dummy __unused)
 
 	apic_register_enumerator(&mptable_enumerator);
 }
-SYSINIT(mptable_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, mptable_register,
-    NULL);
+SYSINIT(mptable_register, SI_SUB_FIRST, SI_ORDER_FIRST, mptable_register, NULL);
 
 /*
  * Call the handler routine for each entry in the MP config base table.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.