-
-
Notifications
You must be signed in to change notification settings - Fork 846
Does SpinMutex from spin crate not work on aarch64? #132
-
Hi!
Instead of using the NullLock
defined in this tutorial, I am using the spin-lock from the spin
crate. However, it seems that the lock is never acquired and it always blocks forever. Is there some specific setup required to use spin
on Raspberry Pi 3A+?
Beta Was this translation helpful? Give feedback.
All reactions
Spin lock uses atomics under the hood, but atomics work on ARM only if you have MMU configured and enabled. MMU is introduced later than the NullLock
, so I assume that is the case (it was in my case).
The forever spinning isn't really spinning - CPU raises an exception, but you must have not configured the handler yet so it raises an exception from an exception handler, freezing forever (cause handlers are introduced even after MMU).
Replies: 2 comments
-
Spin lock uses atomics under the hood, but atomics work on ARM only if you have MMU configured and enabled. MMU is introduced later than the NullLock
, so I assume that is the case (it was in my case).
The forever spinning isn't really spinning - CPU raises an exception, but you must have not configured the handler yet so it raises an exception from an exception handler, freezing forever (cause handlers are introduced even after MMU).
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 2
-
What @jakubfijalkowski says. On the RPi you get an exception, if you have them enabled already, if you try atomics on non-cacheable memory.
There is also a hint starting tutorial 10 in main.rs
:
rust-raspberrypi-OS-tutorials/10_virtual_mem_part1_identity_mapping/src/main.rs
Lines 134 to 142 in ea8ef5a
Implementation of exclusive load/store (atomics) is often tied to / implemented on top of the CPU’s cache (leveraging the HW-coherency it provides).
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1