git: 9128380511de - main - Revert "arm64: Move intr_pic_init_secondary earlier"

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Sat, 22 Nov 2025 18:47:22 UTC
The branch main has been updated by jrtc27:

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

commit 9128380511de3db9bd4d62d58c6a6dfcd1094079
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2025-11-22 18:46:04 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2025-11-22 18:46:04 +0000

    Revert "arm64: Move intr_pic_init_secondary earlier"
    
    It's not clear what the race described in the commit actually is, nor
    how it could arise, but this commit is definitely wrong; curthread is no
    longer set for intr_pic_init_secondary, and gic_v3's pic_init_secondary
    uses mutex(9) in some places, which requires curthread, so it has led to
    panics. Revert this change until the original issue this was intended to
    be fixed can be more thorougly investigated and a better fix made.
    
    Reported by:    Herbert J. Skuhra <herbert@gojira.at>, jhb
    
    This reverts commit a695ac2ce8bc8e8b989359002659063f2e056dcf.
---
 sys/arm64/arm64/mp_machdep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c
index ba673ce9d6ee..0bdd2ecfd8a7 100644
--- a/sys/arm64/arm64/mp_machdep.c
+++ b/sys/arm64/arm64/mp_machdep.c
@@ -270,8 +270,6 @@ init_secondary(uint64_t cpu)
 	install_cpu_errata();
 	enable_cpu_feat(CPU_FEAT_AFTER_DEV);
 
-	intr_pic_init_secondary();
-
 	/* Signal we are done */
 	atomic_add_int(&aps_started, 1);
 
@@ -290,6 +288,8 @@ init_secondary(uint64_t cpu)
 	    ("pmap0 doesn't match cpu %ld's ttbr0", cpu));
 	pcpup->pc_curpmap = pmap0;
 
+	intr_pic_init_secondary();
+
 	/* Start per-CPU event timers. */
 	cpu_initclocks_ap();