git: ae062ff2695f - main - Move KHELP_DECLARE_MOD_UMA later in the boot

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Fri, 12 Nov 2021 19:03:20 UTC
The branch main has been updated by andrew:

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

commit ae062ff2695f61e43e23e144db62cb251b2cf599
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2021-11-12 18:28:18 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2021-11-12 18:56:58 +0000

    Move KHELP_DECLARE_MOD_UMA later in the boot
    
    Both KHELP_DECLARE_MOD_UMA and the kernel linker SYSINIT to find
    in-kernel modules run at SI_SUB_KLD, SI_ORDER_ANY. As the former
    depends on the latter running first move it later in the boot,
    to the new SI_SUB_KHELP. This ensures KHELP_DECLARE_MOD_UMA
    module SYSINIT functions will be after the kernel linker.
    
    Previously we may have received a panic similar to the following if
    the order was incorrect:
    
    panic: module_register_init: module named ertt not found
    
    Reported by:    bob prohaska <fbsd AT www.zefox.net>
    Discussed with: imp, jhb
    Sponsored by:   The FreeBSD Foundation
---
 sys/sys/kernel.h       | 1 +
 sys/sys/module_khelp.h | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h
index e96eb52b52fd..765484df351c 100644
--- a/sys/sys/kernel.h
+++ b/sys/sys/kernel.h
@@ -105,6 +105,7 @@ enum sysinit_sub_id {
 	SI_SUB_EVENTHANDLER	= 0x1C00000,	/* eventhandler init */
 	SI_SUB_VNET_PRELINK	= 0x1E00000,	/* vnet init before modules */
 	SI_SUB_KLD		= 0x2000000,	/* KLD and module setup */
+	SI_SUB_KHELP		= 0x2080000,	/* khelp modules */
 	SI_SUB_CPU		= 0x2100000,	/* CPU resource(s)*/
 	SI_SUB_RACCT		= 0x2110000,	/* resource accounting */
 	SI_SUB_KDTRACE		= 0x2140000,	/* Kernel dtrace hooks */
diff --git a/sys/sys/module_khelp.h b/sys/sys/module_khelp.h
index a66440277a41..bab33e487497 100644
--- a/sys/sys/module_khelp.h
+++ b/sys/sys/module_khelp.h
@@ -87,7 +87,7 @@ struct khelp_modevent_data {
 		.evhand = khelp_modevent,				\
 		.priv = &kmd_##hname					\
 	};								\
-	DECLARE_MODULE(hname, h_##hname, SI_SUB_KLD, SI_ORDER_ANY);	\
+	DECLARE_MODULE(hname, h_##hname, SI_SUB_KHELP, SI_ORDER_ANY);	\
 	MODULE_VERSION(hname, version)
 
 #define	KHELP_DECLARE_MOD(hname, hdata, hhooks, version)		\