Go to file
Paolo Bonzini acfb23ad3d AioContext: do not rely on aio_poll(ctx, true) result to end a loop
Currently, whenever aio_poll(ctx, true) has completed all pending
work it returns true *and* the next call to aio_poll(ctx, true)
will not block.

This invariant has its roots in qemu_aio_flush()'s implementation
as "while (qemu_aio_wait()) {}".  However, qemu_aio_flush() does
not exist anymore and bdrv_drain_all() is implemented differently;
and this invariant is complicated to maintain and subtly different
from the return value of GMainLoop's g_main_context_iteration.

All calls to aio_poll(ctx, true) except one are guarded by a
while() loop checking for a request to be incomplete, or a
BlockDriverState to be idle.  The one remaining call (in
iothread.c) uses this to delay the aio_context_release/acquire
pair until the AioContext is quiescent, however:

- we can do the same just by using non-blocking aio_poll,
  similar to how vl.c invokes main_loop_wait

- it is buggy, because it does not ensure that the AioContext
  is released between an aio_notify and the next time the
  iothread goes to sleep.  This leads to hangs when stopping
  the dataplane thread.

In the end, these semantics are a bad match for the current
users of AioContext.  So modify that one exception in iothread.c,
which also fixes the hangs, as well as the testcase so that
it use the same idiom as the actual QEMU code.

Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-07-14 12:03:20 +02:00
audio audio: Drop superfluous conditionals around g_free() 2014-06-13 12:34:54 +02:00
backends rng-random: NULL check not needed before g_free() 2014-06-24 20:01:24 +04:00
block block: Assert qiov length matches request length 2014-07-14 12:03:20 +02:00
bsd-user bsd-user: Fix syscall format, add strace support for more syscalls 2014-06-11 00:25:06 +01:00
default-configs pc: implement pc-dimm device abstraction 2014-06-19 16:41:47 +03:00
disas disas/libvixl: prepend the include path of libvixl header files 2014-07-08 12:45:57 +01:00
docs AioContext: speed up aio_notify 2014-07-09 15:50:11 +02:00
dtc@bc895d6d09
fpu fpu: softfloat: drop INLINE macro 2014-06-23 11:00:12 -04:00
fsdev virtfs-proxy-helper: fix call to accept 2014-04-28 08:55:32 +04:00
gdb-xml
hw virtio-blk: embed VirtQueueElement in VirtIOBlockReq 2014-07-14 12:03:20 +02:00
include AioContext: do not rely on aio_poll(ctx, true) result to end a loop 2014-07-14 12:03:20 +02:00
libcacard vscclient: Add required headers to fix build on FreeBSD 2014-06-24 20:01:24 +04:00
libdecnumber libdecnumber: Fix decNumberSetBCD 2014-06-16 13:24:29 +02:00
linux-headers linux-headers: update linux headers to kvm/next 2014-06-16 13:24:41 +02:00
linux-user target-ppc: Change default cpu for ppc64le-linux-user 2014-07-08 12:10:36 +02:00
net net: add mmsghdr struct check for L2TPV3 2014-07-01 17:42:23 +01:00
pc-bios pc-bios/s390-ccw: update binary 2014-07-08 15:08:03 +02:00
pixman@97336fad32
po po: add proper Language: tags to .po files 2014-04-28 08:55:32 +04:00
qapi block: add backing-file option to block-stream 2014-07-01 10:47:01 +02:00
qga qga: Fix handle fd leak in acquire_privilege() 2014-06-03 15:07:59 -05:00
qobject json-lexer: fix escaped backslash in single-quoted string 2014-06-23 11:01:24 -04:00
qom qom: object: Ignore refs/unrefs of NULL 2014-07-01 10:20:41 +02:00
roms pseries: Update SLOF firmware image to qemu-slof-20140630 2014-07-08 12:10:36 +02:00
scripts qapi script: clean up in scripts 2014-06-27 09:27:56 -04:00
slirp Increase maximum number of session of the internal TFTP server. 2014-06-24 20:01:24 +04:00
stubs Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging 2014-06-24 13:06:13 +01:00
sysconfigs/target
target-alpha softmmu: introduce cpu_ldst.h 2014-06-05 16:10:33 +02:00
target-arm target-arm: Implement vCPU reset via KVM_ARM_VCPU_INIT for 32-bit CPUs 2014-07-08 13:05:11 +01:00
target-cris target-cris/translate.c: Remove _t_gen_mov_TN_env and _t_gen_mov_env_TN 2014-06-09 01:04:44 +02:00
target-i386 target-i386: Broadwell CPU model 2014-06-25 23:54:57 +02:00
target-lm32 vl: allow other threads to do qemu_system_vmstop_request 2014-06-23 16:36:13 +08:00
target-m68k softmmu: introduce cpu_ldst.h 2014-06-05 16:10:33 +02:00
target-microblaze target-microblaze: Delete unused sign_extend() function 2014-06-10 19:39:34 +04:00
target-mips target-mips: copy CP0_Config1 into DisasContext 2014-06-20 22:14:13 +02:00
target-moxie softmmu: introduce cpu_ldst.h 2014-06-05 16:10:33 +02:00
target-openrisc openrisc: fix comment 2014-06-29 18:59:06 +03:00
target-ppc target-ppc: Remove POWER7+ and POWER8E families 2014-07-08 12:10:36 +02:00
target-s390x target-s390x: Remove unused ld_code6() function 2014-06-24 20:01:24 +04:00
target-sh4 softmmu: introduce cpu_ldst.h 2014-06-05 16:10:33 +02:00
target-sparc softmmu: introduce cpu_ldst.h 2014-06-05 16:10:33 +02:00
target-unicore32 target-unicore: Remove unused functions 2014-06-24 20:01:24 +04:00
target-xtensa softmmu: introduce cpu_ldst.h 2014-06-05 16:10:33 +02:00
tcg tcg/ppc: Fix support for 64-bit PPC MacOSX hosts 2014-06-29 11:38:50 +01:00
tests AioContext: do not rely on aio_poll(ctx, true) result to end a loop 2014-07-14 12:03:20 +02:00
trace glib-compat.h: add new thread API emulation on top of pre-2.31 API 2014-06-10 07:44:01 +02:00
ui ui/vnc: fix potential memory corruption issues 2014-07-01 13:26:40 +02:00
util qemu_opts_append: Play nicely with QemuOptsList's head 2014-06-26 15:53:52 +02:00
.exrc
.gitignore qapi: ignore generated event files 2014-06-27 09:27:55 -04:00
.gitmodules PPC: Add u-boot firmware for e500 2014-06-16 13:24:35 +02:00
.mailmap
.travis.yml trace: Multi-backend tracing 2014-06-09 15:43:40 +02:00
aio-posix.c AioContext: speed up aio_notify 2014-07-09 15:50:11 +02:00
aio-win32.c block: drop aio functions that operate on the main AioContext 2014-07-09 15:50:11 +02:00
arch_init.c migration: catch unknown flags in ram_load 2014-06-16 04:55:27 +02:00
async.c AioContext: speed up aio_notify 2014-07-09 15:50:11 +02:00
balloon.c qapi event: convert BALLOON_CHANGE 2014-06-23 11:12:28 -04:00
block-migration.c block: fix wrong order in live block migration setup 2014-06-04 11:22:39 +02:00
block.c block: Assert qiov length matches request length 2014-07-14 12:03:20 +02:00
blockdev-nbd.c nbd: Shutdown socket before closing. 2014-06-30 12:50:12 +02:00
blockdev.c block: add backing-file option to block-stream 2014-07-01 10:47:01 +02:00
blockjob.c block: prefer aio_poll to qemu_aio_wait 2014-07-09 15:50:11 +02:00
bt-host.c
bt-vhci.c
Changelog
CODING_STYLE CODING_STYLE: Section about mixed declarations 2014-03-27 19:22:49 +04:00
configure net: add mmsghdr struct check for L2TPV3 2014-07-01 17:42:23 +01:00
COPYING
COPYING.LIB
coroutine-gthread.c glib-compat.h: add new thread API emulation on top of pre-2.31 API 2014-06-10 07:44:01 +02:00
coroutine-sigaltstack.c
coroutine-ucontext.c
coroutine-win32.c coroutine-win32.c: Add noinline attribute to work around gcc bug 2014-06-26 14:08:14 +01:00
cpu-exec.c cpu: make CPU_INTERRUPT_RESET available on all targets 2014-05-13 13:21:51 +02:00
cpus.c qapi event: convert STOP 2014-06-23 11:01:25 -04:00
cputlb.c softmmu: introduce cpu_ldst.h 2014-06-05 16:10:33 +02:00
device-hotplug.c blockdev: Remove unused DriveInfo reference count 2014-06-16 17:23:19 +08:00
device_tree.c
disas.c monitor: QEMU Monitor Instruction Disassembly Incorrect for PowerPC LE Mode 2014-06-16 13:24:26 +02:00
dma-helpers.c dma-helpers: avoid calling dma_bdrv_unmap() twice 2014-05-24 00:28:43 +04:00
dump.c dump: Make DumpState and endian conversion routines available for arch-specific dump code 2014-06-16 13:24:36 +02:00
exec.c memory: do not give a name to the internal exec.c regions 2014-07-01 10:20:41 +02:00
gdbstub.c exec: Change cpu_breakpoint_{insert,remove{,_by_ref,_all}} argument 2014-03-13 19:20:48 +01:00
HACKING
hmp-commands.hx Add the vhost-user netdev backend to the command line 2014-06-19 18:44:18 +03:00
hmp.c block: add backing-file option to block-stream 2014-07-01 10:47:01 +02:00
hmp.h hmp: add info memdev 2014-06-19 18:44:21 +03:00
iohandler.c iohandler.c: Properly initialize sigaction struct 2014-05-24 00:07:29 +04:00
ioport.c
iothread.c AioContext: do not rely on aio_poll(ctx, true) result to end a loop 2014-07-14 12:03:20 +02:00
kvm-all.c Merge remote-tracking branch 'remotes/kvm/uq/master' into staging 2014-06-20 19:25:18 +01:00
kvm-stub.c Add kvm_eventfds_enabled function 2014-06-19 16:41:54 +03:00
LICENSE
main-loop.c block: drop aio functions that operate on the main AioContext 2014-07-09 15:50:11 +02:00
MAINTAINERS MAINTAINERS: add Stefan Hajnoczi to IDE maintainers 2014-07-07 09:15:29 +02:00
Makefile PPC: e500: Actually install u-boot.e500 2014-07-08 12:10:37 +02:00
Makefile.objs qapi script: add event support 2014-06-23 11:01:25 -04:00
Makefile.target configure: Fix -lm test, so that tools can be compiled on hosts that require -lm 2014-07-01 10:36:28 +02:00
memory.c memory: MemoryRegion: Add size property 2014-07-01 10:20:41 +02:00
memory_mapping.c
migration-exec.c
migration-fd.c
migration-rdma.c rdma: bug fixes 2014-06-23 19:09:50 +02:00
migration-tcp.c Coverity: Fix failure path for qemu_accept in migration 2014-05-05 22:15:03 +02:00
migration-unix.c Coverity: Fix failure path for qemu_accept in migration 2014-05-05 22:15:03 +02:00
migration.c migration: catch unknown flags in ram_load 2014-06-16 04:55:27 +02:00
module-common.c module: implement module loading 2014-02-20 13:14:18 +01:00
monitor.c serial: poll the serial console with G_IO_HUP 2014-06-30 15:04:34 +02:00
nbd.c nbd: Handle NBD_OPT_LIST option. 2014-06-30 12:50:17 +02:00
numa.c numa: check for busy memory backend 2014-07-06 09:13:53 +03:00
os-posix.c oslib-posix: Fix build on FreeBSD 2014-03-13 14:34:16 +00:00
os-win32.c util: Split out exec_dir from os_find_datadir 2014-02-20 13:12:54 +01:00
page_cache.c migration: Plug memory leak in migrate-set-cache-size command 2014-06-10 19:54:43 +04:00
qapi-schema.json mc146818rtc: add rtc-reset-reinjection QMP command 2014-06-29 18:59:35 +03:00
qdev-monitor.c qdev: Implement named GPIOs 2014-05-28 17:36:21 +02:00
qdict-test-data.txt
qemu-bridge-helper.c qemu-bridge-helper: Fix fd leak in main() 2014-06-27 10:39:10 +02:00
qemu-char.c qemu-char: add chr_add_watch support in mux chardev 2014-07-06 09:13:54 +03:00
qemu-coroutine-io.c
qemu-coroutine-lock.c
qemu-coroutine-sleep.c
qemu-coroutine.c
qemu-doc.texi Fix nocow typos in manpage 2014-07-07 09:15:29 +02:00
qemu-file.c Make qemu_peek_buffer loop until it gets it's data 2014-05-05 22:15:03 +02:00
qemu-img-cmds.hx
qemu-img.c cleanup QEMUOptionParameter 2014-06-16 17:23:21 +08:00
qemu-img.texi Fix nocow typos in manpage 2014-07-07 09:15:29 +02:00
qemu-io-cmds.c block: prefer aio_poll to qemu_aio_wait 2014-07-09 15:50:11 +02:00
qemu-io.c trace: Multi-backend tracing 2014-06-09 15:43:40 +02:00
qemu-log.c
qemu-nbd.c nbd: Shutdown socket before closing. 2014-06-30 12:50:12 +02:00
qemu-nbd.texi nbd: Miscellaneous typo fixes. 2014-05-24 00:07:29 +04:00
qemu-options-wrapper.h
qemu-options.h
qemu-options.hx net: L2TPv3 transport 2014-06-27 10:39:10 +02:00
qemu-seccomp.c seccomp: add shmctl(), mlock(), and munlock() to the syscall whitelist 2014-04-25 14:52:03 -03:00
qemu-tech.texi
qemu-timer.c vl.c: remove init_clocks call from main 2014-05-09 20:57:32 +02:00
qemu.nsi
qemu.sasl sasl: Avoid 'Could not find keytab file' in syslog 2014-03-15 13:54:18 +04:00
qmp-commands.hx block: add backing-file option to block-stream 2014-07-01 10:47:01 +02:00
qmp.c qmp: show QOM properties in device-list-properties 2014-07-07 11:10:05 +02:00
qtest.c qtest: fix hex2nib for capital characters 2014-06-10 19:39:34 +04:00
README
rules.mak build-sys: introduce install-prog macro to install&strip binaries and use it 2014-06-24 20:01:24 +04:00
savevm.c savevm: check vmsd for migratability status 2014-06-25 23:54:57 +02:00
softmmu_template.h softmmu: move softmmu_template.h out of include/ 2014-06-05 16:10:33 +02:00
spice-qemu-char.c qemu-char: introduce qemu_chr_alloc 2014-06-23 11:12:28 -04:00
tcg-runtime.c tcg: Push tcg-runtime routines into exec/helper-* 2014-05-28 09:33:54 -07:00
tci.c Merge remote-tracking branch 'remotes/bonzini/softmmu-smap' into staging 2014-06-05 21:06:14 +01:00
thread-pool.c aio: Fix use-after-free in cancellation path 2014-05-28 14:28:46 +02:00
thunk.c
tpm.c Use error_is_set() only when necessary 2014-02-17 11:57:23 -05:00
trace-events trace: add qemu_system_powerdown_request and qemu_system_shutdown_request trace events 2014-07-01 10:56:13 +02:00
translate-all.c Fix new typos (found by codespell) 2014-06-24 20:01:24 +04:00
translate-all.h translate-all: Change tb_check_watchpoint() argument to CPUState 2014-03-13 19:20:48 +01:00
user-exec.c softmmu: introduce cpu_ldst.h 2014-06-05 16:10:33 +02:00
VERSION Update version for v2.1.0-rc1 release 2014-07-08 16:53:59 +01:00
version.rc
vl.c Tracing pull request 2014-07-01 14:21:50 +01:00
vmstate.c vmstate: Add preallocation for migrating arrays (VMS_ALLOC flag) 2014-06-27 13:48:27 +02:00
xbzrle.c xbzrle.c: Avoid undefined behaviour with signed arithmetic 2014-04-18 10:33:36 +04:00
xen-common-stub.c xen: factor out common functions 2014-05-07 16:16:43 +00:00
xen-common.c xen: factor out common functions 2014-05-07 16:16:43 +00:00
xen-hvm-stub.c xen-hvm: Fix xen_hvm_init() to adjust pc memory layout 2014-06-23 17:50:04 +03:00
xen-hvm.c xen: build on ARM 2014-07-07 10:37:40 +00:00
xen-mapcache.c xen: build on ARM 2014-07-07 10:37:40 +00:00

Read the documentation in qemu-doc.html or on http://wiki.qemu-project.org

- QEMU team