diff options
| author | Gleb Smirnoff <glebius@FreeBSD.org> | 2026-08-11 14:39:30 +0000 |
|---|---|---|
| committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2026-08-11 14:39:30 +0000 |
| commit | 662497d5a7415f8779b7be03e39f66eb8419174d (patch) | |
| tree | e0da82f136699da3b75bf705e9b4e126add52395 /sys/amd64 | |
| parent | 2d985d577d79605bde7f7b77c97da0ad59acf629 (diff) | |
SYSINIT: add explicit SI_ORDER_LAST
Working on cleansing use of (SI_SUB_FOO + 1) construct through the kernel
I found a repeating pattern. Often a developer adds a module that depends
on certain subsystem to be fully instantiated and they want to put their
module SYSINIT right at the end of the SI_SUB_FOO. Such module usually
expects that nothing else within this subsystem shall depend on the
module.
The problem with SI_ORDER_ANY which practically was "the last" until this
change is that it is used very widely and people treat it literally as
"any", well, because this is what the name says. This lead to many parts
that could have dependencies later to be added as SI_ORDER_ANY.
So, our developer with the new subsystem that depends on SI_SUB_FOO has
three options:
1) Use SI_ORDER_ANY, but grep around ther kernel for other SI_SUB_FOO
entries to make sure that no dependencies are set to SI_ORDER_ANY. And in
case they are, shift them up and recheck if dependencies of those
dependencies are met.
2) Take next subsystem in sysinit list. However, the next one can be
SI_SUB_BAR, that is completely irrelevant from SI_SUB_FOO, and our
developer doesn't want to put his module's SYSINIT into SI_SUB_BAR, cause
it is ugly.
3) Use the (SI_SUB_FOO + 1) construct that violates -Werror=assign-enum.
The SI_ORDER_LAST solves this hard choice. If you know that nothing is
going to depend on your module within SI_SUB_FOO, but you depend on
SI_SUB_FOO, just use SI_ORDER_LAST.
Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D58709
Diffstat (limited to 'sys/amd64')
| -rw-r--r-- | sys/amd64/amd64/pmap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index b37700a53aec..9cf1c77f5a9a 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1154,7 +1154,7 @@ pmap_delayed_invl_callout_init(void *arg __unused) callout_init(&pmap_invl_callout, 1); pmap_invl_callout_inited = true; } -SYSINIT(pmap_di_callout, SI_SUB_CPU + 1, SI_ORDER_ANY, +SYSINIT(pmap_di_callout, SI_SUB_CPU, SI_ORDER_LAST, pmap_delayed_invl_callout_init, NULL); /* @@ -11186,7 +11186,7 @@ pmap_cpu_init(void *arg __unused) CPU_COPY(&all_cpus, &kernel_pmap->pm_active); pmap_pti_init(); } -SYSINIT(pmap_cpu, SI_SUB_CPU + 1, SI_ORDER_ANY, pmap_cpu_init, NULL); +SYSINIT(pmap_cpu, SI_SUB_CPU, SI_ORDER_LAST, pmap_cpu_init, NULL); static pdp_entry_t * pmap_pti_pdpe(vm_offset_t va) |
