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

Re: [PATCH RFC] x86/CPUID: bump max leaf values for guest exposure


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 18 Oct 2023 14:29:03 +0200
  • 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=D2rrSjuV2MtVq4owiuIMMMyxRvsRjf8DFN/f1vE6/hc=; b=ISjNxkMSD9buWXuPX2klBKc4Zf7kFPhWAzuFqgrpLPpOTktjanCqCm3ar4gNlnQME1DJWsrBp1jd98TP1wwzfpJmlzWJdnV94d0/vRn4Zl2oYbdS5FsjbOjdfWzr1VtuK/SiuAWRKjxynmV05uUwN4050H9MDHlcX1+AT6wu6UCuEYvJOb76wa8KuClnfRi96aBZg6Wpju5FXn2ordIsBt3Q6CcAI+8o4IdOq+KCJX2BcWww3qukm/yNnVaWLrR/sRipqF2W40YbKncXlJfSobwPg1cQqa008bXezx7TXxQTLZry1yeyfUuaKqBKRlJhd1suSyvj4Oet5S1EPZu1nA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hiqHSLhGF/4gI0A/AvWMZIIcHY9Ut6eCj6zZUWg6PjNOnim10QLl6gCW20G7Yk0cHarPPCxizgNR91VIxlXgCeaymDVYckK2SwspV3HfJt2ULupwg4xflcpAhX4XjQ6mmI/tW3pris/kufVYPbGCUGT1Ff82kbR3RGRMQUZQCaLa2DVURI0I7smsM4L1nzJAtlUzFkUSTOhNadUHZXhDKLDl+s5fz/AT7wQfstSgt9drmIlDesP3O4p+CGMDrfxpLUafAuhvBzrOCCNAewFSfMkwIiLxAoaJzh3QAMTPDuFZW+cAnzyWffSRWgs+z6cSraELCVJGIAL6u3N8K+gZVA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 18 Oct 2023 12:29:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18.10.2023 12:59, Andrew Cooper wrote:
> On 17/08/2023 7:22 am, Jan Beulich wrote:
>> --- a/xen/lib/x86/cpuid.c
>> +++ b/xen/lib/x86/cpuid.c
>> @@ -104,6 +104,22 @@ void x86_cpu_featureset_to_policy(
>>      p->feat._7d1             = fs[FEATURESET_7d1];
>>      p->arch_caps.lo          = fs[FEATURESET_m10Al];
>>      p->arch_caps.hi          = fs[FEATURESET_m10Ah];
>> +
>> +    /*
>> +     * We may force-enable certain features, which then needs reflecting in
>> +     * respective max leaf / subleaf values.
>> +     *
>> +     * ARCH_CAPS lives in 7d0.
>> +     */
>> +    if ( p->feat._7d0 && p->basic.max_leaf < 7 )
>> +        p->basic.max_leaf = 7;
>> +
>> +    /*
>> +     * AMD's speculation related features (e.g. LFENCE_DISPATCH) live in
>> +     * leaf e21a.
>> +     */
>> +    if ( p->extd.e21a && p->extd.max_leaf < 0x80000021 )
>> +        p->extd.max_leaf = 0x80000021;
> 
> This logic cannot live here - this function is a simple deserialisation
> of an array.
> 
> Such logic belongs in create compatible policy, the patch for which has
> been pending even longer.

What's that patch's status?

Also the extended leaf bumping previously lived in calculate_host_policy()
alone, which isn't anywhere near "create compatible policy" either.

> The toolstack does need to take when extending like this, and it is not
> safe to do it automatically like this.

Feels like there's a word missing in the sentence, so it leaves some
guessing room. Question is - if it can't be done automatically (see also
the RFC: remark in the patch), how do we achieve a consistent resulting
policy? Plus I'm not sure we can distinguish the tool stack requesting
certain max leaf values merely because of finding them this way, from
a lower value being the result of a guest config setting.

Jan



 


Rackspace

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