de1852f087
- kvm-scsi-protect-req-aiocb-with-AioContext-lock.patch [bz#2155748] - kvm-dma-helpers-prevent-dma_blk_cb-vs-dma_aio_cancel-rac.patch [bz#2155748] - kvm-virtio-scsi-reset-SCSI-devices-from-main-loop-thread.patch [bz#2155748] - kvm-qatomic-add-smp_mb__before-after_rmw.patch [bz#2175660] - kvm-qemu-thread-posix-cleanup-fix-document-QemuEvent.patch [bz#2175660] - kvm-qemu-thread-win32-cleanup-fix-document-QemuEvent.patch [bz#2175660] - kvm-edu-add-smp_mb__after_rmw.patch [bz#2175660] - kvm-aio-wait-switch-to-smp_mb__after_rmw.patch [bz#2175660] - kvm-qemu-coroutine-lock-add-smp_mb__after_rmw.patch [bz#2175660] - kvm-physmem-add-missing-memory-barrier.patch [bz#2175660] - kvm-async-update-documentation-of-the-memory-barriers.patch [bz#2175660] - kvm-async-clarify-usage-of-barriers-in-the-polling-case.patch [bz#2175660] - Resolves: bz#2155748 (qemu crash on void blk_drain(BlockBackend *): Assertion qemu_in_main_thread() failed) - Resolves: bz#2175660 (Guest hangs when starting or rebooting)
67 lines
2.3 KiB
Diff
67 lines
2.3 KiB
Diff
From 3d823dda6832b76fd3d776131008107b0b0f7166 Mon Sep 17 00:00:00 2001
|
|
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
|
Date: Thu, 9 Mar 2023 08:24:36 -0500
|
|
Subject: [PATCH 12/12] async: clarify usage of barriers in the polling case
|
|
|
|
RH-Author: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
|
RH-MergeRequest: 158: qatomic: add smp_mb__before/after_rmw()
|
|
RH-Bugzilla: 2175660
|
|
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
RH-Acked-by: Eric Auger <eric.auger@redhat.com>
|
|
RH-Commit: [9/9] b4ea298d75a75bb61e07a27d1296e0095fbc2bbf (eesposit/qemu-kvm)
|
|
|
|
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2175660
|
|
|
|
commit 6229438cca037d42f44a96d38feb15cb102a444f
|
|
Author: Paolo Bonzini <pbonzini@redhat.com>
|
|
Date: Mon Mar 6 10:43:52 2023 +0100
|
|
|
|
async: clarify usage of barriers in the polling case
|
|
|
|
Explain that aio_context_notifier_poll() relies on
|
|
aio_notify_accept() to catch all the memory writes that were
|
|
done before ctx->notified was set to true.
|
|
|
|
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
|
|
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
|
---
|
|
util/async.c | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/util/async.c b/util/async.c
|
|
index 37d3e6036d..e0846baf93 100644
|
|
--- a/util/async.c
|
|
+++ b/util/async.c
|
|
@@ -472,8 +472,9 @@ void aio_notify_accept(AioContext *ctx)
|
|
qatomic_set(&ctx->notified, false);
|
|
|
|
/*
|
|
- * Write ctx->notified before reading e.g. bh->flags. Pairs with smp_wmb
|
|
- * in aio_notify.
|
|
+ * Order reads of ctx->notified (in aio_context_notifier_poll()) and the
|
|
+ * above clearing of ctx->notified before reads of e.g. bh->flags. Pairs
|
|
+ * with smp_wmb() in aio_notify.
|
|
*/
|
|
smp_mb();
|
|
}
|
|
@@ -496,6 +497,11 @@ static bool aio_context_notifier_poll(void *opaque)
|
|
EventNotifier *e = opaque;
|
|
AioContext *ctx = container_of(e, AioContext, notifier);
|
|
|
|
+ /*
|
|
+ * No need for load-acquire because we just want to kick the
|
|
+ * event loop. aio_notify_accept() takes care of synchronizing
|
|
+ * the event loop with the producers.
|
|
+ */
|
|
return qatomic_read(&ctx->notified);
|
|
}
|
|
|
|
--
|
|
2.39.1
|
|
|