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

Re: [PATCH v4 00.9/16] x86/CPUID: enable AVX10 leaf


  • To: Teddy Astie <teddy.astie@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 10 Apr 2026 14:24:44 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID"
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 10 Apr 2026 12:24:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 10.04.2026 11:26, Teddy Astie wrote:
> Le 09/04/2026 à 17:18, Jan Beulich a écrit :
>> This requires bumping the number of basic leaves we support. Apart from
>> this the logic is modeled as closely as possible after that of leaf 7
>> handling.
>>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> ---
>> The gen-cpuid.py adjustment is merely the minimum needed. It's not
>> really clear to me whether someone turning off e.g. AVX512BW might then
>> also validly expect AVX10 to be turned off.
> 
> AFAIUI, AVX512BW is a dependency of AVX10, as AVX10 implies that the 
> former is available.

I'm not convinced it is a "dependency". My understanding is that while
Intel may say that all their AVX10 hardware is expected to set all the
respective AVX512* bits as well, the spec says e.g. "Intel® AVX-512
instruction families included in Intel® AVX10.1 are shown in Table 3.2."
Where "instruction families" doesn't say anything about CPUID bits. So
from an abstract spec pov someone wanting to use e.g. VMOVDQU8 will
want to check for AVX10 || AVX512BW.

>> Do we want to synthesize AVX10 in the (max?) policies when all necessary
>> AVX512* features are available, thus allowing migration from an AVX10
>> host to a suitable non-AVX10 one?
> 
> I guess we want, there is not really a reason to not allow it.
> 
> Some software may check for AVX10 only, and not check for individual 
> AVX512 bits.

As per above, such software may be slightly flawed. Synthesizing the
AVX10 feature bit also means synthesizing the AVX10 leaf then, for
example. This may be somewhat of an issue for migration; I didn't
thoroughly think this through yet.

>> --- a/xen/arch/x86/cpu-policy.c
>> +++ b/xen/arch/x86/cpu-policy.c
>> @@ -211,7 +211,7 @@ static void recalculate_xstate(struct cp
>>       if ( p->feat.mpx )
>>           xstates |= X86_XCR0_BNDREGS | X86_XCR0_BNDCSR;
>>   
>> -    if ( p->feat.avx512f )
>> +    if ( p->feat.avx512f || p->feat.avx10 )
> 
> In principle, the avx10 check is redundant as avx512f must be set if 
> avx10 is set.

I don't think so; see above discussion of AVX512BW.

>> --- a/xen/arch/x86/lib/cpu-policy/cpuid.c
>> +++ b/xen/arch/x86/lib/cpu-policy/cpuid.c
>> @@ -125,6 +125,7 @@ void x86_cpu_policy_fill_native(struct c
>>           switch ( i )
>>           {
>>           case 0x4: case 0x7: case 0xb: case 0xd:
>> +        case 0x24:
>>               /* Multi-invocation leaves.  Deferred. */
>>               continue;
>>           }
>> @@ -218,6 +219,15 @@ void x86_cpu_policy_fill_native(struct c
>>           }
>>       }
>>   
>> +    if ( p->basic.max_leaf >= 0x24 )
>> +    {
>> +        cpuid_count_leaf(0x24, 0, &p->avx10.raw[0]);
>> +
>> +        for ( i = 1; i <= MIN(p->avx10.max_subleaf,
>> +                              ARRAY_SIZE(p->avx10.raw) - 1); ++i )
>> +            cpuid_count_leaf(0x24, i, &p->avx10.raw[i]);
> 
> Do we need to split the 0 iteration out ? I guess we can just start from 
> i = 0 instead.

Well, strictly formally p->avx10.max_subleaf is uninitialized on the
first loop iteration. Hence comparing against it isn't a good idea. (In
practice the field taking whatever value will let i == 0 pass, but still.)

What's more important though: I want to keep this in sync with what we to
elsewhere in the function.

>> --- a/xen/include/xen/lib/x86/cpu-policy.h
>> +++ b/xen/include/xen/lib/x86/cpu-policy.h
>> @@ -59,11 +59,12 @@ unsigned int x86_cpuid_lookup_vendor(uin
>>    */
>>   const char *x86_cpuid_vendor_to_str(unsigned int vendor);
>>   
>> -#define CPUID_GUEST_NR_BASIC      (0xdu + 1)
>> +#define CPUID_GUEST_NR_BASIC      (0x24u + 1)
>>   #define CPUID_GUEST_NR_CACHE      (5u + 1)
>>   #define CPUID_GUEST_NR_FEAT       (2u + 1)
>>   #define CPUID_GUEST_NR_TOPO       (1u + 1)
>>   #define CPUID_GUEST_NR_XSTATE     (62u + 1)
>> +#define CPUID_GUEST_NR_AVX10      (0u + 1)
> 
> Intel specification now defines AVX10.2 which has a additional leaf 
> (even though the whole leaf is currently marked as "reserved").

See "x86/CPUID: enable AVX10.2 sub-leaf" later in the series. The first
part aims at supporting just AVX10.1.

>> --- a/xen/tools/gen-cpuid.py
>> +++ b/xen/tools/gen-cpuid.py
>> @@ -294,7 +294,7 @@ def crunch_numbers(state):
>>           # enabled.  Certain later extensions, acting on 256-bit vectors of
>>           # integers, better depend on AVX2 than AVX.
>>           AVX2: [AVX512F, VAES, VPCLMULQDQ, AVX_VNNI, AVX_IFMA, 
>> AVX_VNNI_INT8,
>> -               AVX_VNNI_INT16, SHA512, SM4],
>> +               AVX_VNNI_INT16, SHA512, SM4, AVX10],
>>   
> 
> I think we can instead make AVX10 a dependency on AVX512. Especially since
> 
>  > Any processor that enumerates support for Intel AVX10 will also 
> enumerate support for Intel AVX, Intel AVX2, and Intel AVX-512 (see 
> Table 16-2).
> 
> with AVX-512 depending on AVX2.

That's the very statement I refer to at the top. Intel may say this for
themselves, but the spec - according to my reading - doesn't mandate this.

Jan



 


Rackspace

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