Repository navigation
include/nuttx/irq.h: add irq_save/irq_restore - #21895
Merged
Merged
Conversation
Add irq_save()/irq_restore() as the architecture-independent way for code outside arch/ to disable and restore local interrupts. They map to up_irq_save()/up_irq_restore() and give one place to hook IRQ-disabled time monitoring later. The lock-free ring in include/nuttx/ring.h is the first user. Existing up_irq_save() callers are left as they are. Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com> Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
CV-Bowen
requested review from
masayuki2009 and
xiaoxiang781216
as code owners
November 16, 2026 16:16
xiaoxiang781216
approved these changes
Nov 16, 2026
|
GUIDINGLI
approved these changes
Nov 17, 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
Add
irq_save()/irq_restore()toinclude/nuttx/irq.has thearchitecture-independent way for code outside
arch/to disable andrestore local interrupts. For now they map directly to
up_irq_save()/up_irq_restore(); having one name above the arch layergives a single place to hook IRQ-disabled time monitoring later.
The first user is the lock-free ring (
include/nuttx/ring.h), whichwill follow in a separate PR and depends on this one. Existing
up_irq_save()callers are not converted here.Impact
__ASSEMBLY__is not defined.them yet.
Testing
Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
Built
sim:nshwith the ring PR applied on top andCONFIG_TESTING_CMOCKA=y CONFIG_TESTING_RING=y(the ring cmocka tests,apps PR to follow), then ran
ring_test:undefined reference to 'irq_save'/'irq_restore'frominclude/nuttx/ring.hring_test (master + this PR + ring)
No regression in rpmsg: sim:rpserver/rpproxy and qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping, rpmsgfs; 15/15). qemu-armv8a was built with LIBC_ENVPATH and BINFMT_CHECKEXEC disabled, which current master needs for nxinit to start nsh there; unrelated to this change.