summary refs log tree commit diff stats
path: root/util/qemu-coroutine-lock.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2023-03-03 14:37:51 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2023-06-06 09:42:14 +0200
commit06831001ac8949b0801e0d20c347d97339769a20 (patch)
tree01c418078a78ff8049bf5eb7bc36cf3e3bddcb14 /util/qemu-coroutine-lock.c
parent09a49afeae2542993d4cdc5d7af22abdfce7a3ba (diff)
downloadfocaccia-qemu-06831001ac8949b0801e0d20c347d97339769a20.tar.gz
focaccia-qemu-06831001ac8949b0801e0d20c347d97339769a20.zip
atomics: eliminate mb_read/mb_set
qatomic_mb_read and qatomic_mb_set were the very first atomic primitives
introduced for QEMU; their semantics are unclear and they provide a false
sense of safety.

The last use of qatomic_mb_read() has been removed, so delete it.
qatomic_mb_set() instead can survive as an optimized
qatomic_set()+smp_mb(), similar to Linux's smp_store_mb(), but
rename it to qatomic_set_mb() to match the order of the two
operations.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util/qemu-coroutine-lock.c')
-rw-r--r--util/qemu-coroutine-lock.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/qemu-coroutine-lock.c b/util/qemu-coroutine-lock.c
index 84a50a9e91..2534435388 100644
--- a/util/qemu-coroutine-lock.c
+++ b/util/qemu-coroutine-lock.c
@@ -202,7 +202,7 @@ static void coroutine_fn qemu_co_mutex_lock_slowpath(AioContext *ctx,
     push_waiter(mutex, &w);
 
     /*
-     * Add waiter before reading mutex->handoff.  Pairs with qatomic_mb_set
+     * Add waiter before reading mutex->handoff.  Pairs with qatomic_set_mb
      * in qemu_co_mutex_unlock.
      */
     smp_mb__after_rmw();
@@ -310,7 +310,7 @@ void coroutine_fn qemu_co_mutex_unlock(CoMutex *mutex)
 
         our_handoff = mutex->sequence;
         /* Set handoff before checking for waiters.  */
-        qatomic_mb_set(&mutex->handoff, our_handoff);
+        qatomic_set_mb(&mutex->handoff, our_handoff);
         if (!has_waiters(mutex)) {
             /* The concurrent lock has not added itself yet, so it
              * will be able to pick our handoff.