Block patches
The following changes since commit ecc1f5adeec4e3324d1b695a7c54e3967c526949:
maintainers: Add myself as linux-user reviewer (2017-05-11 13:31:11 -0400)
are available in the git repository at:
git://github.com/stefanha/qemu.git tags/block-pull-request
for you to fetch changes up to 321d1dba8bef9676a77e9399484e3cd8bf2cf16a:
aio: add missing aio_notify() to aio_enable_external() (2017-05-12 10:36:46 -0400)
----------------------------------------------------------------
----------------------------------------------------------------
Daniel P. Berrange (1):
coroutine: remove GThread implementation
Eric Blake (1):
block: Simplify BDRV_BLOCK_RAW recursion
Stefan Hajnoczi (1):
aio: add missing aio_notify() to aio_enable_external()
configure | 19 ++--- include/block/aio.h | 10 ++- block/io.c | 4 +- util/coroutine-gthread.c | 198 ----------------------------------------------- .travis.yml | 5 +- 5 files changed, 16 insertions(+), 220 deletions(-) delete mode 100644 util/coroutine-gthread.c
Signature · 1 line
2.9.3
[Qemu-devel] [PULL for-2.9 1/3] coroutine: remove GThread implementation
From: "Daniel P. Berrange" <[email protected]>
The GThread implementation is not functional enough to actually run QEMU reliably. While it was potentially useful for debugging, we have a scripts/qemugdb/coroutine.py to enable tracing of ucontext coroutines in GDB, so that removes the only reason for GThread to exist.
--- configure | 19 ++--- util/coroutine-gthread.c | 198 ----------------------------------------------- .travis.yml | 5 +- 3 files changed, 6 insertions(+), 216 deletions(-) delete mode 100644 util/coroutine-gthread.c
configure +5 -14
@@ -1334,7 +1334,7 @@ Advanced options (experts only): --oss-lib path to OSS library --cpu=CPU Build for host CPU [$cpu] --with-coroutine=BACKEND coroutine backend. Supported options: - gthread, ucontext, sigaltstack, windows + ucontext, sigaltstack, windows --enable-gcov enable test coverage analysis with gcov --gcov=GCOV use specified gcov [$gcov_tool] --disable-blobs disable installing provided firmware blobs
@@ -4418,10 +4418,8 @@ fi # check and set a backend for coroutine # We prefer ucontext, but it's not always possible. The fallback -# is sigcontext. gthread is not selectable except explicitly, because -# it is not functional enough to run QEMU proper. (It is occasionally -# useful for debugging purposes.) On Windows the only valid backend -# is the Windows-specific one. +# is sigcontext. On Windows the only valid backend is the Windows +# specific one. ucontext_works=no if test "$darwin" != "yes"; then
@@ -4460,7 +4458,7 @@ else feature_not_found "ucontext" fi ;; - gthread|sigaltstack) + sigaltstack) if test "$mingw32" = "yes"; then error_exit "only the 'windows' coroutine backend is valid for Windows" fi
@@ -4472,14 +4470,7 @@ else fi if test "$coroutine_pool" = ""; then - if test "$coroutine" = "gthread"; then - coroutine_pool=no - else - coroutine_pool=yes - fi -fi -if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then - error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)" + coroutine_pool=yes fi if test "$debug_stack_usage" = "yes"; then
util/coroutine-gthread.c deleted +0 -198
198 lines not on this page · raw message
.travis.yml +1 -4
@@ -86,9 +86,6 @@ matrix: - env: CONFIG="--enable-trace-backends=ust" TEST_CMD="" compiler: gcc - - env: CONFIG="--with-coroutine=gthread" - TEST_CMD="" - compiler: gcc - env: CONFIG="" os: osx compiler: clang
@@ -191,7 +188,7 @@ matrix: compiler: none env: - COMPILER_NAME=gcc CXX=g++-5 CC=gcc-5 - - CONFIG="--cc=gcc-5 --cxx=g++-5 --disable-pie --disable-linux-user --with-coroutine=gthread" + - CONFIG="--cc=gcc-5 --cxx=g++-5 --disable-pie --disable-linux-user" - TEST_CMD="" before_script: - ./configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread -fuse-ld=gold" || cat config.log
Signature · 1 line
2.9.3
[Qemu-devel] [PULL for-2.9 2/3] block: Simplify BDRV_BLOCK_RAW recursion
In reply to Stefan HajnocziFrom: Eric Blake <[email protected]>
Since we are already in coroutine context during the body of bdrv_co_get_block_status(), we can shave off a few layers of wrappers when recursing to query the protocol when a format driver returned BDRV_BLOCK_RAW.
Note that we are already using the correct recursion later on in the same function, when probing whether the protocol layer is sparse in order to find out if we can add BDRV_BLOCK_ZERO to an existing BDRV_BLOCK_DATA|BDRV_BLOCK_OFFSET_VALID.
Message-id: [email protected]
--- block/io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
block/io.c +2 -2
@@ -1784,8 +1784,8 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,if (ret &BDRV_BLOCK_RAW ) {assert (ret &BDRV_BLOCK_OFFSET_VALID ); - ret =bdrv_get_block_status (*file, ret >>BDRV_SECTOR_BITS , - *pnum, pnum, file); + ret =bdrv_co_get_block_status (*file, ret >>BDRV_SECTOR_BITS , + *pnum, pnum, file); goto out; }
Signature · 1 line
2.9.3
[Qemu-devel] [PULL for-2.9 3/3] aio: add missing aio_notify() to aio_enable_external()
In reply to Stefan HajnocziThe main loop uses aio_disable_external()/aio_enable_external() to temporarily disable processing of external AioContext clients like device emulation.
This allows monitor commands to quiesce I/O and prevent the guest from submitting new requests while a monitor command is in progress.
The aio_enable_external() API is currently broken when an IOThread is in aio_poll() waiting for fd activity when the main loop re-enables external clients. Incrementing ctx->external_disable_cnt does not wake the IOThread from ppoll(2) so fd processing remains suspended and leads to unresponsive emulated devices.
This patch adds an aio_notify() call to aio_enable_external() so the IOThread is kicked out of ppoll(2) and will re-arm the file descriptors.
The bug can be reproduced as follows:
$ qemu -M accel=kvm -m 1024 \
-object iothread,id=iothread0 \
-device virtio-scsi-pci,iothread=iothread0,id=virtio-scsi-pci0 \
-drive if=none,id=drive0,aio=native,cache=none,format=raw,file=test.img \
-device scsi-hd,id=scsi-hd0,drive=drive0 \
-qmp tcp::5555,server,nowait $ scripts/qmp/qmp-shell localhost:5555
(qemu) blockdev-snapshot-sync device=drive0 snapshot-file=sn1.qcow2
mode=absolute-paths format=qcow2After blockdev-snapshot-sync completes the SCSI disk will be unresponsive. This leads to request timeouts inside the guest.
Message-id: [email protected]
--- include/block/aio.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
include/block/aio.h +8 -2
@@ -454,8 +454,14 @@ static inline void aio_disable_external(AioContext *ctx)*/ static inline void aio_enable_external (AioContext *ctx) { -assert (ctx->external_disable_cnt >0 ); -atomic_dec (&ctx->external_disable_cnt); +int old; + + old =atomic_fetch_dec (&ctx->external_disable_cnt); +assert (old >0 ); +if (old ==1 ) { +/* Kick event loop so it re-arms file descriptors */ +aio_notify (ctx); + } }/**
Signature · 1 line
2.9.3
Re: [Qemu-devel] [PULL for-2.9 1/3] coroutine: remove GThread implementation
In reply to Stefan HajnocziQuoted 8 lines · Stefan Hajnoczi
From: "Daniel P. Berrange" <[email protected]>
The GThread implementation is not functional enough to actually run QEMU reliably. While it was potentially useful for debugging, we have a
scripts/qemugdb/coroutine.pyto enable tracing of ucontext coroutines in GDB, so that removes the only reason for GThread to exist.
Quick question (unrelated to the pull request): Can we get a patch to scripts/qemugdb/coroutine.py or nearby that mentions the preferred way to actually use the script? I didn't know the script existed before seeing this commit message, and was sad to see that it was not self-documenting (or else a scripts/qemugdb/README file) on how best to utilize the script (is it as simple as running 'gdb --some-arg /path/to/coroutine.py'? do you have to install some magic file to tell gdb to autoload the file any time you are debugging qemu? something else???).
Okay, I searched a bit harder, and found that scripts/qemu-gdb.py loads these subscripts, if you type 'source scripts/qemu-gdb.py' at the (gdb) prompt. Still, is there a way to automate that so that the scripts are loaded every time you fire up gdb, instead of having to remember to do it by hand? And if so, can that be documented?
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PULL for-2.9 1/3] coroutine: remove GThread implementation
Quoted 20 lines · Eric Blake
Quoted 8 lines · Stefan Hajnoczi
From: "Daniel P. Berrange" <[email protected]>
The GThread implementation is not functional enough to actually run QEMU reliably. While it was potentially useful for debugging, we have a
scripts/qemugdb/coroutine.pyto enable tracing of ucontext coroutines in GDB, so that removes the only reason for GThread to exist.Quick question (unrelated to the pull request): Can we get a patch to
scripts/qemugdb/coroutine.pyor nearby that mentions the preferred way to actually use the script? I didn't know the script existed before seeing this commit message, and was sad to see that it was not self-documenting (or else ascripts/qemugdb/READMEfile) on how best to utilize the script (is it as simple as running 'gdb --some-arg /path/to/coroutine.py'? do you have to install some magic file to tell gdb to autoload the file any time you are debugging qemu? something else???).
Quoted 5 lines
Okay, I searched a bit harder, and found that
scripts/qemu-gdb.pyloads these subscripts, if you type 'sourcescripts/qemu-gdb.py' at the (gdb) prompt. Still, is there a way to automate that so that the scripts are loaded every time you fire up gdb, instead of having to remember to do it by hand? And if so, can that be documented?
I'll send a patch to add a .gdbinit file.
Stefan
Stefan Hajnoczi
AppliedQuoted 25 lines · Stefan Hajnoczi
The following changes since commit
ecc1f5adeec4e3324d1b695a7c54e3967c526949:maintainers: Add myself as linux-user reviewer (2017-05-11 13:31:11 -0400)
are available in the git repository at:
git://github.com/stefanha/qemu.gittags/block-pull-requestfor you to fetch changes up to
321d1dba8bef9676a77e9399484e3cd8bf2cf16a:aio: add missing
aio_notify()toaio_enable_external()(2017-05-12 10:36:46 -0400)----------------------------------------------------------------
----------------------------------------------------------------
Daniel P. Berrange (1):
coroutine: remove GThread implementationEric Blake (1):
block: SimplifyBDRV_BLOCK_RAWrecursionStefan Hajnoczi (1):
aio: add missingaio_notify()toaio_enable_external()
Quoted 12 lines
configure | 19 ++--- include/block/aio.h | 10 ++- block/io.c | 4 +- util/coroutine-gthread.c | 198 ----------------------------------------------- .travis.yml | 5 +- 5 files changed, 16 insertions(+), 220 deletions(-) delete mode 100644 util/coroutine-gthread.cSignature · 1 line
2.9.3
Thanks, applied to my master tree:
https://github.com/stefanha/qemu/commits/master
Stefan