wfe_ldrex_strex.cpp

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2020-01-07 00:00:00 +00:00
parent d5876c9980
commit 268355e53b
2 changed files with 49 additions and 2 deletions

View File

@@ -18634,8 +18634,6 @@ However, likely no implementation likely does (TODO confirm), since:
and power consumption is key in ARM applications.
SEV is not the only thing that can wake up a WFE, it is only an explicit software way to do it. Notably, global monitor operations on memory accesses of regions marked by LDAXR and STLXR instructions can also wake up a WFE sleeping core. This is done to allow spinlocks opens to automatically wake up WFE sleeping cores at free time without the need for a explicit SEV.
Quotes for the above <<armarm8-db>> G1.18.1 "Wait For Event and Send Event":
____
@@ -18693,6 +18691,20 @@ The following Raspberry Pi bibliography helped us get this sample up and running
For how userland spinlocks and mutexes are implemented see <<userland-mutex-implementation>>.
====== ARM WFE global monitor events
link:userland/arch/aarch64/inline_asm/wfe_ldxr_stxr.cpp[]
SEV is not the only thing that can wake up a WFE, it is only an explicit software way to do it.
Notably, global monitor operations on memory accesses of regions marked by <<arm-ldxr-and-stxr-instructions,LDAXR and STLXR instructions>> can also wake up a WFE sleeping core.
This is done to allow spinlocks opens to automatically wake up WFE sleeping cores at free time without the need for a explicit SEV.
In the shown in the `wfe_ldrex_strex.cpp` example, which can only terminate in gem5 user mode simulation because due to this event.
Note that that program still terminates when running on top of the Linux kernel as explained at: <<wfe-from-userland>>.
====== WFE from userland
WFE and SEV are usable from userland, and are part of an efficient spinlock implementation (which userland should arguably stay away from and rather use the <<futex-system-call>> which allow for non busy sleep instead), which maybe is not something that userland should ever tho and just stick to mutexes?