mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
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>
This commit is contained in:
parent
b8030af450
commit
32d0b7be68
3 changed files with 45 additions and 7 deletions
|
@ -128,10 +128,13 @@ void xen_device_copy_grant_refs(XenDevice *xendev, bool to_domain,
|
|||
typedef bool (*XenEventHandler)(void *opaque);
|
||||
|
||||
XenEventChannel *xen_device_bind_event_channel(XenDevice *xendev,
|
||||
AioContext *ctx,
|
||||
unsigned int port,
|
||||
XenEventHandler handler,
|
||||
void *opaque, Error **errp);
|
||||
void xen_device_set_event_channel_context(XenDevice *xendev,
|
||||
XenEventChannel *channel,
|
||||
AioContext *ctx,
|
||||
Error **errp);
|
||||
void xen_device_notify_event_channel(XenDevice *xendev,
|
||||
XenEventChannel *channel,
|
||||
Error **errp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue