|ARM Technical Support Knowledge Articles|
Applies to: ARMv8-A
WFEwas necessary or not; since conditional execution is not supported in A64, a slightly modified algorithm is required for efficient resource contention. Take, as an example, a simple spinlock (with the register initialisation code not shown):
2: ldaxr w1, [w0]
cbnz w1, %1b
stxr w1, w2, [w0]
cbnz w1, %2b
WFEbefore reloading the lock to test it again. This obviously requires an initial
SEVbefore entering the loop to contend for the spinlock, to guarantee the code doesn't hang waiting for an event before the first attempt to load the lock. However, in the code shown, the send event will be broadcast to all cores in the system, which is safe, but unnecessary; the purpose of the event is to break the
WFEupon first entering the loop on the local processor, other cores don't need to receive any event. By providing the
SEVLinstruction, A64 allows local event-waits to be broken without unnecessarily waking up other cores in the system.
SEVLinstruction) provides for a more elegant solution than the "traditional" spinlock used on A32 and prior instruction sets. The architectural definition of the event mechanism means that an event unrelated to the lock being contended for could already have been latched into the system; the A64 algorithm guarantees that all latched events are cleared, thereby reducing the rate of "false positives" for lock availability.
Article last edited on: 2014-12-30 21:22:35
Did you find this article helpful? Yes No
How can we improve this article?