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

Re: [PATCH v2] tools/libs/guest: fix save and restore of pv domains after 32-bit de-support


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 7 Jun 2021 15:04:55 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=D4N64f9gsaOrT+9l+Ln3X7OWG+Nl2vmf2fgCMHzvfmY=; b=mBl5lpWs1GqP+BuwOZ8GFzLyhB3lxeq4DQrOt9l4NrR9yt7w7b5gVsBbtCiN1UoWojCbEh1bfug3bww6ZhI8oDUYG9LhC8ywT5Nt6saE3JsCby8z5zpVxYbGVCA6l1AQsjZuG1PWhWSNML8u339/fU6Swpo8crZhJrwRnL79GliqBBnBLryX++ZCV75G21cE+aEWNd4HJ249fh5U5BMlDxXP+M+BmgPCmpVP9QQAfY/RAI9VUrRNijmnzbVKb4ZTOa0z9zK4Fge/QaI1WcTZGIw+88VITFZTckhOiAgsxUOXtugto/UYVvjNHGjAzErJ4V5mlG+jVBn4bR0e1sAPtA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hz1Lk9Z6TFYcc6j+a5ti3GlZyUTJPPdCex22m7ltiE6byNJJr2hSTeHSyFdrS6r3YSfXMwicyVS4CmIRN8CJnMMPFOPung+JzYx9yy+d7XwLSKPNNpHJHOWynooKuucnE3sIB1RGif8xwhpyaaXANrg0bBWmF3WcqQHUaA8kCmy5MaLSV2GYcTafzcy6m+g0CB0SRg7nrjRTKFy49IQMhMHs9AdEEjtP+8RMcYnIJ4jC64v3S34wXOHnA7zdKg5U8Za9PIrQ54UmbgHHx/Acp1FaTfUbYn1LTaKjEosYSbXWqY9yhC4/p4HYAAVQp7uOd60cFGu9vtnXlWWC2fDgYQ==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 07 Jun 2021 13:05:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 07.06.2021 15:00, Juergen Gross wrote:
> --- a/tools/libs/guest/xg_sr_common_x86_pv.c
> +++ b/tools/libs/guest/xg_sr_common_x86_pv.c
> @@ -149,27 +149,32 @@ int x86_pv_map_m2p(struct xc_sr_context *ctx)
>  
>      ctx->x86.pv.nr_m2p_frames = (M2P_CHUNK_SIZE >> PAGE_SHIFT) * m2p_chunks;
>  
> +    if ( ctx->x86.pv.levels == 3 )
> +    {

With this opening brace you no longer need ...

>  #ifdef __i386__
> -    /* 32 bit toolstacks automatically get the compat m2p */
> -    ctx->x86.pv.compat_m2p_mfn0 = entries[0].mfn;
> +        /* 32 bit toolstacks automatically get the compat m2p */
> +        ctx->x86.pv.compat_m2p_mfn0 = entries[0].mfn;
>  #else
> -    /* 64 bit toolstacks need to ask Xen specially for it */
> -    {

... this one, and hence you could avoid re-indenting ...

> -        struct xen_machphys_mfn_list xmml = {
> -            .max_extents = 1,
> -            .extent_start = { &ctx->x86.pv.compat_m2p_mfn0 },
> -        };
> -
> -        rc = do_memory_op(xch, XENMEM_machphys_compat_mfn_list,
> -                          &xmml, sizeof(xmml));
> -        if ( rc || xmml.nr_extents != 1 )
> +        /* 64 bit toolstacks need to ask Xen specially for it */
>          {
> -            PERROR("Failed to get compat mfn list from Xen");
> -            rc = -1;
> -            goto err;
> +            struct xen_machphys_mfn_list xmml = {
> +                .max_extents = 1,
> +                .extent_start = { &ctx->x86.pv.compat_m2p_mfn0 },
> +            };
> +
> +            rc = do_memory_op(xch, XENMEM_machphys_compat_mfn_list,
> +                              &xmml, sizeof(xmml));
> +            if ( rc || xmml.nr_extents != 1 )
> +            {
> +                PERROR("Failed to get compat mfn list from Xen");
> +                rc = -1;
> +                goto err;
> +            }

... all of this. Preferably with such reduced code churn,
still/again:
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan




 


Rackspace

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