qemu/hw/block/dataplane
Paul Durrant 32d0b7be68 xen-bus/block: explicitly assign event channels to an AioContext
It is not safe to close an event channel from the QEMU main thread when
that channel's poller is running in IOThread context.

This patch adds a new xen_device_set_event_channel_context() function
to explicitly assign the channel AioContext, and modifies
xen_device_bind_event_channel() to initially assign the channel's poller
to the QEMU main thread context. The code in xen-block's dataplane is
then modified to assign the channel to IOThread context during
xen_block_dataplane_start() and de-assign it during in
xen_block_dataplane_stop(), such that the channel is always assigned
back to main thread context before it is closed. aio_set_fd_handler()
already deals with all the necessary synchronization when moving an fd
between AioContext-s so no extra code is needed to manage this.

Reported-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Message-Id: <20191216143451.19024-1-pdurrant@amazon.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
2020-02-27 11:50:30 +00:00
..
Makefile.objs block: fix recursion in hw/block/dataplane 2019-03-07 21:45:53 +01:00
trace-events trace-events: Shorten file names in comments 2019-03-22 16:18:07 +00:00
virtio-blk.c virtio-blk: fix out-of-bounds access to bitmap in notify_guest_bh 2019-12-19 16:20:25 +00:00
virtio-blk.h hw/block: Fix the return type 2017-12-19 09:25:28 +00:00
xen-block.c xen-bus/block: explicitly assign event channels to an AioContext 2020-02-27 11:50:30 +00:00
xen-block.h xen-block: support feature-large-sector-size 2019-06-24 10:42:29 +01:00