qemu-patch-raspberry4/include
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
..
block AioContext: do not rely on aio_poll(ctx, true) result to end a loop 2014-07-14 12:03:20 +02:00
disas disas: Implement disassembly output for A64 2014-02-08 14:50:48 +00:00
exec memory: MemoryRegion: Add may-overlap and priority props 2014-07-01 10:20:41 +02:00
fpu fpu: softfloat: drop INLINE macro 2014-06-23 11:00:12 -04:00
hw virtio-blk: embed VirtQueueElement in VirtIOBlockReq 2014-07-14 12:03:20 +02:00
libdecnumber libdecnumber: Introduce decNumberIntegralToInt64 2014-06-16 13:24:29 +02:00
migration vmstate: Add preallocation for migrating arrays (VMS_ALLOC flag) 2014-06-27 13:48:27 +02:00
monitor qapi event: clean up 2014-06-23 11:12:28 -04:00
net net: move queue number into NICPeers 2014-06-27 11:19:31 +02:00
qapi qapi: add event helper functions 2014-06-23 11:01:25 -04:00
qemu Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging 2014-06-24 13:06:13 +01:00
qom qom: add a generic mechanism to resolve paths 2014-07-01 10:17:48 +02:00
sysemu Handle G_IO_HUP in tcp_chr_read for tcp chardev 2014-07-06 09:13:54 +03:00
ui console: move chardev declarations to sysemu/char.h 2014-06-23 10:56:20 +01:00
config.h janitor: move remaining public headers to include/ 2012-12-19 08:32:46 +01:00
elf.h target-ppc: Support little-endian PPC64 in user mode. 2014-06-16 13:24:40 +02:00
glib-compat.h glib-compat.h: add new thread API emulation on top of pre-2.31 API 2014-06-10 07:44:01 +02:00
qemu-common.h util: add return value to qemu_iovec_concat_iov 2014-06-18 08:47:10 +02:00
qemu-io.h qemu-io: Fix warnings from static code analysis 2014-03-13 14:42:24 +01:00
trace.h build: some simplifications for "trace/Makefile.objs" 2013-01-12 18:42:51 +01:00