You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace interrupt masking with spinlock in semaphore for SMP support
The original semaphore implementation used NOSCHED_ENTER() and
NOSCHED_LEAVE() to protect critical sections by disabling interrupts,
which was sufficient in single-core environments.
To support SMP, we replace these macros with a spinlock based on RV32A
atomic instructions. This ensures safe access to shared semaphore
state, including the count and wait queue, when multiple harts operate
concurrently.
This change is necessary to avoid race conditions during mo_sem_wait(),
mo_sem_signal(), and other semaphore operations under multi-hart
scheduling.
0 commit comments