git: c4756f4a7abd - stable/12 - Add explicit SI_SUB_EPOCH

From: David E. O'Brien <obrien_at_FreeBSD.org>
Date: Tue, 22 Feb 2022 07:28:59 UTC
The branch stable/12 has been updated by obrien:

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

commit c4756f4a7abd284b9beb732e734d62706c7cf352
Author:     Conrad Meyer <cem@FreeBSD.org>
AuthorDate: 2019-11-22 23:23:40 +0000
Commit:     David E. O'Brien <obrien@FreeBSD.org>
CommitDate: 2022-02-22 06:20:49 +0000

    Add explicit SI_SUB_EPOCH
    
    Add explicit SI_SUB_EPOCH, after SI_SUB_TASKQ and before SI_SUB_SMP
    (EARLY_AP_STARTUP).  Rename existing "SI_SUB_TASKQ + 1" to SI_SUB_EPOCH.
    
    epoch(9) consumers cannot epoch_alloc() before SI_SUB_EPOCH:SI_ORDER_SECOND,
    but likely should allocate before SI_SUB_SMP.  Prior to this change,
    consumers (well, epoch itself, and net/if.c) just open-coded the
    SI_SUB_TASKQ + 1 order to match epoch.c, but this was fragile.
    
    (cherry picked from commit 7993a104a10c81e4049e5923061d9bb7a5e35d80)
---
 sys/kern/subr_epoch.c | 2 +-
 sys/net/if.c          | 3 +--
 sys/sys/kernel.h      | 1 +
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/kern/subr_epoch.c b/sys/kern/subr_epoch.c
index af42446f7dff..8d021f748d57 100644
--- a/sys/kern/subr_epoch.c
+++ b/sys/kern/subr_epoch.c
@@ -169,7 +169,7 @@ epoch_init(void *arg __unused)
 	global_epoch = epoch_alloc(0);
 	global_epoch_preempt = epoch_alloc(EPOCH_PREEMPT);
 }
-SYSINIT(epoch, SI_SUB_TASKQ + 1, SI_ORDER_FIRST, epoch_init, NULL);
+SYSINIT(epoch, SI_SUB_EPOCH, SI_ORDER_FIRST, epoch_init, NULL);
 
 #if !defined(EARLY_AP_STARTUP)
 static void
diff --git a/sys/net/if.c b/sys/net/if.c
index d93d63f82f23..f2c306af7095 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -984,8 +984,7 @@ if_epochalloc(void *dummy __unused)
 	net_epoch_preempt = epoch_alloc(EPOCH_PREEMPT);
 	net_epoch = epoch_alloc(0);
 }
-SYSINIT(ifepochalloc, SI_SUB_TASKQ + 1, SI_ORDER_ANY,
-    if_epochalloc, NULL);
+SYSINIT(ifepochalloc, SI_SUB_EPOCH, SI_ORDER_ANY, if_epochalloc, NULL);
 
 static void
 if_attachdomain(void *dummy)
diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h
index ab9574192797..c7d4d7a24e96 100644
--- a/sys/sys/kernel.h
+++ b/sys/sys/kernel.h
@@ -125,6 +125,7 @@ enum sysinit_sub_id {
 	SI_SUB_MBUF		= 0x2700000,	/* mbuf subsystem */
 	SI_SUB_INTR		= 0x2800000,	/* interrupt threads */
 	SI_SUB_TASKQ		= 0x2880000,	/* task queues */
+	SI_SUB_EPOCH		= 0x2888000,	/* epoch subsystem */
 #ifdef EARLY_AP_STARTUP
 	SI_SUB_SMP		= 0x2900000,	/* start the APs*/
 #endif