git: 648fa3558c16 - main - amd64: Initialize IPI scoreboard earlier

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 28 Sep 2022 13:23:57 UTC
The branch main has been updated by kib:

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

commit 648fa3558c161a1d8564626d21047710c3fbfdf6
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-12-17 04:28:11 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-09-28 13:23:52 +0000

    amd64: Initialize IPI scoreboard earlier
    
    Scoreboard is needed a moment when smp_started == true.  If some kernel
    daemon thread is started before scoreboard is inited, and does some pmap
    operation that requires TLB maintanence, which races with SMP startup,
    we might dereference NULL invl_scoreboard.  This is particularly easy
    to trigger when EARLY_AP_STARTUP is not defined.
    
    Reported by:    glebius
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D36766
---
 sys/amd64/amd64/mp_machdep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index e5114b93328e..3356726b24de 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -579,7 +579,7 @@ invl_scoreboard_init(void *arg __unused)
 		invl_op_pg = INVL_OP_PG;
 	}
 }
-SYSINIT(invl_ops, SI_SUB_SMP, SI_ORDER_FIRST, invl_scoreboard_init, NULL);
+SYSINIT(invl_ops, SI_SUB_SMP - 1, SI_ORDER_ANY, invl_scoreboard_init, NULL);
 
 static uint32_t *
 invl_scoreboard_getcpu(u_int cpu)