[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 19/25] qemu-coroutine: remove qatomic_mb_read()
From: |
Paolo Bonzini |
Subject: |
[PULL 19/25] qemu-coroutine: remove qatomic_mb_read() |
Date: |
Fri, 21 Apr 2023 11:33:10 +0200 |
Replace with an explicit barrier and a comment.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
util/qemu-coroutine.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c
index 849452369201..17a88f65053e 100644
--- a/util/qemu-coroutine.c
+++ b/util/qemu-coroutine.c
@@ -127,9 +127,13 @@ void qemu_aio_coroutine_enter(AioContext *ctx, Coroutine
*co)
Coroutine *to = QSIMPLEQ_FIRST(&pending);
CoroutineAction ret;
- /* Cannot rely on the read barrier for to in aio_co_wake(), as there
are
- * callers outside of aio_co_wake() */
- const char *scheduled = qatomic_mb_read(&to->scheduled);
+ /*
+ * Read to before to->scheduled; pairs with qatomic_cmpxchg in
+ * qemu_co_sleep(), aio_co_schedule() etc.
+ */
+ smp_read_barrier_depends();
+
+ const char *scheduled = qatomic_read(&to->scheduled);
QSIMPLEQ_REMOVE_HEAD(&pending, co_queue_next);
--
2.40.0
- [PULL 13/25] io: mark mixed functions that can suspend, (continued)
- [PULL 13/25] io: mark mixed functions that can suspend, Paolo Bonzini, 2023/04/21
- [PULL 12/25] qapi-gen: mark coroutine QMP command functions as coroutine_fn, Paolo Bonzini, 2023/04/21
- [PULL 18/25] postcopy-ram: do not use qatomic_mb_read, Paolo Bonzini, 2023/04/21
- [PULL 14/25] migration: mark mixed functions that can suspend, Paolo Bonzini, 2023/04/21
- [PULL 15/25] monitor: mark mixed functions that can suspend, Paolo Bonzini, 2023/04/21
- [PULL 16/25] target/i386: Change wrong XFRM value in SGX CPUID leaf, Paolo Bonzini, 2023/04/21
- [PULL 17/25] block-backend: remove qatomic_mb_read(), Paolo Bonzini, 2023/04/21
- [PULL 20/25] docs: explain effect of smp_read_barrier_depends() on modern architectures, Paolo Bonzini, 2023/04/21
- [PULL 21/25] nbd: a BlockExport always has a BlockBackend, Paolo Bonzini, 2023/04/21
- [PULL 23/25] configure: Honour cross-prefix when finding ObjC compiler, Paolo Bonzini, 2023/04/21
- [PULL 19/25] qemu-coroutine: remove qatomic_mb_read(),
Paolo Bonzini <=
- [PULL 22/25] coverity: unify Fedora dockerfiles, Paolo Bonzini, 2023/04/21
- [PULL 25/25] tests: lcitool: Switch to OpenSUSE Leap 15.4, Paolo Bonzini, 2023/04/21
- [PULL 24/25] tests: libvirt-ci: Update to commit '2fa24dce8bc', Paolo Bonzini, 2023/04/21
- Re: [PULL 00/25] First batch of misc patches for QEMU 8.1, Richard Henderson, 2023/04/22