sched/irq: Preserve handlers when extending IRQ chains. - #20162
Open
yushuailong wants to merge 1 commit into
Open
yushuailong wants to merge 1 commit into
yushuailong wants to merge 1 commit into
Conversation
Allocate the new handler node independently of the initial chain conversion so handlers beyond the second are appended instead of silently dropped. Delay vector conversion until both required nodes are available to avoid leaving a partially constructed chain on allocation failure. Assisted-by: OpenAI Codex Signed-off-by: yushuailong <yyyusl@qq.com>
yushuailong
requested review from
jerpelea and
xiaoxiang781216
as code owners
September 16, 2026 11:58
yushuailong
force-pushed
the
fix/irqchain-handler-append
branch
from
September 16, 2026 12:11
7c364f1 to
4463d5b
Compare
acassis
previously requested changes
Sep 16, 2026
acassis
left a comment
Contributor
There was a problem hiding this comment.
@yushuailong changes on core of NuttX (i.e. sched) requires real test on real devices.
Contributor
Author
Contributor
Author
Done |
xiaoxiang781216
approved these changes
Sep 16, 2026
xiaoxiang781216
approved these changes
Sep 16, 2026
acassis
approved these changes
Sep 19, 2026
Contributor
|
@yushuailong please rebase to fix the issues |
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
Fix IRQ chain attachment so the third and subsequent handlers are appended to an existing chain instead of being silently ignored.
The change also allocates all nodes needed for the initial chain before publishing it, preventing a partially constructed chain if the pool is exhausted.
Impact
bug fix only
Testing
Wildfire "Compass" board with STM32F103VET6(72 MHz, 512 KB flash, 64 KB RAM), console on USART1 at 115200 8N1, flashed through the on-board CH340 / STM32 ROM bootloader (no debug probe needed).
Host: macOS 27.0 (Apple Silicon), arm-none-eabi-gcc 14.2.1,
CMake 4.0.2 + Ninja 1.12.1.
Configuration:
fire-stm32v2:nsh+CONFIG_IRQCHAIN=y,CONFIG_PREALLOC_IRQCHAIN=8. Two images were built from the same tree, the only difference being this patch. The test attaches several handlers to one IRQ line (71 = TIM7, unused in this configuration), pends the line by software (up_trigger_irq()-> NVIC STIR) and counts the invocations of each handler; a stage 0 sanity check first confirms that this trigger reaches a plain vector handler on this board.irq_attach()was called four times and returned 0 every time, but only the first two handlers ever ran:handler call counts: h0=3 h1=3 h2=0 h3=0->RESULT: FAILh0=3 h1=3 h2=3 h3=3; single handler detach, full chain rebuild and chain-pool exhaustion (irq_attach(#9) = -12 (ENOMEM), pool fully recovered afterwards) all pass ->RESULT: PASS10 rounds per image (2 runs x 5 rounds), all with identical results.
Build: flash 95976 B / 512 KB, SRAM 7080 B,
[1163/1163] Generating nuttx.hex.