Re: [PATCH 3/6] xenbus: dispatch per-domU watch event to per-domU xenwatch thread

From: Boris Ostrovsky
Date: Mon Sep 17 2018 - 16:08:24 EST


On 9/14/18 3:34 AM, Dongli Zhang wrote:
>
> +static int xs_watch_insert_event(struct xs_watch_event *event, domid_t domid)
> +{
> + struct mtwatch_domain *domain;
> + int ret = -1;

-ENODEV maybe?

-boris

> +
> + rcu_read_lock();
> +
> + domain = mtwatch_find_domain(domid);
> + if (!domain) {
> + rcu_read_unlock();
> + return ret;
> + }
> +
> + spin_lock(&domain->events_lock);
> + if (domain->state == MTWATCH_DOMAIN_UP) {
> + list_add_tail(&event->list, &domain->events);
> + wake_up(&domain->events_wq);
> + ret = 0;
> + }
> + spin_unlock(&domain->events_lock);
> +
> + rcu_read_unlock();
> +
> + return ret;
> +}
> +
>