Zawrs instructions
Wait-on-Reservation-Set Instructions
The Zawrs extension defines a pair of instructions to be used in polling loops that allows a
core to enter a low-power state and wait on a store to a memory location.
Waiting for a memory location to be updated is a common pattern in many use cases such as:
- Contenders for a lock waiting for the lock variable to be updated.
- Consumers waiting on the tail of an empty queue for the producer to queue work/data. The producer may be code executing on a RISC-V hart, an accelerator device, an external I/O agent.
- Code waiting on a flag to be set in memory indicative of an event occurring. For example, software on a RISC-V hart may wait on a "done" flag to be set in memory by an accelerator device indicating completion of a job previously submitted to the device.
Extension description from riscv-unified-db, reformatted.
Specification chapter: The RISC-V Instruction Set Manual, src/unpriv/zawrs.adoc.