ed5979
From e9a9c0b023ae0dcbb14543b74063cca931d8230f Mon Sep 17 00:00:00 2001
ed5979
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
ed5979
Date: Thu, 9 Mar 2023 08:24:36 -0500
ed5979
Subject: [PATCH 08/12] aio-wait: switch to smp_mb__after_rmw()
ed5979
ed5979
RH-Author: Emanuele Giuseppe Esposito <eesposit@redhat.com>
ed5979
RH-MergeRequest: 158: qatomic: add smp_mb__before/after_rmw()
ed5979
RH-Bugzilla: 2175660
ed5979
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
ed5979
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
ed5979
RH-Acked-by: David Hildenbrand <david@redhat.com>
ed5979
RH-Acked-by: Eric Auger <eric.auger@redhat.com>
ed5979
RH-Commit: [5/9] a90c96d148fdbec340a45dc6cedf3660d8be2aab (eesposit/qemu-kvm)
ed5979
ed5979
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2175660
ed5979
ed5979
commit b532526a07ef3b903ead2e055fe6cc87b41057a3
ed5979
Author: Paolo Bonzini <pbonzini@redhat.com>
ed5979
Date:   Fri Mar 3 11:03:52 2023 +0100
ed5979
ed5979
    aio-wait: switch to smp_mb__after_rmw()
ed5979
ed5979
    The barrier comes after an atomic increment, so it is enough to use
ed5979
    smp_mb__after_rmw(); this avoids a double barrier on x86 systems.
ed5979
ed5979
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
ed5979
    Reviewed-by: David Hildenbrand <david@redhat.com>
ed5979
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ed5979
ed5979
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
ed5979
---
ed5979
 include/block/aio-wait.h | 2 +-
ed5979
 1 file changed, 1 insertion(+), 1 deletion(-)
ed5979
ed5979
diff --git a/include/block/aio-wait.h b/include/block/aio-wait.h
ed5979
index dd9a7f6461..da13357bb8 100644
ed5979
--- a/include/block/aio-wait.h
ed5979
+++ b/include/block/aio-wait.h
ed5979
@@ -85,7 +85,7 @@ extern AioWait global_aio_wait;
ed5979
     /* Increment wait_->num_waiters before evaluating cond. */     \
ed5979
     qatomic_inc(&wait_->num_waiters);                              \
ed5979
     /* Paired with smp_mb in aio_wait_kick(). */                   \
ed5979
-    smp_mb();                                                      \
ed5979
+    smp_mb__after_rmw();                                           \
ed5979
     if (ctx_ && in_aio_context_home_thread(ctx_)) {                \
ed5979
         while ((cond)) {                                           \
ed5979
             aio_poll(ctx_, true);                                  \
ed5979
-- 
ed5979
2.39.1
ed5979