diff options
author | Emanuele Giuseppe Esposito <eesposit@redhat.com> | 2022-05-24 13:30:54 -0400 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2022-06-24 17:07:06 +0200 |
commit | 7455ff1aa01564cc175db5b2373e610503ad4411 (patch) | |
tree | 5a10d1498410ecbd582c7423d305188967600fc2 /include/block | |
parent | 9b38fc56c054c7de65fa3bf7cdd82b32654f6b7d (diff) | |
download | qemu-7455ff1aa01564cc175db5b2373e610503ad4411.zip qemu-7455ff1aa01564cc175db5b2373e610503ad4411.tar.gz qemu-7455ff1aa01564cc175db5b2373e610503ad4411.tar.bz2 |
aio_wait_kick: add missing memory barrier
It seems that aio_wait_kick always required a memory barrier
or atomic operation in the caller, but nobody actually
took care of doing it.
Let's put the barrier in the function instead, and pair it
with another one in AIO_WAIT_WHILE. Read aio_wait_kick()
comment for further explanation.
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Message-Id: <20220524173054.12651-1-eesposit@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include/block')
-rw-r--r-- | include/block/aio-wait.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/block/aio-wait.h b/include/block/aio-wait.h index b39eefb..54840f8 100644 --- a/include/block/aio-wait.h +++ b/include/block/aio-wait.h @@ -81,6 +81,8 @@ extern AioWait global_aio_wait; AioContext *ctx_ = (ctx); \ /* Increment wait_->num_waiters before evaluating cond. */ \ qatomic_inc(&wait_->num_waiters); \ + /* Paired with smp_mb in aio_wait_kick(). */ \ + smp_mb(); \ if (ctx_ && in_aio_context_home_thread(ctx_)) { \ while ((cond)) { \ aio_poll(ctx_, true); \ |