From nobody Fri May 3 23:07:05 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554736974615749.1471953833916; Mon, 8 Apr 2019 08:22:54 -0700 (PDT) Received: from localhost ([127.0.0.1]:54789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDW6b-0006IQ-Ga for importer@patchew.org; Mon, 08 Apr 2019 11:22:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDW17-0002n9-5D for qemu-devel@nongnu.org; Mon, 08 Apr 2019 11:17:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDW11-0001N0-Dy for qemu-devel@nongnu.org; Mon, 08 Apr 2019 11:16:57 -0400 Received: from smtp03.citrix.com ([162.221.156.55]:43196) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hDW0y-00010C-0U; Mon, 08 Apr 2019 11:16:53 -0400 X-IronPort-AV: E=Sophos;i="5.60,325,1549929600"; d="scan'208";a="83016890" From: Paul Durrant To: , , Date: Mon, 8 Apr 2019 16:16:15 +0100 Message-ID: <20190408151617.13025-2-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb6 In-Reply-To: <20190408151617.13025-1-paul.durrant@citrix.com> References: <20190408151617.13025-1-paul.durrant@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 162.221.156.55 Subject: [Qemu-devel] [PATCH 1/3] xen-bus: use a separate fd for each event channel X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anthony Perard , Paul Durrant , Stefano Stabellini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" To better support use of IOThread-s it will be necessary to be able to set the AioContext for each XenEventChannel and hence it is necessary to open a separate handle to libxenevtchan for each channel. This patch stops using NotifierList for event channel callbacks, replacing that construct by a list of complete XenEventChannel structures. Each of these now has a xenevtchn_handle pointer in place of the single pointer previously held in the XenDevice structure. The individual handles are opened/closed in xen_device_bind/unbind_event_channel(), replacing the single open/close in xen_device_realize/unrealize(). NOTE: This patch does not add an AioContext parameter to xen_device_bind_event_channel(). That will be done in a subsequent patch. Signed-off-by: Paul Durrant Reviewed-by: Anthony PERARD --- Cc: Stefano Stabellini Cc: Anthony Perard --- hw/xen/xen-bus.c | 79 ++++++++++++++++++++-------------------- include/hw/xen/xen-bus.h | 6 +-- 2 files changed, 42 insertions(+), 43 deletions(-) diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index 49a725e8c7..9e391492ac 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -923,19 +923,22 @@ done: } =20 struct XenEventChannel { + QLIST_ENTRY(XenEventChannel) list; + xenevtchn_handle *xeh; evtchn_port_t local_port; XenEventHandler handler; void *opaque; - Notifier notifier; }; =20 -static void event_notify(Notifier *n, void *data) +static void xen_device_event(void *opaque) { - XenEventChannel *channel =3D container_of(n, XenEventChannel, notifier= ); - unsigned long port =3D (unsigned long)data; + XenEventChannel *channel =3D opaque; + unsigned long port =3D xenevtchn_pending(channel->xeh); =20 if (port =3D=3D channel->local_port) { channel->handler(channel->opaque); + + xenevtchn_unmask(channel->xeh, port); } } =20 @@ -947,24 +950,39 @@ XenEventChannel *xen_device_bind_event_channel(XenDev= ice *xendev, XenEventChannel *channel =3D g_new0(XenEventChannel, 1); xenevtchn_port_or_error_t local_port; =20 - local_port =3D xenevtchn_bind_interdomain(xendev->xeh, + channel->xeh =3D xenevtchn_open(NULL, 0); + if (!channel->xeh) { + error_setg_errno(errp, errno, "failed xenevtchn_open"); + goto fail; + } + + local_port =3D xenevtchn_bind_interdomain(channel->xeh, xendev->frontend_id, port); if (local_port < 0) { error_setg_errno(errp, errno, "xenevtchn_bind_interdomain failed"); - - g_free(channel); - return NULL; + goto fail; } =20 channel->local_port =3D local_port; channel->handler =3D handler; channel->opaque =3D opaque; - channel->notifier.notify =3D event_notify; =20 - notifier_list_add(&xendev->event_notifiers, &channel->notifier); + qemu_set_fd_handler(xenevtchn_fd(channel->xeh), xen_device_event, NULL, + channel); + + QLIST_INSERT_HEAD(&xendev->event_channels, channel, list); =20 return channel; + +fail: + if (channel->xeh) { + xenevtchn_close(channel->xeh); + } + + g_free(channel); + + return NULL; } =20 void xen_device_notify_event_channel(XenDevice *xendev, @@ -976,7 +994,7 @@ void xen_device_notify_event_channel(XenDevice *xendev, return; } =20 - if (xenevtchn_notify(xendev->xeh, channel->local_port) < 0) { + if (xenevtchn_notify(channel->xeh, channel->local_port) < 0) { error_setg_errno(errp, errno, "xenevtchn_notify failed"); } } @@ -990,12 +1008,15 @@ void xen_device_unbind_event_channel(XenDevice *xend= ev, return; } =20 - notifier_remove(&channel->notifier); + QLIST_REMOVE(channel, list); =20 - if (xenevtchn_unbind(xendev->xeh, channel->local_port) < 0) { + qemu_set_fd_handler(xenevtchn_fd(channel->xeh), NULL, NULL, NULL); + + if (xenevtchn_unbind(channel->xeh, channel->local_port) < 0) { error_setg_errno(errp, errno, "xenevtchn_unbind failed"); } =20 + xenevtchn_close(channel->xeh); g_free(channel); } =20 @@ -1004,6 +1025,7 @@ static void xen_device_unrealize(DeviceState *dev, Er= ror **errp) XenDevice *xendev =3D XEN_DEVICE(dev); XenDeviceClass *xendev_class =3D XEN_DEVICE_GET_CLASS(xendev); const char *type =3D object_get_typename(OBJECT(xendev)); + XenEventChannel *channel, *next; =20 if (!xendev->name) { return; @@ -1020,15 +1042,14 @@ static void xen_device_unrealize(DeviceState *dev, = Error **errp) xendev_class->unrealize(xendev, errp); } =20 + /* Make sure all event channels are cleaned up */ + QLIST_FOREACH_SAFE(channel, &xendev->event_channels, list, next) { + xen_device_unbind_event_channel(xendev, channel, NULL); + } + xen_device_frontend_destroy(xendev); xen_device_backend_destroy(xendev); =20 - if (xendev->xeh) { - qemu_set_fd_handler(xenevtchn_fd(xendev->xeh), NULL, NULL, NULL); - xenevtchn_close(xendev->xeh); - xendev->xeh =3D NULL; - } - if (xendev->xgth) { xengnttab_close(xendev->xgth); xendev->xgth =3D NULL; @@ -1045,16 +1066,6 @@ static void xen_device_exit(Notifier *n, void *data) xen_device_unrealize(DEVICE(xendev), &error_abort); } =20 -static void xen_device_event(void *opaque) -{ - XenDevice *xendev =3D opaque; - unsigned long port =3D xenevtchn_pending(xendev->xeh); - - notifier_list_notify(&xendev->event_notifiers, (void *)port); - - xenevtchn_unmask(xendev->xeh, port); -} - static void xen_device_realize(DeviceState *dev, Error **errp) { XenDevice *xendev =3D XEN_DEVICE(dev); @@ -1095,16 +1106,6 @@ static void xen_device_realize(DeviceState *dev, Err= or **errp) xendev->feature_grant_copy =3D (xengnttab_grant_copy(xendev->xgth, 0, NULL) =3D=3D 0); =20 - xendev->xeh =3D xenevtchn_open(NULL, 0); - if (!xendev->xeh) { - error_setg_errno(errp, errno, "failed xenevtchn_open"); - goto unrealize; - } - - notifier_list_init(&xendev->event_notifiers); - qemu_set_fd_handler(xenevtchn_fd(xendev->xeh), xen_device_event, NULL, - xendev); - xen_device_backend_create(xendev, &local_err); if (local_err) { error_propagate(errp, local_err); diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h index 3183f10e3c..3315f0de20 100644 --- a/include/hw/xen/xen-bus.h +++ b/include/hw/xen/xen-bus.h @@ -15,6 +15,7 @@ typedef void (*XenWatchHandler)(void *opaque); =20 typedef struct XenWatch XenWatch; +typedef struct XenEventChannel XenEventChannel; =20 typedef struct XenDevice { DeviceState qdev; @@ -28,8 +29,7 @@ typedef struct XenDevice { XenWatch *backend_online_watch; xengnttab_handle *xgth; bool feature_grant_copy; - xenevtchn_handle *xeh; - NotifierList event_notifiers; + QLIST_HEAD(, XenEventChannel) event_channels; } XenDevice; =20 typedef char *(*XenDeviceGetName)(XenDevice *xendev, Error **errp); @@ -119,8 +119,6 @@ void xen_device_copy_grant_refs(XenDevice *xendev, bool= to_domain, XenDeviceGrantCopySegment segs[], unsigned int nr_segs, Error **errp); =20 -typedef struct XenEventChannel XenEventChannel; - typedef void (*XenEventHandler)(void *opaque); =20 XenEventChannel *xen_device_bind_event_channel(XenDevice *xendev, --=20 2.20.1.2.gb21ebb6 From nobody Fri May 3 23:07:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554736762076696.3722667628033; Mon, 8 Apr 2019 08:19:22 -0700 (PDT) Received: from localhost ([127.0.0.1]:54717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDW3K-0003xj-1z for importer@patchew.org; Mon, 08 Apr 2019 11:19:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDW1L-0002wV-1P for qemu-devel@nongnu.org; Mon, 08 Apr 2019 11:17:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDW1J-00024M-Sm for qemu-devel@nongnu.org; Mon, 08 Apr 2019 11:17:15 -0400 Received: from smtp03.citrix.com ([162.221.156.55]:43196) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hDW1A-00010C-0A; Mon, 08 Apr 2019 11:17:05 -0400 X-IronPort-AV: E=Sophos;i="5.60,325,1549929600"; d="scan'208";a="83016892" From: Paul Durrant To: , , Date: Mon, 8 Apr 2019 16:16:16 +0100 Message-ID: <20190408151617.13025-3-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb6 In-Reply-To: <20190408151617.13025-1-paul.durrant@citrix.com> References: <20190408151617.13025-1-paul.durrant@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 162.221.156.55 Subject: [Qemu-devel] [PATCH 2/3] xen-bus: allow AioContext to be specified for each event channel X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Stefano Stabellini , Max Reitz , Paul Durrant , Stefan Hajnoczi , Anthony Perard Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This patch adds an AioContext parameter to xen_device_bind_event_channel() and then uses aio_set_fd_handler() to set the callback rather than qemu_set_fd_handler(). Signed-off-by: Paul Durrant Reviewed-by: Anthony PERARD --- Cc: Stefano Stabellini Cc: Anthony Perard Cc: Stefan Hajnoczi Cc: Kevin Wolf Cc: Max Reitz --- hw/block/dataplane/xen-block.c | 2 +- hw/xen/xen-bus.c | 10 +++++++--- include/hw/xen/xen-bus.h | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/block/dataplane/xen-block.c b/hw/block/dataplane/xen-block.c index bb8f1186e4..1046f965c4 100644 --- a/hw/block/dataplane/xen-block.c +++ b/hw/block/dataplane/xen-block.c @@ -802,7 +802,7 @@ void xen_block_dataplane_start(XenBlockDataPlane *datap= lane, } =20 dataplane->event_channel =3D - xen_device_bind_event_channel(xendev, event_channel, + xen_device_bind_event_channel(xendev, dataplane->ctx, event_channe= l, xen_block_dataplane_event, dataplane, &local_err); if (local_err) { diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index 9e391492ac..4f634d1291 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -924,6 +924,7 @@ done: =20 struct XenEventChannel { QLIST_ENTRY(XenEventChannel) list; + AioContext *ctx; xenevtchn_handle *xeh; evtchn_port_t local_port; XenEventHandler handler; @@ -943,6 +944,7 @@ static void xen_device_event(void *opaque) } =20 XenEventChannel *xen_device_bind_event_channel(XenDevice *xendev, + AioContext *ctx, unsigned int port, XenEventHandler handler, void *opaque, Error **errp) @@ -968,8 +970,9 @@ XenEventChannel *xen_device_bind_event_channel(XenDevic= e *xendev, channel->handler =3D handler; channel->opaque =3D opaque; =20 - qemu_set_fd_handler(xenevtchn_fd(channel->xeh), xen_device_event, NULL, - channel); + channel->ctx =3D ctx; + aio_set_fd_handler(channel->ctx, xenevtchn_fd(channel->xeh), false, + xen_device_event, NULL, NULL, channel); =20 QLIST_INSERT_HEAD(&xendev->event_channels, channel, list); =20 @@ -1010,7 +1013,8 @@ void xen_device_unbind_event_channel(XenDevice *xende= v, =20 QLIST_REMOVE(channel, list); =20 - qemu_set_fd_handler(xenevtchn_fd(channel->xeh), NULL, NULL, NULL); + aio_set_fd_handler(channel->ctx, xenevtchn_fd(channel->xeh), false, + NULL, NULL, NULL, NULL); =20 if (xenevtchn_unbind(channel->xeh, channel->local_port) < 0) { error_setg_errno(errp, errno, "xenevtchn_unbind failed"); diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h index 3315f0de20..8183b98c7d 100644 --- a/include/hw/xen/xen-bus.h +++ b/include/hw/xen/xen-bus.h @@ -122,6 +122,7 @@ void xen_device_copy_grant_refs(XenDevice *xendev, bool= to_domain, typedef void (*XenEventHandler)(void *opaque); =20 XenEventChannel *xen_device_bind_event_channel(XenDevice *xendev, + AioContext *ctx, unsigned int port, XenEventHandler handler, void *opaque, Error **errp); --=20 2.20.1.2.gb21ebb6 From nobody Fri May 3 23:07:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554736782351887.836082174099; Mon, 8 Apr 2019 08:19:42 -0700 (PDT) Received: from localhost ([127.0.0.1]:54719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDW3Y-00048B-72 for importer@patchew.org; Mon, 08 Apr 2019 11:19:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDW1L-0002wX-5K for qemu-devel@nongnu.org; Mon, 08 Apr 2019 11:17:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDW1J-00024D-Rn for qemu-devel@nongnu.org; Mon, 08 Apr 2019 11:17:15 -0400 Received: from smtp03.citrix.com ([162.221.156.55]:43190) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hDW19-0000tN-A5; Mon, 08 Apr 2019 11:17:03 -0400 X-IronPort-AV: E=Sophos;i="5.60,325,1549929600"; d="scan'208";a="83016903" From: Paul Durrant To: , , Date: Mon, 8 Apr 2019 16:16:17 +0100 Message-ID: <20190408151617.13025-4-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb6 In-Reply-To: <20190408151617.13025-1-paul.durrant@citrix.com> References: <20190408151617.13025-1-paul.durrant@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 162.221.156.55 Subject: [Qemu-devel] [PATCH 3/3] xen-bus / xen-block: add support for event channel polling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Stefano Stabellini , Max Reitz , Paul Durrant , Stefan Hajnoczi , Anthony Perard Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Anthony PERARD --- Cc: Stefan Hajnoczi Cc: Stefano Stabellini Cc: Anthony Perard Cc: Kevin Wolf Cc: Max Reitz --- hw/block/dataplane/xen-block.c | 17 +++++++++-------- hw/xen/xen-bus.c | 11 +++++++++-- include/hw/xen/xen-bus.h | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/hw/block/dataplane/xen-block.c b/hw/block/dataplane/xen-block.c index 1046f965c4..908bd27bbd 100644 --- a/hw/block/dataplane/xen-block.c +++ b/hw/block/dataplane/xen-block.c @@ -317,7 +317,9 @@ static void xen_block_complete_aio(void *opaque, int re= t) } xen_block_release_request(request); =20 - qemu_bh_schedule(dataplane->bh); + if (dataplane->more_work) { + qemu_bh_schedule(dataplane->bh); + } =20 done: aio_context_release(dataplane->ctx); @@ -514,12 +516,13 @@ static int xen_block_get_request(XenBlockDataPlane *d= ataplane, */ #define IO_PLUG_THRESHOLD 1 =20 -static void xen_block_handle_requests(XenBlockDataPlane *dataplane) +static bool xen_block_handle_requests(XenBlockDataPlane *dataplane) { RING_IDX rc, rp; XenBlockRequest *request; int inflight_atstart =3D dataplane->requests_inflight; int batched =3D 0; + bool done_something =3D false; =20 dataplane->more_work =3D 0; =20 @@ -551,6 +554,7 @@ static void xen_block_handle_requests(XenBlockDataPlane= *dataplane) } xen_block_get_request(dataplane, request, rc); dataplane->rings.common.req_cons =3D ++rc; + done_something =3D true; =20 /* parse them */ if (xen_block_parse_request(request) !=3D 0) { @@ -602,10 +606,7 @@ static void xen_block_handle_requests(XenBlockDataPlan= e *dataplane) blk_io_unplug(dataplane->blk); } =20 - if (dataplane->more_work && - dataplane->requests_inflight < dataplane->max_requests) { - qemu_bh_schedule(dataplane->bh); - } + return done_something; } =20 static void xen_block_dataplane_bh(void *opaque) @@ -617,11 +618,11 @@ static void xen_block_dataplane_bh(void *opaque) aio_context_release(dataplane->ctx); } =20 -static void xen_block_dataplane_event(void *opaque) +static bool xen_block_dataplane_event(void *opaque) { XenBlockDataPlane *dataplane =3D opaque; =20 - qemu_bh_schedule(dataplane->bh); + return xen_block_handle_requests(dataplane); } =20 XenBlockDataPlane *xen_block_dataplane_create(XenDevice *xendev, diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index 4f634d1291..c90fc62a8d 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -931,13 +931,20 @@ struct XenEventChannel { void *opaque; }; =20 +static bool xen_device_poll(void *opaque) +{ + XenEventChannel *channel =3D opaque; + + return channel->handler(channel->opaque); +} + static void xen_device_event(void *opaque) { XenEventChannel *channel =3D opaque; unsigned long port =3D xenevtchn_pending(channel->xeh); =20 if (port =3D=3D channel->local_port) { - channel->handler(channel->opaque); + xen_device_poll(channel); =20 xenevtchn_unmask(channel->xeh, port); } @@ -972,7 +979,7 @@ XenEventChannel *xen_device_bind_event_channel(XenDevic= e *xendev, =20 channel->ctx =3D ctx; aio_set_fd_handler(channel->ctx, xenevtchn_fd(channel->xeh), false, - xen_device_event, NULL, NULL, channel); + xen_device_event, NULL, xen_device_poll, channel); =20 QLIST_INSERT_HEAD(&xendev->event_channels, channel, list); =20 diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h index 8183b98c7d..1c2d9dfdb8 100644 --- a/include/hw/xen/xen-bus.h +++ b/include/hw/xen/xen-bus.h @@ -119,7 +119,7 @@ void xen_device_copy_grant_refs(XenDevice *xendev, bool= to_domain, XenDeviceGrantCopySegment segs[], unsigned int nr_segs, Error **errp); =20 -typedef void (*XenEventHandler)(void *opaque); +typedef bool (*XenEventHandler)(void *opaque); =20 XenEventChannel *xen_device_bind_event_channel(XenDevice *xendev, AioContext *ctx, --=20 2.20.1.2.gb21ebb6