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

Re: [PATCH v10 11/11] tools/libs/guest: add code to save a v4 libxc stream


  • To: Paul Durrant <paul@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 25 Jan 2021 20:11:14 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=o3aTW/cWdMDeEuEvEeRXox+NDApZM8Ob+7EMV5s4Nxo=; b=dhhy2uN9o72d+XIFOxdcm2eg9/9gjrjLKQ7AX6sFPAvQi5BpjUYhipICL9Gfe8gD+xquLBUvgl1rnX2GEAZ7Lv6mqs+VBjGzZ8MZew3IkPPucrEp/wSZMDqzOSY60GEdSNVhYM4Pd3TNJdk7DCc4gNj7JzXJGJEQA2L1R46DF2atg8c4EJ59obtcVAZxysTrqQ4t6b69ek8qfhAV5dxH9GU2FzCpjRWM5ujN+wCOLOg+wSM1JqFtBqV/XkDmZLYG0VPptYwV4qosDDaYnzdUNEr7nYaY/vhM+ssfdkoG9FFZwQj7JK8dFbcB/627dP8nbK6WdH1a2JTJferOnJ7xVg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cn/s//eCgWVfYKg/F8IN9wrCceD3LDFnJSWrVoq6y4R3EvypSsLLIxlFzszNWvbbPQUAk0p/ZN5WnWNxPI03tX5poj/CQQTmsSeWvzfYbyzxvChDEoZcFytVKaCjbCtV7F7XiMTlZIuKEFSI1vmTmaPpZOVp0EfQRNUprE9GCdO7YiCJ7+gdt5JHhcoMGN0J4CX+EQWFFDSpFRZzhJrosafzua9nSXJ/F+bu6+feDPiCUWlMYpo8atlCi9oecrfmZVLfhd5vrBLXvA171itXJK6jYD5jkqTcYQKfwJnjBSRYDslYybDl0m2LzculsaTXVv5V6IZ3ZDKQjs6B/NrzMQ==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Paul Durrant <pdurrant@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, "Wei Liu" <wl@xxxxxxx>
  • Delivery-date: Mon, 25 Jan 2021 20:11:27 +0000
  • Ironport-sdr: NYbG5SrQEPopSlDh/LC3hjppHDNyVRAbVWbQYLdoSqLxLZWZJxaQTLz3Gzk5k17QbELX6UDHVP JY1ueLVWA5dELj0Ry24IA9lDfD3MbWSsmcqSullbNH3PiSTLIXZRm3PAuBWbeCXbx4GuAxNzxr oFtdoEEPvagKT+utoWdVGZAIJ3EtDNDpMDN6NHuiUQZ20Z1zxyRUmfWk/gSieVas+FD7HL9iee dzqe+CXX73etC9wJMh+mTSP5w2u6P/pDIcd8ssvpbncpG5Hhc8fQxVy4EsIuu9yOrTja94cDZt JEU=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 08/10/2020 19:57, Paul Durrant wrote:
> From: Paul Durrant <pdurrant@xxxxxxxxxx>
>
> This patch adds the necessary code to save a REC_TYPE_DOMAIN_CONTEXT record,
> and stop saving the now obsolete REC_TYPE_SHARED_INFO and REC_TYPE_TSC_INFO
> records for PV guests.
>
> Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>

Looks broadly ok.

> diff --git a/tools/libs/guest/xg_sr_common_x86.h 
> b/tools/libs/guest/xg_sr_common_x86.h
> index b55758c96d..e504169705 100644
> --- a/tools/libs/guest/xg_sr_common_x86.h
> +++ b/tools/libs/guest/xg_sr_common_x86.h
> @@ -44,6 +44,52 @@ static int write_headers(struct xc_sr_context *ctx, 
> uint16_t guest_type)
>      return 0;
>  }
>  
> +/*
> + * Writes a DOMAIN_CONTEXT record into the stream.
> + */
> +static int write_domain_context_record(struct xc_sr_context *ctx)
> +{
> +    xc_interface *xch = ctx->xch;
> +    struct xc_sr_record rec = {
> +        .type = REC_TYPE_DOMAIN_CONTEXT,
> +    };
> +    size_t len = 0;
> +    int rc;
> +
> +    rc = xc_domain_get_context(xch, ctx->domid, NULL, &len);
> +    if ( rc < 0 )
> +    {
> +        PERROR("can't get record length for dom %u\n", ctx->domid);
> +        goto out;
> +    }
> +
> +    rec.data = malloc(len);
> +
> +    rc = -1;
> +    if ( !rec.data )
> +    {
> +        PERROR("can't allocate %lu bytes\n", len);

%zu, because not all versions of C have size_t the same as unsigned long.

> +        goto out;
> +    }
> +
> +    rc = xc_domain_get_context(xch, ctx->domid, rec.data, &len);
> +    if ( rc < 0 )
> +    {
> +        PERROR("can't get domain record for dom %u\n", ctx->domid);

"domain context", and above.

> diff --git a/tools/libs/guest/xg_sr_save_x86_pv.c 
> b/tools/libs/guest/xg_sr_save_x86_pv.c
> index 4964f1f7b8..3de7b19f54 100644
> --- a/tools/libs/guest/xg_sr_save_x86_pv.c
> +++ b/tools/libs/guest/xg_sr_save_x86_pv.c
> @@ -849,20 +849,6 @@ static int write_x86_pv_p2m_frames(struct xc_sr_context 
> *ctx)
>      return rc;
>  }
>  
> -/*
> - * Writes an SHARED_INFO record into the stream.
> - */
> -static int write_shared_info(struct xc_sr_context *ctx)
> -{
> -    struct xc_sr_record rec = {
> -        .type = REC_TYPE_SHARED_INFO,
> -        .length = PAGE_SIZE,
> -        .data = ctx->x86.pv.shinfo,
> -    };
> -
> -    return write_record(ctx, &rec);
> -}

This change also wants to strip out ctx->x86.pv.shinfo, and the mapping
logic.

~Andrew



 


Rackspace

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