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

Re: [Xen-devel] [Minios-devel] [PATCH RFC 04/16] Save/Restore Support: Add xenbus_release_wait_for_watch



Bruno Alvisio, on mar. 19 déc. 2017 15:41:59 -0800, wrote:
> xenbus_release_wait_for_watch generates a fake event to trigger make
> xenbus_wait_for_watch return. This is necessary to wake up waiting threads.

Please also document the release_xenbus_id change.

> Signed-off-by: Bruno Alvisio <bruno.alvisio@xxxxxxxxx>

Reviewed-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>

> ---
>  include/xenbus.h |  1 +
>  xenbus/xenbus.c  | 10 +++++++++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/include/xenbus.h b/include/xenbus.h
> index 12391b9..b2d5072 100644
> --- a/include/xenbus.h
> +++ b/include/xenbus.h
> @@ -42,6 +42,7 @@ char *xenbus_unwatch_path_token(xenbus_transaction_t xbt, 
> const char *path, cons
>  extern struct wait_queue_head xenbus_watch_queue;
>  void xenbus_wait_for_watch(xenbus_event_queue *queue);
>  char **xenbus_wait_for_watch_return(xenbus_event_queue *queue);
> +void xenbus_release_wait_for_watch(xenbus_event_queue *queue);
>  char* xenbus_wait_for_value(const char *path, const char *value, 
> xenbus_event_queue *queue);
>  char *xenbus_wait_for_state_change(const char* path, XenbusState *state, 
> xenbus_event_queue *queue);
>  char *xenbus_switch_state(xenbus_transaction_t xbt, const char* path, 
> XenbusState state);
> diff --git a/xenbus/xenbus.c b/xenbus/xenbus.c
> index 636786c..c2d2bd1 100644
> --- a/xenbus/xenbus.c
> +++ b/xenbus/xenbus.c
> @@ -129,6 +129,14 @@ void xenbus_wait_for_watch(xenbus_event_queue *queue)
>          printk("unexpected path returned by watch\n");
>  }
>  
> +void xenbus_release_wait_for_watch(xenbus_event_queue *queue)
> +{
> +    struct xenbus_event *event = malloc(sizeof(*event));
> +    event->next = *queue;
> +    *queue = event;
> +    wake_up(&xenbus_watch_queue);
> +}
> +
>  char* xenbus_wait_for_value(const char* path, const char* value, 
> xenbus_event_queue *queue)
>  {
>      if (!queue)
> @@ -318,7 +326,7 @@ static void release_xenbus_id(int id)
>      req_info[id].in_use = 0;
>      nr_live_reqs--;
>      req_info[id].in_use = 0;
> -    if (nr_live_reqs == NR_REQS - 1)
> +    if (nr_live_reqs == 0 || nr_live_reqs == NR_REQS - 1)
>          wake_up(&req_wq);
>      spin_unlock(&req_lock);
>  }
> -- 
> 2.3.2 (Apple Git-55)
> 
> 
> _______________________________________________
> Minios-devel mailing list
> Minios-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/mailman/listinfo/minios-devel

-- 
Samuel
"c'est pas nous qui sommes à la rue, c'est la rue qui est à nous"

_______________________________________________
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®.