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

Re: [PATCH 1/2] x86/cpuid: Infrastructure to support pseudo feature identifiers


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Wed, 5 Oct 2022 12:58:26 +0000
  • Accept-language: en-GB, en-US
  • 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nqX9Li74g/uSXMzsbhfgGPlCUOXaCz498NvQNGl/plI=; b=eIrUOzQLu/es6+wC9VoB58zJ3OP547UmPt5wL+RJTaQYA2OikKsTwCHmmAsltXI8p38l5OB6YmkeoDSUEOP4+KKh+/3AdGBqLBtQI60GALPTgmEKWB1lhYfh+/WVmG3z28Iq/uYPB3cS9/lxuszZzwEMqs10aGrovEJuNamOtl+z0AzjQy3Oqmqo0+WUJZqZ0OinOfX24+sYn+5B68l6bgij1VJ0J2XOvamZlE4LdVtTlD1Ak4LKE8fOzUVPc3pEjvPDELafCds9YCtf1GJtrucBI1conlXA21Y8KYh05Fw0gTtoJziXtIyngOnDv14uNpWj1qdolsPcjQXs45m9FA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bmGdpDr/1Yd+p/AH8YS4nriBEaEmSAM12kZrv1DeDcmlybiS4uPWfsObpocu0VZf9eJJxVKN8QR7af3h8fPQ2JLBc4+FFT2fW3bwcwNoJbWeeznqwFX7EW9wCTf1WOgYSfap0LCKy5dxIocOx5+EszNPtltmrBerPpDgYXPhFz6j3NzbiesMR12668siGxwQiFueo0pElTrsBIG34irwNaiaKl5lEqjcjXQkEFMNLJe/CTVqZT66EyH733hGObxpnXNTcY126bf9XesKc59n0/vS0lQZiOJYyAgP7WN6Ns4nI4HMV1dzs2pyBGNAoC5Ao8GgQ213b8d8kQKjtYoPzA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 05 Oct 2022 12:58:53 +0000
  • Ironport-data: A9a23:GJ9N4qtYgePDxUBD3UlJp2A/f+fnVKZfMUV32f8akzHdYApBsoF/q tZmKWjTM6vZNGCjf95xaI2y80MCuZfcyoBgTVNlpCBkHi4b+JbJXdiXEBz9bniYRiHhoOCLz O1FM4Wdc5pkJpP4jk3wWlQ0hSAkjclkfpKlVKiefHgZqTZMEE8JkQhkl/MynrlmiN24BxLlk d7pqojUNUTNNwRcawr40Ire7kIy1BjOkGlA5AZnPagW5Aa2e0Q9V/rzG4ngdxMUfaEMdgKKb 76r5K20+Grf4yAsBruN+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+v9T2M4nQVVWk120c+VZk 72hg3ASpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn9IBDJyCAWlvVbD09NqbDklAz OEcFg8HcSykhvzn0YjlFLJlq+gaeZyD0IM34hmMzBn/JNN/G9XvZvuP4tVVmjAtmspJAPDSI dIDbiZiZwjBZBsJPUoLDJU5n6GjgXyXnz9w8QrJ4/ZopTWCilUuiNABM/KMEjCObexTklyVu STt+GPhDwtBHNee1SCE4jSngeqncSbTCNtLSOfmqKcCbFu7x0hIJAwxD0KC8aOSqk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H51fM2MXXsEZsssyH1iOvsXIIIv3sfGzSoeaGJP9VTI/Hm/vCH oKWzb+YM1G80CwQ3f9xAPcXnv8E3aPia6Y0JKqitT75LJ9RbGk6DJl+GhRzvv7WQFqo+gxYF Z0Jq/hn+eyuXS2lFy4nVlUBg==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHY2AuYxJImxml8GUGenwgOwsThN63/X+4AgABkSoA=
  • Thread-topic: [PATCH 1/2] x86/cpuid: Infrastructure to support pseudo feature identifiers

On 05/10/2022 07:59, Jan Beulich wrote:
> On 04.10.2022 18:08, Andrew Cooper wrote:
>> A future change will want a cpuid-like identifier which doesn't have a 
>> mapping
>> to a feature bit.
>>
>>  * Pass the feature name into the parse callback.
>>  * Exclude a feature value of ~0u from falling into the general set/clear bit
>>    paths.
>>  * In gen-cpuid.py, insert a placeholder to collect all the pseudo feature
>>    names.
> Hmm, I was envisioning this to be fitted into the existing model in a
> less adhoc way: (parts of) MSRs holding feature bits aren't very different
> from individual (pairs of) registers of CPUID output (in the case of
> ARCH_CAPS there would be a perhaps just abstract mask limiting things to
> the subset of bits which actually act as feature indicators). Hence I'd
> have expected them to gain proper entries in the public interface
> (cpufeatureset.h) and then be represented / processed the same way in
> featuresets and policies. All that would be left out at this point would
> be the exposing of the bit to guests (in patch 2, assuming the split into
> two patches is then actually still warranted), integration into
> guest_rdmsr(), and at least some of the tool stack side (xen-cpuid, for
> example, could easily learn of such right away).
>
> However, since I'm pretty sure you've considered such an approach, I guess
> I might be overlooking some caveat?

I have on multiple occasions considered putting MSR_ARCH_CAPS into the
existing X86_FEATURE_* infrastructure.  In the future, it's likely the
right course of action to take.

However, doing so now will break speculation safety for guests in some
cases.  The featureset API intended to be safe to treat as a regular
bitmap, and this is how it is used in practice.

Honestly, I didn't imagine that we'd get bits like RSBA and RRSBA that
need to be treated with opposite polarity to be levelled safely.

Even if we do end up putting MSR_ARCH_CAPS in X86_FEATURE_*, we still
need to remove the featureset api (replaced by the cpu policy
infrastructure and libx86) to retain migration safety.

>
>> --- a/xen/tools/gen-cpuid.py
>> +++ b/xen/tools/gen-cpuid.py
>> @@ -297,6 +297,19 @@ def crunch_numbers(state):
>>          RTM: [TSXLDTRK],
>>      }
>>  
>> +    #
>> +    # Pseudo feature names.  These don't map to a feature bit, but are
>> +    # inserted into the values dictionary so they can be parsed and handled
>> +    # specially
>> +    #
>> +    pseduo_names = (
>> +    )
>> +
>> +    for n in pseduo_names:
>> +        if n in state.values:
>> +            raise Fail("Pseduo feature name %s aliases real feature" % (n, 
>> ))
>> +        state.values[n] = 0xffffffff
> Throughout this hunk: s/pseduo/pseudo/g.

Oops, yes.  Will fix.

~Andrew

 


Rackspace

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