[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 07/18] xen: add event channel interface for XenDevice-s



On Wed, Nov 21, 2018 at 03:12:00PM +0000, Paul Durrant wrote:
> The legacy PV backend infrastructure provides functions to bind, unbind
> and send notifications to event channnels. Similar functionality will be
> required by XenDevice implementations so this patch adds the necessary
> support.
> 
> Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
> ---
> +void xen_device_notify_event_channel(XenDevice *xendev,
> +                                     XenEventChannel *channel)
> +{
> +    xenevtchn_notify(xendev->xeh, channel->local_port);

Since xenevtchn_notify and xenevtchn_unbind below can fail, it will be
nice to check for error and grab the errno.

Users of xen_device_notify_event_channel could simply ignore the error,
or just print a warning/error and continue
(warn_report_err/error_report_err).

> +}
> +
> +void xen_device_unbind_event_channel(XenDevice *xendev,
> +                                     XenEventChannel *channel)
> +{
> +    notifier_remove(&channel->notifier);
> +
> +    xenevtchn_unbind(xendev->xeh, channel->local_port);
> +
> +    g_free(channel);
> +}
> +


> +static void xen_device_event(void *opaque)
> +{
> +    XenDevice *xendev = opaque;
> +    unsigned long port = xenevtchn_pending(xendev->xeh);
> +
> +    notifier_list_notify(&xendev->event_notifiers, (void *)port);

I wonder if a Notifier is a good fit for XenDevice, like here for the
events or the xenstore watches in previous patches, as NotifierLists are
normaly used when every Notifiers want to do something, but here there
is only one that is going to do something. But I guess it might not be
much better to write a loop in here rather than use the one in
notifier_list_notify.

> +
> +    xenevtchn_unmask(xendev->xeh, port);
> +}
> +

-- 
Anthony PERARD

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.