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

Re: [PATCH 09/10] tools/xenstored: Dump delayed requests


  • To: Julien Grall <julien@xxxxxxx>
  • From: Luca Fancellu <luca.fancellu@xxxxxxx>
  • Date: Mon, 21 Jun 2021 10:27:00 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YVXEi4qfK31avwtbIbY3UEhmsYdI5IEqgtLALzzYuvc=; b=RDg4wHW8ChmoVjZpDm0+mSmQK0bY98vlkjsBw/9xoAHiGXw3X4z5+1+JOsGTbXq0vQROiu9NrLLmHYHUkkgq3uP/wGBkcZ8iBnkEn9PqDtPXFKP9/SdXuWgzHyXQipereuSlhu9D4zCjrDsH1CsDCbjosgEdKV2B+GC9ZG3a1LAEFddikPoQSFve86FPGkDdfoLJVcbSK77ik5ehkhe15A2GXWYDD03P/LasFgyJIBx/d9v4/PxoDutMV1jo6h6ugDm/+CZ+/EHCAi62nmRwx9zkcLEO10gZqhPPZHawQTdaGjLGPbtWA/7Qsn/qS0ASxENcvU1G+FDVGAjGmL7oCA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FWHM2ByYQ1wgtDt3jCZKLPXxE/G9Lv/sqZys2bdSMDEY1CUx5nNgCUN7ncguU7XAtrvZv8+KkaAlL81HW+WRtNvidEJq6zrVopQxmvXASUediBeO7g4aKFoa6MS7bL2sXJJp3vlGFg9W3vQ41m8FzVpBzxJ1Cwfn+mSrjUxBQL+pZ5zqVnEG5CADRA2B1PCPjtGR7UzX+ZZ4c48na8A3eYtGeX4A7f4lFR0W8fyKMDTlNWeBPG0VDplFnKk2H/6okD/S4o2UEo4lG/sHNbl38S3cVrQ7GZmY9tSdy8SSbQPCk75tkKC4LFQoorge8JYxdUHzJ3O8wBdDfmEqfv/NYA==
  • Authentication-results-original: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, raphning@xxxxxxxxxxxx, doebel@xxxxxxxxx, Julien Grall <jgrall@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Mon, 21 Jun 2021 09:27:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;


> On 16 Jun 2021, at 15:43, Julien Grall <julien@xxxxxxx> wrote:
> 
> From: Julien Grall <jgrall@xxxxxxxxxx>
> 
> Currently, only Live-Update request can be delayed. In a follow-up,
> we will want to delay more requests (e.g. transaction start).
> Therefore we want to preserve delayed requests across Live-Update.
> 
> Delayed requests are just complete "in" buffer. So the code is
> refactored to allow sharing the code to dump "in" buffer.
> 
> Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>

Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx>

> ---
> tools/xenstore/xenstored_core.c | 42 +++++++++++++++++++++++++--------
> 1 file changed, 32 insertions(+), 10 deletions(-)
> 
> diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
> index 5b7ab7f74013..9eca58682b51 100644
> --- a/tools/xenstore/xenstored_core.c
> +++ b/tools/xenstore/xenstored_core.c
> @@ -2403,25 +2403,47 @@ const char *dump_state_global(FILE *fp)
>       return NULL;
> }
> 
> +static const char *dump_input_buffered_data(FILE *fp,
> +                                         const struct buffered_data *in,
> +                                         unsigned int *total_len)
> +{
> +     unsigned int hlen = in->inhdr ? in->used : sizeof(in->hdr);
> +
> +     *total_len += hlen;
> +     if (fp && fwrite(&in->hdr, hlen, 1, fp) != 1)
> +             return "Dump read data error";
> +     if (!in->inhdr && in->used) {
> +             *total_len += in->used;
> +             if (fp && fwrite(in->buffer, in->used, 1, fp) != 1)
> +                     return "Dump read data error";
> +     }
> +
> +     return NULL;
> +}
> +
> /* Called twice: first with fp == NULL to get length, then for writing data. 
> */
> const char *dump_state_buffered_data(FILE *fp, const struct connection *c,
>                                    struct xs_state_connection *sc)
> {
>       unsigned int len = 0, used;
> -     struct buffered_data *out, *in = c->in;
> +     struct buffered_data *out;
>       bool partial = true;
> +     struct delayed_request *req;
> +     const char *ret;
> 
> -     if (in) {
> -             len = in->inhdr ? in->used : sizeof(in->hdr);
> -             if (fp && fwrite(&in->hdr, len, 1, fp) != 1)
> -                     return "Dump read data error";
> -             if (!in->inhdr && in->used) {
> -                     len += in->used;
> -                     if (fp && fwrite(in->buffer, in->used, 1, fp) != 1)
> -                             return "Dump read data error";
> -             }
> +     /* Dump any command that was delayed */
> +     list_for_each_entry(req, &c->delayed, list) {
> +             if (req->func != process_delayed_message)
> +                     continue;
> +
> +             assert(!req->in->inhdr);
> +             if ((ret = dump_input_buffered_data(fp, req->in, &len)))
> +                     return ret;
>       }
> 
> +     if (c->in && (ret = dump_input_buffered_data(fp, c->in, &len)))
> +             return ret;
> +
>       if (sc) {
>               sc->data_in_len = len;
>               sc->data_resp_len = 0;
> -- 
> 2.17.1
> 
> 




 


Rackspace

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