qemu-e2k/include
Stefan Hajnoczi ca96ac44dc AioContext: force event loop iteration using BH
The notify_me optimization introduced in commit eabc977973
("AioContext: fix broken ctx->dispatching optimization") skips
event_notifier_set() calls when the event loop thread is not blocked in
ppoll(2).

This optimization causes a deadlock if two aio_context_acquire() calls
race.  notify_me = 0 during the race so the winning thread can enter
ppoll(2) unaware that the other thread is waiting its turn to acquire
the AioContext.

This patch forces ppoll(2) to return by scheduling a BH instead of
calling aio_notify().

The following deadlock with virtio-blk dataplane is fixed:

  qemu ... -object iothread,id=iothread0 \
           -drive if=none,id=drive0,file=test.img,... \
           -device virtio-blk-pci,iothread=iothread0,drive=drive0

This command-line results in a hang early on without this patch.

Thanks to Paolo Bonzini <pbonzini@redhat.com> for investigating this bug
with me.

Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1438101249-25166-4-git-send-email-pbonzini@redhat.com
Message-Id: <1438014819-18125-3-git-send-email-stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-07-29 10:02:06 +01:00
..
block AioContext: force event loop iteration using BH 2015-07-29 10:02:06 +01:00
crypto crypto: introduce generic cipher API & built-in implementation 2015-07-08 13:11:01 +02:00
disas disas: Add print_insn to disassemble info 2015-07-09 15:20:40 +02:00
exec memory: count number of active VGA logging clients 2015-07-24 13:57:45 +02:00
fpu softfloat: expand out STATUS macro 2015-02-06 16:11:38 +00:00
hw virtio fixes for 2.4 2015-07-28 17:09:56 +01:00
libdecnumber Fix new typos in comments (found by codespell) 2014-07-18 17:45:36 +04:00
migration vmstate: remove unused declaration 2015-07-27 22:44:47 +03:00
monitor Include monitor/monitor.h exactly where needed 2015-06-22 18:20:41 +02:00
net qmp: Wean off qerror_report() 2015-06-22 18:20:40 +02:00
qapi qerror: Move #include out of qerror.h 2015-06-22 18:20:40 +02:00
qemu timer: rename NSEC_PER_SEC due to Mac OS X header clash 2015-07-20 17:01:00 +01:00
qom disas: QOMify target specific setup 2015-07-09 15:20:41 +02:00
standard-headers virtio-input: move sys/ioctl.h include 2015-07-16 17:34:41 +02:00
sysemu runstate: Add runstate store 2015-07-07 14:54:51 +02:00
ui Include monitor/monitor.h exactly where needed 2015-06-22 18:20:41 +02:00
config.h janitor: move remaining public headers to include/ 2012-12-19 08:32:46 +01:00
elf.h linux/elf.h update 2015-05-27 17:52:03 +02:00
glib-compat.h glib: remove stale compat functions 2015-05-22 15:58:06 -04:00
qemu-common.h qemu-common.h: Document cutils.c string functions 2015-07-27 22:44:47 +03:00
qemu-io.h qemu-io: Use BlockBackend 2015-02-16 15:07:19 +00:00
qjson.h QJSON: Add JSON writer 2015-02-05 17:16:14 +01:00
trace-tcg.h trace: [tcg] Generate TCG tracing routines 2014-08-12 14:26:12 +01:00
trace.h trace: [tcg] Include event definitions in "trace.h" 2014-08-12 14:26:12 +01:00