fdt: fix panic in fdt_slicer/geom due to recent geom changes

A recent change in GEOM ordering (c11b701915 -
"geom: Push GEOM sysinit ordering to after devctl" changed the GEOM init
ordering to SI_ORDER_THIRD.  However, the FDT slicer / GEOM flash
slice code needs the GEOM subsystem to be initialised before it
starts loading in flash slices from FDT, and will panic because
the mutex isn't initialised.

So bump this now to SI_ORDER_FOURTH, so it occurs after the GEOM
initialisation.

Differential Revision:	https://reviews.freebsd.org/D49692
Reviewed by:	jhibbits
This commit is contained in:
Adrian Chadd 2025-04-06 16:52:29 -07:00
parent 325af3b990
commit 0c5a770cc4

View file

@ -156,12 +156,12 @@ fdt_slicer_cleanup(void)
}
/*
* Must be initialized after GEOM classes (SI_SUB_DRIVERS/SI_ORDER_SECOND),
* Must be initialized after GEOM classes (SI_SUB_DRIVERS/SI_ORDER_THIRD),
* i. e. after g_init() is called, due to the use of the GEOM topology_lock
* in flash_register_slicer(). However, must be before SI_SUB_CONFIGURE.
*/
SYSINIT(fdt_slicer, SI_SUB_DRIVERS, SI_ORDER_THIRD, fdt_slicer_init, NULL);
SYSUNINIT(fdt_slicer, SI_SUB_DRIVERS, SI_ORDER_THIRD, fdt_slicer_cleanup, NULL);
SYSINIT(fdt_slicer, SI_SUB_DRIVERS, SI_ORDER_FOURTH, fdt_slicer_init, NULL);
SYSUNINIT(fdt_slicer, SI_SUB_DRIVERS, SI_ORDER_FOURTH, fdt_slicer_cleanup, NULL);
static int
mod_handler(module_t mod, int type, void *data)
@ -178,6 +178,6 @@ static moduledata_t fdt_slicer_mod = {
"fdt_slicer", mod_handler, NULL
};
DECLARE_MODULE(fdt_slicer, fdt_slicer_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
DECLARE_MODULE(fdt_slicer, fdt_slicer_mod, SI_SUB_DRIVERS, SI_ORDER_FOURTH);
MODULE_DEPEND(fdt_slicer, geom_flashmap, 0, 0, 0);
MODULE_VERSION(fdt_slicer, 1);