[BUG] the semantics of enter_critical_section is unclear
- Dominant language
- C
- Stars
- 4k
- Forks
- 1.7k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 237
Description
### Description / Steps to reproduce the issue
https://github.com/apache/nuttx/blob/master/Documentation/implementation/critical_sections.rst
> Without going into the details of the implementation of enter_critical_section() suffice it to say that it (1) disables interrupts on the local CPU and (2) uses spinlocks to assure exclusive access to a code sequence across all CPUs.
as users of `enter_critical_section` don't seem to have a way to limit the scope,
i guess it implies `enter_critical_section` works as the single global lock covering the whole system.
is it right?
also, to me it isn't clear if `enter_critical_section` is supposed to disable interrupts on the remote CPUs.
the comment in `irq_csection.c` says
> Take the CPU IRQ lock and disable interrupts on all CPUs.
on the other hand, other comment in the file says
> NOTE 1: Ideally this should disable interrupts on all CPUs, but most
> architectures only support disabling interrupts on the local CPU.`
they seem contradicting each other.
### On which OS does this issue occur?
[OS: Mac]
### What is the version of your OS?
macOS 14.7
### NuttX Version
master
### Issue Architecture
[Arch: all]
### Issue Area
[Area: Api], [Area: Kernel]
### Verification
- [X] I have verified before submitting the report.
Contributor guide
Assessment
This issue has not been assessed yet.