qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH v2 1/8] aio_wait_kick: add missing memory barrier


From: Emanuele Giuseppe Esposito
Subject: [RFC PATCH v2 1/8] aio_wait_kick: add missing memory barrier
Date: Tue, 26 Apr 2022 04:51:07 -0400

It seems that aio_wait_kick always required a memory barrier
or atomic operation in the caller, but almost nobody actually
took care of doing it.

Let's put the barrier in the function instead.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
 util/aio-wait.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/util/aio-wait.c b/util/aio-wait.c
index bdb3d3af22..c0a343ac87 100644
--- a/util/aio-wait.c
+++ b/util/aio-wait.c
@@ -35,7 +35,8 @@ static void dummy_bh_cb(void *opaque)
 
 void aio_wait_kick(void)
 {
-    /* The barrier (or an atomic op) is in the caller.  */
+    smp_mb();
+
     if (qatomic_read(&global_aio_wait.num_waiters)) {
         aio_bh_schedule_oneshot(qemu_get_aio_context(), dummy_bh_cb, NULL);
     }
-- 
2.31.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]