Repository navigation
arch/arm: Color only the interrupt stack of the calling CPU. - #21463
Merged
Merged
Conversation
casaroli
requested review from
johannes-nivus and
xiaoxiang781216
as code owners
November 4, 2026 17:56
|
Add a blank line after a declaration, so that the next commit passes tools/checkpatch.sh. No change in code. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
arm_color_intstack() writes the color into the interrupt stacks of all CPUs. qemu, imx6, goldfish, rtl8730e, cxd56 and rp2040 call it on each secondary CPU through up_irqinitialize(). So a CPU that boots writes over the register frame of a CPU that handles an interrupt, and qemu-armv7a:smp aborts at boot with PC or DFAR 0xdeadbeef. Each CPU now colors only its own stack, before it enables its interrupts. x86_64 does the same. lc823450 does not call up_irqinitialize() on a secondary CPU, so it now colors the stack in cpu1_boot(). Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
up_irqinitialize() of rp23xx does not call arm_color_intstack(), so with CONFIG_STACK_COLORATION up_check_intstack() finds no color and reports the whole stack as used. Color it as the other chips do. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
casaroli
force-pushed
the
armv7-color-intstack-up
branch
from
November 5, 2026 21:17
c0e8f66 to
51ea24e
Compare
cederom
reviewed
Nov 5, 2026
xiaoxiang781216
approved these changes
Nov 6, 2026
1 of 5 tasks
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
qemu-armv7a:smp aborts at boot in about 1 of 7 boots, with PC or DFAR 0xdeadbeef on the interrupt stack of CPU 0.
arm_color_intstack()writes the color into the interrupt stacks of all CPUs, and qemu, imx6, goldfish, rtl8730e, cxd56 and rp2040 call it on each secondary CPU throughup_irqinitialize(). So a CPU that boots writes over the register frame of a CPU that handles an interrupt.Each CPU now colors only its own stack, before it enables its interrupts. x86_64 does the same. lc823450 does not call
up_irqinitialize()on a secondary CPU, so it now colors the stack incpu1_boot(). rp23xx never colored the stack at all, soup_check_intstack()reported all of it as used; it now does.Impact
Only arm with
CONFIG_STACK_COLORATION. Without SMP the same stack is colored as before. Until a secondary CPU starts,up_check_intstack()finds no color on its stack.Testing
Which CPU colors which stack during boot, with a gdb breakpoint on
arm_stack_color(), qemu-armv7a:smp, 4 CPUs. It does not depend on the timing:Boots to an NSH prompt, in turn, same .config, under QEMU TCG:
ostest status 0 on qemu-armv7a:smp and qemu-armv7a:nsh. The check of apache/nuttx-apps#3982 in ostest, on qemu-armv7a:smp: each CPU takes an interrupt, then uses 488, 264, 264 and 264 bytes of 2048.
Builds with
EXTRAFLAGS="-Wno-cpp -Werror": qemu-armv7a:smp, qemu-armv7a:nsh, qemu-armv7a:knsh_smp, sabre-6quad:smp. WithCONFIG_STACK_COLORATIONby kconfig-tweak: spresense:smp, raspberrypi-pico:smp, raspberrypi-pico-2:smp, lc823450-xgevk:nsh.RP2350 (pimoroni-pico-2-plus:smp, 2 cores, on the board), the same check: master stops with CPU 0 "used 2048 of 2048" because the stack has no color; this PR gives 152 and 144 bytes, ostest status 0.
Not run: the other chips. Not built: goldfish (no board in the tree) and rtl8730e_evb (the SDK fetch failed here).
No CI configuration runs QEMU for this board, so no test in CI covers this.