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

Re: [PATCH 14/21] libs/guest: introduce helper to check cpu policy compatibility


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 31 Mar 2021 14:40:46 +0200
  • 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=r3jKF5UtqvNsukXx9qzN4zUUHNJt1+ocQm6kZ7n3yQw=; b=HGQXPMdGe7i8yvpT471GFcqms2qxTfuGwv4DKXXHJ//cx7gwrMFBx/iprx6tuY0LN1130awHvtgS61RSNa1pJnYMH51MwlMnD6WdJ1rTf48nL5LZYUJI7GMN5REBEgdFR2bJ2RHc9kj3hQws0+mH8zVzG5bOUGKPu4G6KIIx+DiQiCouNgwXE95GL9EhEEbh9lothAODGrD9W+3Rg1Z223OYAUgQ7BZwvax3y7awvy0GCpa17DtEyseW7taPK2yP3aGjIeoif9pjZjAr78OzsIaN14eSMszdEOqiNKuZmvcfp31PJbk2VZmzdzKYk5n/0v5J144dzL7rnuMfutM0+g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CJdSmOwMrEAEeJefgfKC32UfBtTSHOAeKDI9IuNTztc5w8AFlXQ6cyRU49iijapj/pgpIaILunY9Tij3KhiMxTsmxbtBFn6dcgnZVboUc0dG1wz1ZxMkcVOwjPOXqW0crqGQdRcFgqpSuPAAPuiNH+BJoU5OLqFtSrY+cgvQkJ6ybFI+dC1SPG3r7lW/dtwi3w160pCHfd9ii3Miav4y6G9MknuwwYLxwgjl49h63sRSKaMPxYTzGh4P3nFMfsJ+Irkjd3UrBlrPuOmcZ3yWFDQS9agYVHFUi3I2HlaAk3hJ+H3PY7pxT2s7L4mvtWfWi53rqKyruoHCmQrVOs0RmQ==
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 31 Mar 2021 12:41:09 +0000
  • Ironport-hdrordr: A9a23:vJpWcKAyCcUC0nXlHeiusceALOonbusQ8zAX/mh6QxBNb4i8n8 ehgPwU2XbP+VEscVk9hNGNP7SBS3vA9ZhzpbIcJ6umQROOggCVBatJhLGM/xTLHSri+ulBkY JpdKZjANP9ZGIK6/rSyg++Dtom3Z274Lml7N2utEtFYAl2Z8hbnmREIymBFEkefmR7LLo/UK GR/89W4wenEE5nCviTJmICWNHEvMCOrr/cCCRtOzcCyC2jyQyl86T7FR/w5GZlbxpqza05+W bI1yzVj5/T0c2T8RPX22/N45k+orKI9vJ5CMOBkcQTIDn34zzYAbhJYaGIvzw+vYiUhmoCrd jWrx8se+R15n/BF1vUnTLR2hLt2Dtr1nn6yVXwuxreiPH+LQhXN+NxwaZiNjrQ8Q4Jocx12q Mj5RPhi7NnSTf72Bnby/eNfRdwjUawqWclioco/gRieLpbUYYUlJcY9k9YCo0NEUvBmf0aLN U=
  • Ironport-sdr: Wu05XjAmR21AP2/1oGk25oWh0v8R/kcTJo3lZDqnMiRvanMp/6+5gU/uIHNpeop3fQRy8LD77P +34Zjsb0ZiqO+/trdoRjRoKcaVbOBKNuVqUNsPV4bqsSStvn+30YFZzDnBkg79Hi51MJlRCXCP Ynx37DrnKRzT7RM6vhpmURt+13iVFz7C3mqNjz1U7vnIt8dqr/qY7ZXoW35yniIR7YrjcHv1V6 WQ9p4543gPHaT3UL7SKWZZ5GsepTGLTtjr0cgXTF1wxef1oFhXBy+bRNvDsFXgfC34sKfxCszg Yq4=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Mar 30, 2021 at 06:02:45PM +0200, Jan Beulich wrote:
> On 23.03.2021 10:58, Roger Pau Monne wrote:
> > --- a/tools/libs/guest/xg_cpuid_x86.c
> > +++ b/tools/libs/guest/xg_cpuid_x86.c
> > @@ -1098,3 +1098,20 @@ int xc_cpu_policy_update_msrs(xc_interface *xch, 
> > xc_cpu_policy_t policy,
> >      return rc;
> >  
> >  }
> > +
> > +bool xc_cpu_policy_is_compatible(xc_interface *xch, const xc_cpu_policy_t 
> > p1,
> > +                                 const xc_cpu_policy_t p2)
> > +{
> > +    struct cpu_policy_errors err;
> 
> Don't you need an initializer here for ...
> 
> > +    int rc = x86_cpu_policies_are_compatible(p1, p2, &err);
> > +
> > +    if ( !rc )
> > +        return true;
> > +
> > +    if ( err.leaf != -1 )
> > +        ERROR("Leaf %#x subleaf %#x is not compatible", err.leaf, 
> > err.subleaf);
> > +    if ( err.msr != -1 )
> > +        ERROR("MSR index %#x is not compatible", err.msr);
> 
> ... these checks to have a chance of actually triggering? (I'm also
> not certain -1 is a good indicator, but I guess we have been using it
> elsewhere as well.)

Well, this is strictly the error path, at which point I would expect
err to be properly set by x86_cpu_policies_are_compatible. I can
however initialize err for safety here.

Thanks, Roger.



 


Rackspace

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