mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
xen-bus / xen-block: add support for event channel polling
This patch introduces a poll callback for event channel fd-s and uses this to invoke the channel callback function. To properly support polling, it is necessary for the event channel callback function to return a boolean saying whether it has done any useful work or not. Thus xen_block_dataplane_event() is modified to directly invoke xen_block_handle_requests() and the latter only returns true if it actually processes any requests. This also means that the call to qemu_bh_schedule() is moved into xen_block_complete_aio(), which is more intuitive since the only reason for doing a deferred poll of the shared ring should be because there were previously insufficient resources to fully complete a previous poll. Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com> Message-Id: <20190408151617.13025-4-paul.durrant@citrix.com> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
This commit is contained in:
parent
83361a8a1f
commit
345f42b4be
3 changed files with 19 additions and 11 deletions
|
@ -932,13 +932,20 @@ struct XenEventChannel {
|
|||
void *opaque;
|
||||
};
|
||||
|
||||
static bool xen_device_poll(void *opaque)
|
||||
{
|
||||
XenEventChannel *channel = opaque;
|
||||
|
||||
return channel->handler(channel->opaque);
|
||||
}
|
||||
|
||||
static void xen_device_event(void *opaque)
|
||||
{
|
||||
XenEventChannel *channel = opaque;
|
||||
unsigned long port = xenevtchn_pending(channel->xeh);
|
||||
|
||||
if (port == channel->local_port) {
|
||||
channel->handler(channel->opaque);
|
||||
xen_device_poll(channel);
|
||||
|
||||
xenevtchn_unmask(channel->xeh, port);
|
||||
}
|
||||
|
@ -973,7 +980,7 @@ XenEventChannel *xen_device_bind_event_channel(XenDevice *xendev,
|
|||
|
||||
channel->ctx = ctx;
|
||||
aio_set_fd_handler(channel->ctx, xenevtchn_fd(channel->xeh), true,
|
||||
xen_device_event, NULL, NULL, channel);
|
||||
xen_device_event, NULL, xen_device_poll, channel);
|
||||
|
||||
QLIST_INSERT_HEAD(&xendev->event_channels, channel, list);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue