qemu-patch-raspberry4/include
Fam Zheng 12664c5a1c iothread: Stop threads before main() quits
Right after main_loop ends, we release various things but keep iothread
alive. The latter is not prepared to the sudden change of resources.

Specifically, after bdrv_close_all(), virtio-scsi dataplane get a
surprise at the empty BlockBackend:

(gdb) bt
    at /usr/src/debug/qemu-2.6.0/hw/scsi/virtio-scsi.c:543
    at /usr/src/debug/qemu-2.6.0/hw/scsi/virtio-scsi.c:577

It is because the d->conf.blk->root is set to NULL, then
blk_get_aio_context() returns qemu_aio_context, whereas s->ctx is still
pointing to the iothread:

    hw/scsi/virtio-scsi.c:543:

    if (s->dataplane_started) {
        assert(blk_get_aio_context(d->conf.blk) == s->ctx);
    }

To fix this, let's stop iothreads before doing bdrv_close_all().

Cc: qemu-stable@nongnu.org
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1473326931-9699-1-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit dce8921b2b)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2016-09-20 11:38:26 -05:00
..
block nbd: Limit nbdflags to 16 bits 2016-08-05 16:19:20 -05:00
crypto Fix some typos found by codespell 2016-08-05 16:14:47 -05:00
disas disas: Add print_insn to disassemble info 2015-07-09 15:20:40 +02:00
exec qemu-log: dfilter-ise exec, out_asm, op and opt_op 2016-03-22 22:20:18 +01:00
fpu include: Clean up includes 2016-02-23 12:43:05 +00:00
hw scsi: esp: make cmdbuf big enough for maximum CDB size 2016-08-09 14:31:04 -05:00
io Fix some typos found by codespell 2016-08-05 16:14:47 -05:00
libdecnumber include: Clean up includes 2016-02-23 12:43:05 +00:00
migration savevm: fail if migration blockers are present 2016-08-05 13:29:25 -05:00
monitor Use scripts/clean-includes to drop redundant qemu/typedefs.h 2016-03-22 22:20:16 +01:00
net Use scripts/clean-includes to drop redundant qemu/typedefs.h 2016-03-22 22:20:16 +01:00
qapi Use scripts/clean-includes to drop redundant qemu/typedefs.h 2016-03-22 22:20:16 +01:00
qemu Fix some typos found by codespell 2016-08-05 16:14:47 -05:00
qom qom: -object error messages lost location, restore it 2016-04-28 08:19:36 +02:00
standard-headers update Linux headers to 4.6 2016-04-05 11:46:52 +02:00
sysemu iothread: Stop threads before main() quits 2016-09-20 11:38:26 -05:00
ui spice/gl: add & use qemu_spice_gl_monitor_config 2016-08-04 16:00:18 -05:00
elf.h include: Clean up includes 2016-02-23 12:43:05 +00:00
glib-compat.h glib: add compatibility interface for g_hash_table_add() 2015-10-30 09:01:03 +01:00
qemu-common.h util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01: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