arch/x86_64: support more than 4 CPU - #19947
Open
raiden00pl wants to merge 3 commits into
Open
Conversation
The AP boot path masked RSP with ~XCPTCONTEXT_SIZE, which just clears whichever bits happen to be set in the size (0x340 -> mask 0xfffffcbf). That drops RSP by an arbitrary amount and only guarantees 16-byte alignment, while the XSAVE area in the context needs 64. Mask with ~(XCPTCONTEXT_ALIGN - 1) instead. Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
intel64 port explicitly enumerates five idle-stack addresses and rejects configurations with more than five CPUs. Store the CPU0 stack top and calculate every CPU stack address from its index. Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
The idle stack area started at _ebss + CONFIG_IDLETHREAD_STACKSIZE * CONFIG_SMP_NCPUS, so the first CONFIG_SMP_NCPUS stack slots after .bss were never used - 16MiB on a 4-CPU configuration with a 4MiB idle stack. Start the area at _ebss and let the heap begin that much earlier. The -16 offset is kept: it is what places the AP initial RSP set up in intel64_head.S below the xcp->regs block that up_cpu_idlestack() reserves at the top of the same stack. Without it both land on the same 64-byte slot and the first context save corrupts the AP stack. Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
jerpelea
approved these changes
Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Impact
support more than 4 CPU for intel64
Testing
intel64 with 12 CPUs enabled