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

Re: [PATCH for-4.16 v4] gnttab: allow setting max version per-domain


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 2 Nov 2021 13:19:54 +0100
  • 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XtQpmfpgL7glnOJ5hgOnALk89dpsTVruCYd+W3wr5dU=; b=Iq8DXWM57r2lID0QDOT8XYS8a3U6rieavOz+yMU+OVsfgTwl/Gr1UNHLadxIRqEn6ECe5g9UaU+QToswTxUoARc1e1DIuIQ0em4mWGBYS6CBAxp7ks/QL4V4Vq0MwrFxvLdjhNNB+ByKc4EEbj0EJukjHBvpXNabS+ygt75vJMoeRdY3MHHe96X7IBtwPj4N4oMWDjZuIrmzDR8OSgBvG8Z6zvddZ4eiWJ2IsCEmi7lETy/wbO00Ygtydv7Vn4ZnVvJOwpqmWZLkWdINjjU308eeEGyXjyxpsk2qJuybC9cWBu1Xej2bS6syIcTIc7eHGbDzXwlJMMR2CBPt7P+JYg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lJsjj7X9nq15/vi4EFo9giKPgj8KvPkt86hpNSsSTZaTdaNDxtSv6MFPNEaQrekaviaBcfl4OnSbNm5AgQzfchxzSZONV2AbubYjHHPomCdsXfP+rX5d1C7uF/wEVdY006578Uz8ceKLzaOaQ8mFKDIsbKj0isvA1CdhVcM+57ZhA1f7ae3A18WX3mK/SrOHmtBoTaGi07Y4TNuNsru8bFDZtsCvkLdBbbpWTbYeFLgTlwOooIiQAooGgZSQsrtLJZZeCEQZHqqLRe0eD287dmnRvWf3x91u07M1nfab1YNMYvb0Vh/zjxgPYLy3Z0LdM5U02QDbRnsQ2U/o5vmlFQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Christian Lindig <christian.lindig@xxxxxxxxxx>, David Scott <dave@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 02 Nov 2021 12:20:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 29.10.2021 09:59, Roger Pau Monne wrote:
> @@ -1917,11 +1918,33 @@ active_alloc_failed:
>  }
>  
>  int grant_table_init(struct domain *d, int max_grant_frames,
> -                     int max_maptrack_frames)
> +                     int max_maptrack_frames, unsigned int options)
>  {
>      struct grant_table *gt;
> +    unsigned int max_grant_version = options & XEN_DOMCTL_GRANT_version_mask;
>      int ret = -ENOMEM;
>  
> +    if ( max_grant_version == XEN_DOMCTL_GRANT_version_default )
> +        max_grant_version = opt_gnttab_max_version;
> +    if ( !max_grant_version )
> +    {
> +        dprintk(XENLOG_INFO, "%pd: invalid grant table version 0 
> requested\n",
> +                d);
> +        return -EINVAL;
> +    }
> +    if ( max_grant_version > opt_gnttab_max_version )
> +    {
> +        dprintk(XENLOG_INFO,
> +                "%pd: requested grant version (%u) greater than supported 
> (%u)\n",
> +                d, max_grant_version, opt_gnttab_max_version);
> +        return -EINVAL;
> +    }
> +    if ( unlikely(max_page >= PFN_DOWN(TB(16))) && is_pv_domain(d) &&

This needs to be >, not >= - the variable's name is inaccurate wrt its
actual use. IOW in the proposed alternative code you'd need to check
(max_page - 1) >> 32 against zero.

Jan




 


Rackspace

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