|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 4/6] x86/vpmu: Sanitise Intel PMU version
Le 24/03/2026 à 17:03, Jan Beulich a écrit :
> On 10.03.2026 17:44, Teddy Astie wrote:
>> --- a/xen/arch/x86/cpu-policy.c
>> +++ b/xen/arch/x86/cpu-policy.c
>> @@ -253,6 +253,33 @@ static void recalculate_xstate(struct cpu_policy *p)
>> }
>> }
>>
>> +static void sanitise_vpmu(struct cpu_policy *p)
>> +{
>> +switch ( p->x86_vendor )
>
> Nit: Lack of indentation.
>
>> + {
>> + case X86_VENDOR_INTEL:
>> + if ( !p->basic.pmu.version )
>> + return;
>
> Better use "break", but: Why is this check needed anyway? Nothing ...
>
My idea was to return early if there is no version (keeping everything
0). But as I only added checks for PMU version in this patch, this is
effectively redundant at this moment.
Although, "x86/vpmu: Limit to using supported general/fixed counters"
makes some additional adjustments to the CPUID if pmu.version != 0
making it non redundant anymore.
But yes, it wants 'break' here.
>> + /*
>> + * Expose up to PMU version 2
>> + *
>> + * PMU version 3 introduced the AnyThread bit we don't want
>> + * to support (see "AnyThread Counting and Software Evolution"
>> + * regarding notes with virtualization). This is the only known
>> + * feature introduced in PMU version 3.
>> + *
>> + * PMU version 5 deprecated AnyThread, and introduced a CPUID
>> + * bit (ANYTHREAD_DEPRECATION) to indicate that this bit isn't
>> supported.
>> + * That CPUID bit should be set for PMU version 5.
>> + */
>> + if ( p->basic.pmu.version > 2 )
>> + p->basic.pmu.version = 2;
>> +
>> + break;
>> + }
>
> ... here breaks if it was dropped.
>
> Jan
>
Teddy
--
Teddy Astie | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |