HomeFreeBSD

Fix the test used to wait for AP startup on x86, arm64, riscv

Description

Fix the test used to wait for AP startup on x86, arm64, riscv

On arm64, testing pc_curpcb != NULL is not correct since pc_curpcb is
set in pmap_switch() while the bootstrap stack is still in use. As a
result, smp_after_idle_runnable() can free the boot stack prematurely.

Take a different approach: use smp_rendezvous() to wait for all APs to
acknowledge an interrupt. Since APs must not enable interrupts until
they've entered the scheduler, i.e., switched off the boot stack, this
provides the right guarantee without depending as much on the
implementation of cpu_throw(). And, this approach applies to all
platforms, so convert x86 and riscv as well.

Reported by: mmel
Tested by: mmel
Reviewed by: kib
Fixes: 8db2e8fd16c4 ("Remove the secondary_stacks array in arm64 and riscv kernels.")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit f6b799a86b8fb69013c10b072baed4ee6c8db2f9)

Details

Provenance
markjAuthored on Jun 15 2022, 2:29 PM
Parents
rGcc81b8661d50: vm_fault: Fix a racy copy of page valid bits
Branches
Unknown
Tags
Unknown