[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-commits] [qemu/qemu] 636b83: aio-posix: signal-proof fdmon-io_urin
From: |
Peter Maydell |
Subject: |
[Qemu-commits] [qemu/qemu] 636b83: aio-posix: signal-proof fdmon-io_uring |
Date: |
Sat, 11 Apr 2020 09:15:27 -0700 |
Branch: refs/heads/master
Home: https://github.com/qemu/qemu
Commit: 636b836d5f4e36ceebb788e2e0d4724f7f9406e1
https://github.com/qemu/qemu/commit/636b836d5f4e36ceebb788e2e0d4724f7f9406e1
Author: Stefan Hajnoczi <address@hidden>
Date: 2020-04-09 (Thu, 09 Apr 2020)
Changed paths:
M util/fdmon-io_uring.c
Log Message:
-----------
aio-posix: signal-proof fdmon-io_uring
The io_uring_enter(2) syscall returns with errno=EINTR when interrupted
by a signal. Retry the syscall in this case.
It's essential to do this in the io_uring_submit_and_wait() case. My
interpretation of the Linux v5.5 io_uring_enter(2) code is that it
shouldn't affect the io_uring_submit() case, but there is no guarantee
this will always be the case. Let's check for -EINTR around both APIs.
Note that the liburing APIs have -errno return values.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Stefano Garzarella <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
Commit: 3c18a92dc4b55ca8cc37a755ed119f11c0f34099
https://github.com/qemu/qemu/commit/3c18a92dc4b55ca8cc37a755ed119f11c0f34099
Author: Paolo Bonzini <address@hidden>
Date: 2020-04-09 (Thu, 09 Apr 2020)
Changed paths:
M include/block/aio-wait.h
M include/block/aio.h
Log Message:
-----------
aio-wait: delegate polling of main AioContext if BQL not held
Any thread that is not a iothread returns NULL for
qemu_get_current_aio_context().
As a result, it would also return true for
in_aio_context_home_thread(qemu_get_aio_context()), causing
AIO_WAIT_WHILE to invoke aio_poll() directly. This is incorrect
if the BQL is not held, because aio_poll() does not expect to
run concurrently from multiple threads, and it can actually
happen when savevm writes to the vmstate file from the
migration thread.
Therefore, restrict in_aio_context_home_thread to return true
for the main AioContext only if the BQL is held.
The function is moved to aio-wait.h because it is mostly used
there and to avoid a circular reference between main-loop.h
and block/aio.h.
Signed-off-by: Paolo Bonzini <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Commit: 5710a3e09f9b85801e5ce70797a4a511e5fc9e2c
https://github.com/qemu/qemu/commit/5710a3e09f9b85801e5ce70797a4a511e5fc9e2c
Author: Paolo Bonzini <address@hidden>
Date: 2020-04-09 (Thu, 09 Apr 2020)
Changed paths:
M util/aio-posix.c
M util/aio-win32.c
M util/async.c
Log Message:
-----------
async: use explicit memory barriers
When using C11 atomics, non-seqcst reads and writes do not participate
in the total order of seqcst operations. In util/async.c and util/aio-posix.c,
in particular, the pattern that we use
write ctx->notify_me write bh->scheduled
read bh->scheduled read ctx->notify_me
if !bh->scheduled, sleep if ctx->notify_me, notify
needs to use seqcst operations for both the write and the read. In
general this is something that we do not want, because there can be
many sources that are polled in addition to bottom halves. The
alternative is to place a seqcst memory barrier between the write
and the read. This also comes with a disadvantage, in that the
memory barrier is implicit on strongly-ordered architectures and
it wastes a few dozen clock cycles.
Fortunately, ctx->notify_me is never written concurrently by two
threads, so we can assert that and relax the writes to ctx->notify_me.
The resulting solution works and performs well on both aarch64 and x86.
Note that the atomic_set/atomic_read combination is not an atomic
read-modify-write, and therefore it is even weaker than C11 ATOMIC_RELAXED;
on x86, ATOMIC_RELAXED compiles to a locked operation.
Analyzed-by: Ying Fang <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Tested-by: Ying Fang <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Commit: 17e1e49814096a3daaa8e5a73acd56a0f30bdc18
https://github.com/qemu/qemu/commit/17e1e49814096a3daaa8e5a73acd56a0f30bdc18
Author: Peter Maydell <address@hidden>
Date: 2020-04-09 (Thu, 09 Apr 2020)
Changed paths:
M include/block/aio-wait.h
M include/block/aio.h
M util/aio-posix.c
M util/aio-win32.c
M util/async.c
M util/fdmon-io_uring.c
Log Message:
-----------
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into
staging
Pull request
Fixes for QEMU on aarch64 ARM hosts and fdmon-io_uring.
# gpg: Signature made Thu 09 Apr 2020 18:42:01 BST
# gpg: using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <address@hidden>" [full]
# gpg: aka "Stefan Hajnoczi <address@hidden>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8
* remotes/stefanha/tags/block-pull-request:
async: use explicit memory barriers
aio-wait: delegate polling of main AioContext if BQL not held
aio-posix: signal-proof fdmon-io_uring
Signed-off-by: Peter Maydell <address@hidden>
Compare: https://github.com/qemu/qemu/compare/8bac3ba57eec...17e1e4981409
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-commits] [qemu/qemu] 636b83: aio-posix: signal-proof fdmon-io_uring,
Peter Maydell <=