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

Re: [PATCH 1/2] x86/cpuid: Infrastructure for leaves 7:1{ecx,edx}


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 6 Mar 2023 07:57:05 +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=MR4vmimCzefpM+08QYa+0OsmT/jsoyf304Nr2AOL26o=; b=R7tblq1phMNO6/d5EHzsLLSu22wJcOUzbciDuGtLd1Q4DK972tisOmtlv2JIY+MhJq9zGoBgzGezbr+UDjO4cEGor936QxL/GMzouzFrH4JhuuLPadFGmNGBpPc2HCMfNz0ry+/RTPHRWsvXsuYgGNrZzbJezCsV6M0Orsf9SwhIV+7AAPBBzyypoLvmvgkmG0Wr3PtDOiF35WNnG3w/RKog0svY3kjAGw1PV2urnOwSK/pAQ8D4XER8XDpyOdvXi7Z552w1laD0PZGFDJJ+D2ITSsogHbbty4FcPn4WByNbokhImXBjRL0DUW2eWPPPsrlg4lqgLvADaxdWc++75Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bWpphCvFmXJASebJ5y2ICztdN5zNQjTqj5dDOoEfnQCsO8t9aseWlyhe5V7dRXcK+ZZk3adYzriLUYZFDmfMYd5KMXT7UeUgIrn1OaLjRRVkFY4Ym7FuvaKEoENOHu1++NWNwzzrp2FyURSszp4YHwbOt6Yv84sOQkePahwhFKNSYL8vyvJCmrtycSrgz35MeYe52Kgv4+lykS5DB1zYe+UuyRIKQwpFe6yTLyr+Bp4fJ/W66qu8UCeaRGeoZVlYH4m/c8qf4IaGQxTCEzmo5kiIQ85o+64yTq4kbToRPHVP0EG4j/ZZ2bIbFxnhHJSr8h1MxM+W6rDi3L226l8+dw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 06 Mar 2023 06:57:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 03.03.2023 19:32, Andrew Cooper wrote:
> On 03/03/2023 7:23 am, Jan Beulich wrote:
>> On 04.01.2023 12:11, Andrew Cooper wrote:
>>> --- a/xen/include/public/arch-x86/cpufeatureset.h
>>> +++ b/xen/include/public/arch-x86/cpufeatureset.h
>>> @@ -288,6 +288,9 @@ XEN_CPUFEATURE(NSCB,               11*32+ 6) /*A  Null 
>>> Selector Clears Base (and
>>>  /* Intel-defined CPU features, CPUID level 0x00000007:1.ebx, word 12 */
>>>  XEN_CPUFEATURE(INTEL_PPIN,         12*32+ 0) /*   Protected Processor 
>>> Inventory Number */
>>>  
>>> +/* Intel-defined CPU features, CPUID level 0x00000007:1.ecx, word 14 */
>>> +/* Intel-defined CPU features, CPUID level 0x00000007:1.edx, word 15 */
>> While committing the backports of this (where I normally test-build
>> every commit individually) I came to notice that this introduces a
>> transient (until the next commit) build breakage: FEATURESET_NR_ENTRIES
>> is calculated from the highest entry found; the comments here don't
>> matter at all. Therefore ...
>>
>>> @@ -343,6 +352,8 @@ static inline void cpuid_policy_to_featureset(
>>>      fs[FEATURESET_e21a] = p->extd.e21a;
>>>      fs[FEATURESET_7b1] = p->feat._7b1;
>>>      fs[FEATURESET_7d2] = p->feat._7d2;
>>> +    fs[FEATURESET_7c1] = p->feat._7c1;
>>> +    fs[FEATURESET_7d1] = p->feat._7d1;
>>>  }
>>>  
>>>  /* Fill in a CPUID policy from a featureset bitmap. */
>>> @@ -363,6 +374,8 @@ static inline void cpuid_featureset_to_policy(
>>>      p->extd.e21a  = fs[FEATURESET_e21a];
>>>      p->feat._7b1  = fs[FEATURESET_7b1];
>>>      p->feat._7d2  = fs[FEATURESET_7d2];
>>> +    p->feat._7c1  = fs[FEATURESET_7c1];
>>> +    p->feat._7d1  = fs[FEATURESET_7d1];
>>>  }
>> ... the compiler legitimately complains about out-of-bounds array
>> accesses here. This is just fyi for the future (to arrange patch
>> splitting differently); I've left the backports as they were.
> 
> Hmm.  c/s e3662437eb43 was designed to specifically allow CPUID patches
> to be split like this.
> 
> Which compiler?  I think I agree with your analysis, but I've never seen
> a complaint, hence not noticing.

gcc 12

> I suspect we actually want FEATURESET_NR_ENTRIES defined in C, next to
> the FEATURESET_* defines, and we want to BUILD_BUG_ON() if the autogen
> length is larger than the C length.

Hmm, yes, this may be the best we can do.

Jan



 


Rackspace

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