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

Re: [PATCH] libs/light: use the cpuid feature names from cpufeatureset.h


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Tue, 13 Jun 2023 15:26:45 +0100
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Tue, 13 Jun 2023 14:27:12 +0000
  • Ironport-data: A9a23:fwm86K9FGzDhuJc11YztDrUDk36TJUtcMsCJ2f8bNWPcYEJGY0x3y mAXUG7QOf+OMWDzLo9+Odji9EwE7ZfRzN5nTANlriA8E34SpcT7XtnIdU2Y0wF+jCHgZBk+s 5hBMImowOQcFCK0SsKFa+C5xZVE/fjUAOG6UKicYXoZqTZMEE8JkQhkl/MynrlmiN24BxLlk d7pqojUNUTNNwRcawr40Ird7ks31BjOkGlA5AdmO6kQ5Aa2e0Q9V/rzG4ngdxMUfaEMdgKKb 76r5K20+Grf4yAsBruN+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+v9T2M4nQVVWk120c+VZk 72hg3ASpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn9IBDJyCAWlvVbD09NqbDklq1 fomcDAGbSmIqO+MxYrhFNdC3tg8eZyD0IM34hmMzBncBPciB5vCX7/L9ZlT2zJYasJmRKiEI ZBDMHw2MUqGOkcUUrsUIMtWcOOAj3/jczpeuRSNqLA++WT7xw1tyrn9dtHSf7RmQO0Mxx/J+ j+brz+R7hcyPfCYzmaa/FWWvsDVtBnhfrwNNJDi+as/6LGU7jNKU0BHPbehmtGph0j7V99BJ kg8/is1sbN05EGtVsP6XRCzvDiDpBF0c8VUO/037keK0KW8ywSWHG8fVRZadccr8sQxQFQC3 0eEhdrzCRRzsbeeTjSW8bL8kN+pEXFLdylYP3ZCFFZbpYC5++nfky4jUP5HMKiL1t3+Ggj77 D2wqRBk2Ys91dIUgvDTEU/8v968mnTYZldrtluJBD79sV8RiJ2NPNLxtwWChRpUBMPAFwTa4 iBZ8ySLxLpWZaxhghBhVwnk8FuBw/+eeAPRjld0d3XK32T8oiXzFWy8DdwXGauIDirnUWWzC KMrkVkNjKK/xVPzBUONX6q/Ct4x0Y/rHsn/W/bfY7JmO8YhKlLWoH41NBLAhggBdXTAd4llY f93lu72VB4n5VlPlmLqF4/xL5d2rszB+Y8jbc+ilEn2uVZvTHWUVa0EIDOzghMRtcu5TPHu2 48HbaOikkwPONASlwGLqeb/23hWdylkbX03wuQLHtO+zv1OQjB5UKKMme95J+SIXc19z4/1w 510YWcAoHKXuJENAV7ihqxLAF83YatCkA==
  • Ironport-hdrordr: A9a23:4IVbNK1SKjDgm0fF+UfRgQqjBU5yeYIsimQD101hICG9Lfb3qy n+ppsmPEHP5Ar5AEtQ/+xoS5PwOE80lKQFlbX5Uo3SODUO1FHIEGgA1/qU/9SDIVyYygc178 4JGZSWYOeAQmSS5vyKgzVQZuxQpeVvh5rY59s2oU0MceniAJsK0+/2YjzrU3GfG2J9aKYRJd 653I5qtjCgcXMYYoCQHX8eRdXOoNXNidbPfQMGLwRP0nj5sRqYrJrBVzSI1BYXVD1ChZ0493 LergD/7qK/99mm1x7n0XPJ5Zg+oqqp9jIDPr3FtiEmEESntu+aXvUtZ1S2hkF/nAjg0idnrD CGmWZZAy060QKrQogem2qi5+Co6kdV11byjVCfmnftusr/WXYzDNdAn5tQdl/D51Mnp8wU6t M544u1jesnMfr7plWM2/HYExVx0kakq3srluAey3RZTIsFcbdU6YgS5llcHpsMFD/zrNlPKp gaMOjMoPJNNV+KZXHQuWdihNSqQ3QoBx+DBkwPoNac3TRalG1wi0EY2MsclHEd849Vceg32w 0FCNUXqFhjdL5oUUsmPpZ9fSKeMB2wfS7x
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Jun 13, 2023 at 01:01:47PM +0200, Roger Pau Monné wrote:
> On Tue, Jun 13, 2023 at 11:44:51AM +0100, Anthony PERARD wrote:
> > On Mon, Jun 05, 2023 at 12:36:57PM +0200, Roger Pau Monne wrote:
> > > diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
> > > index 24ac92718288..c5c5b8716521 100644
> > > --- a/docs/man/xl.cfg.5.pod.in
> > > +++ b/docs/man/xl.cfg.5.pod.in
> > > @@ -2010,24 +2010,12 @@ proccount procpkg stepping
> > >  
> > >  =back
> > >  
> > > -List of keys taking a character:
> > > +List of keys taking a character can be found in the public header file
> > > +L<arch-x86/cpufeatureset.h|http://xenbits.xen.org/docs/unstable/hypercall/x86_64/include,public,arch-x86,cpufeatureset.h.html>
> > 
> > https:// ;-)
> > 
> > And this probably want to be "xenbits.xenproject.org"
> > 
> > Also, I think there's maybe an issue with this link. Maybe someone can
> > assume that "TM1" takes a character, but that flags I think would get
> > rejected, issue with upper case vs lower case. Then, if we deal with
> > the casing, we still have feature like "AVX512_IFMA", which would only
> > be recognize if written "avx512-ifma", so issue with "-" vs "_".
> 
> Right, it's not perfect, but I don't see much better way if we want to
> keep the documentation in sync.

I guess we can start with the change you proposed.

Then, maybe adding that the keys needs to be lower case with dash
instead of underscore might be helpful in the man page.

And if we really feel generous, we could just handle both syntax, and
have the function apply the necessary transformation, lower case and
s/_/-/.

> > > diff --git a/tools/libs/light/libxl_cpuid.c 
> > > b/tools/libs/light/libxl_cpuid.c
> > > index f5ce9f97959c..0c7ffff416fe 100644
> > > --- a/tools/libs/light/libxl_cpuid.c
> > > +++ b/tools/libs/light/libxl_cpuid.c
> > > @@ -342,6 +214,28 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list 
> > > *cpuid, const char* str)
> > >          if(!strncmp(str, flag->name, sep - str) && flag->name[sep - str] 
> > > == 0)
> > >              break;
> > >      }
> > > +    if (flag->name == NULL) {
> > > +        const struct feature_name *feat;
> > > +        /* Provide a NUL terminated feature name to the search helper. */
> > > +        char *name = strndup(str, sep - str);
> > > +
> > > +        if (name == NULL)
> > > +            return 4;
> > So, instead of returning an arbitrary integer that isn't returned yet by
> > the function, could you return ERROR_NOMEM?
> 
> That would be my preference, but the function already returns
> (arbitrary) integers as error codes, so I'm not sure whether
> ERROR_NOMEM won't alias with one of the existing error codes.

All libxl error code are negative, so we should be fine.

Cheers,

-- 
Anthony PERARD



 


Rackspace

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