Page MenuHomeFreeBSD

arm64: Fix the condition used to test for AP initialization
ClosedPublic

Authored by markj on Jun 8 2022, 2:28 PM.
Tags
None
Referenced Files
F83611819: D35435.id106901.diff
Sun, May 12, 4:45 PM
F83611799: D35435.id106899.diff
Sun, May 12, 4:44 PM
Unknown Object (File)
Sat, May 11, 5:55 AM
Unknown Object (File)
Sat, May 11, 1:01 AM
Unknown Object (File)
Fri, May 10, 9:09 PM
Unknown Object (File)
Fri, May 10, 9:01 PM
Unknown Object (File)
Sat, Apr 27, 9:51 PM
Unknown Object (File)
Sat, Apr 27, 10:27 AM

Details

Summary

Testing pc_curpcb != NULL is racy, since on arm64 its initially set in
pmap_switch(), where the bootstack is still in use. Take a different
approach: wait for APs to acknowledge an interrupt before freeing the
bootstacks.

Reported by: mmel

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Jun 8 2022, 2:28 PM

Could we not move setting the stack pointer earlier in cpu_throw? If it was before pmap_switch we will have switched away from the boot stack before curpcb is set.

Could we not move setting the stack pointer earlier in cpu_throw? If it was before pmap_switch we will have switched away from the boot stack before curpcb is set.

I think that could work too, but isn't this method simpler and less tied to the internals of cpu_throw? This approach should work on all platforms, not just arm64.

It solved my problem and it boots without any problems on all my arm64 boards. Thanks.

This revision is now accepted and ready to land.Jun 9 2022, 7:30 AM

@kib do you see any problem with adopting the same approach on other platforms, i.e., x86 and riscv?

I think this should be fine on x86.

Use the same approach on x86 and riscv.

This revision now requires review to proceed.Jun 14 2022, 2:02 PM
mhorne added inline comments.
sys/riscv/riscv/mp_machdep.c
213

Do we need this here too?

markj marked an inline comment as done.
  • Remove some more unneeded assertions.
  • Use acquire semantics for a load to pair with a release store.
This revision is now accepted and ready to land.Jun 14 2022, 5:23 PM