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

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


  • To: Paul Durrant <paul@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 25 Jan 2021 20:04:41 +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=4fcBiQGC406WOnOmzhwlnSF0p3wwtTyzlFjtiqYcW9k=; b=ZhQ3sBhsqS3mHDAADR34Skoz+ZKH6Teqz039/x5rPJRZqOrn4sWviGkhjgpbAxhWMEWvtM/Fe97pBqtFu0aV+fN10ZeY6jLgiw6T8lmphBtlYEJmFcV2Y5ukYKL0+YVhj5rnHQFH7aeMgSIFVKjVTILzjVrCp2R53ibXzP3DGW3pimH/XXx04gM2SK9jVvXPLd+8HkaqRM9r4FEXpufslkzr1WlDC4j7be6R8K3BMvKhbKf5IKmKDGYdsHRPnFtYqCBMfABgdTCfqm6fcgb0NCcQQWJ+QarQmumNa97t3o2h1DDIuxc6P1g4t/MLafYqcciFbOaIhpOA9ZgtsMErug==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nCwOBeLzstRZPicbiZOEJ8k3NZMqxXdwJpwdLJT0uZJWZdvdBEImlUj/jKPZISblAv5rqOeldwQ0mzD78WPbPrrCyDQ1tOOPQT3zgW9ydNTPzmk8uNM33wyDNRwc+bhP1a4s75qfAAdeFuzDXNnRqhhYRhAZkXHneOp4J3MSNeYnpTFyPl+486Oqx+MQFvWUlLt4+s07DV1nBCKQtJUOVTVHvTWDbIEPXOaA7wBNpKf/fx1LsavTxYR2qi5bNnRFh00eOvDmlg1CQMlGGmufeLnFENRruCxGzCAiOkhNBCKtBp2G01HGkh2AJ3JR2MqKCeOIene2IkEBMsB6/kqS9g==
  • Authentication-results: esa5.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:05:00 +0000
  • Ironport-sdr: KOxj1gjePNzZ+0eylbj3b2EyNp6oC/o+6pWghljGPB5l8nGnW6G7gLPNtbpzwM8BPs4YZoioGU Xph/yD640K5OarGnnvqRabGpV7dt/yuDQDg0UNKYCeUjTutQ07/fvbElti5bJqXysX3cFQTk89 N4eWIdu7L2IPaxbeDbL+dD29hVET3CjEch0oFBWOlEBI/8ObbJbVe/Om6/S1X5iwUn9hixn2Wa APuRlgtl/faiJY/UABmLrJYurE86fJj/xy3vRrdu7nC+k2sjeqAPvApCQDmoN5TB7u1xMAwapU zm8=
  • 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 accept a v4 stream, and to recognise and
> restore a REC_TYPE_DOMAIN_CONTEXT record.
>
> Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>

Somewhere within this needs to be logic to reject the forbidden records
in relevant stream versions.

> diff --git a/tools/libs/guest/xg_sr_restore_x86_hvm.c 
> b/tools/libs/guest/xg_sr_restore_x86_hvm.c
> index d6ea6f3012..6bb164b9f0 100644
> --- a/tools/libs/guest/xg_sr_restore_x86_hvm.c
> +++ b/tools/libs/guest/xg_sr_restore_x86_hvm.c
> @@ -225,6 +225,15 @@ static int x86_hvm_stream_complete(struct xc_sr_context 
> *ctx)
>          return rc;
>      }
>  
> +    rc = xc_domain_set_context(xch, ctx->domid,
> +                               ctx->restore.dom_ctx.ptr,
> +                               ctx->restore.dom_ctx.size);
> +    if ( rc )
> +    {
> +        PERROR("Unable to restore Domain context");
> +        return rc;
> +    }

This doesn't match where you specified the record to live in the stream,
and in particular is reordered WRT HVMCONTEXT restoration.

Also, it appears to be in the middle of a block of code which needs to
become `if ( guest-aware )`.

> +
>      rc = xc_dom_gnttab_seed(xch, ctx->domid, true,
>                              ctx->restore.console_gfn,
>                              ctx->restore.xenstore_gfn,
> diff --git a/tools/libs/guest/xg_sr_restore_x86_pv.c 
> b/tools/libs/guest/xg_sr_restore_x86_pv.c
> index dc50b0f5a8..2dafad7b83 100644
> --- a/tools/libs/guest/xg_sr_restore_x86_pv.c
> +++ b/tools/libs/guest/xg_sr_restore_x86_pv.c
> @@ -1134,6 +1134,15 @@ static int x86_pv_stream_complete(struct xc_sr_context 
> *ctx)
>      if ( rc )
>          return rc;
>  
> +    rc = xc_domain_set_context(xch, ctx->domid,
> +                               ctx->restore.dom_ctx.ptr,
> +                               ctx->restore.dom_ctx.size);
> +    if ( rc )
> +    {
> +        PERROR("Unable to restore Domain context");
> +        return rc;
> +    }

Similar comment as HVM for the reordering.  PV guests in particular tend
to be far more sensitive to the restoration order.

~Andrew



 


Rackspace

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