atomic header

The documentation of QEMU’s qemu/atomic.h header.

atomic_rcu_read(ptr)

reads a RCU-protected pointer to a local variable into a RCU read-side critical section. The pointer can later be safely dereferenced within the critical section.

Parameters

ptr
undescribed

Description

This ensures that the pointer copy is invariant thorough the whole critical section.

Inserts memory barriers on architectures that require them (currently only Alpha) and documents which pointers are protected by RCU.

atomic_rcu_read also includes a compiler barrier to ensure that value-speculative optimizations (e.g. VSS: Value Speculation Scheduling) does not perform the data read before the pointer read by speculating the value of the pointer.

Should match atomic_rcu_set(), atomic_xchg(), atomic_cmpxchg().

atomic_rcu_set(ptr, i)

assigns (publicizes) a pointer to a new data structure meant to be read by RCU read-side critical sections.

Parameters

ptr
undescribed
i
undescribed

Description

Documents which pointers will be dereferenced by RCU read-side critical sections and adds the required memory barriers on architectures requiring them. It also makes sure the compiler does not reorder code initializing the data structure before its publication.

Should match atomic_rcu_read().