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.`
Description / Steps to reproduce the issue
https://github.com/apache/nuttx/blob/master/Documentation/implementation/critical_sections.rst
as users of
enter_critical_section
don't seem to have a way to limit the scope, i guess it impliesenter_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 inirq_csection.c
sayson the other hand, other comment in the file says
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