hujun260 commented on issue #14593: URL: https://github.com/apache/nuttx/issues/14593#issuecomment-2454613735
> i guess it implies `enter_critical_section` works as the single global lock covering the whole system. > is it right? It can be understood like this. However, due to the complex of the enter_critical_section function, it can encompass any area, especially scenarios where context switching occurs within the protected area, which may lead to the failure of protection. This is a vulnerability of the critical section. The current recommendation is that, if it is not related to protecting the tcb/group good programming practices can avoid to use critical sections. > 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. enter_critical_section only disable local CPU interrupts and cannot disable remote CPU interrupts. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
