Skip to content

Commit fb5dfe2

Browse files
committed
zephyr: critical-section: re-enable SMP
After some analysis and testing, remove the compile-failure check for CONFIG_SMP. An earlier commit replaced the spinlock-based critical section code with one that uses `irq_lock()/unlock()` Although a bit unclear from both the docs and the name of these macros, the implementation on SMP definitely does have a spinlock to coordinate between CPUs on SMP. This doesn't work on some unusual platforms, such as the rp2040, but those platforms won't work with the rest of Zephyr yet for the same reason. Presumably adding support for SMP on this target will also require fixing irq_lock/unlock. The main difference between using irq_lock/unlock is that it supports nested calls, without needing a per-nest-level variable. The critical-section API doesn't provide a place to have this variable, so this allows us to have a critical-section implementation that should also work on SMP. Signed-off-by: David Brown <[email protected]>
1 parent 6cbdbb1 commit fb5dfe2

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

zephyr/src/sys.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ pub fn uptime_get() -> i64 {
4747
#[cfg(CONFIG_USERSPACE)]
4848
compile_error!("Critical-section implementation does not work with CONFIG_USERSPACE");
4949

50-
51-
// For now, assert we are not SMP. Once this can be verified, this can be removed.
52-
#[cfg(CONFIG_SMP)]
53-
compile_error!("TODO: Critical-section implementation not SMP verified");
54-
5550
pub mod critical {
5651
//! Zephyr implementation of critical sections.
5752
//!

0 commit comments

Comments
 (0)