Re: [kvm-unit-tests patch v6 08/18] x86: pmu: Fix cycles event validation failure

Mi, Dapeng
2025-02-18T09:36:25Z

On 2/15/2025 5:07 AM, Sean Christopherson wrote:
> On Sat, Sep 14, 2024, Dapeng Mi wrote:
>> +static void warm_up(void)
>> +{
>> + int i = 8;
>> +
>> + /*
>> + * Since cycles event is always run as the first event, there would be
>> + * a warm-up state to warm up the cache, it leads to the measured cycles
>> + * value may exceed the pre-defined cycles upper boundary and cause
>> + * false positive. To avoid this, introduce an warm-up state before
>> + * the real verification.
>> + */
>> + while (i--)
>> + loop();
> Use a for-loop.

Sure.

>
>> +}
>> +
>> static void check_counters(void)
>> {
>> if (is_fep_available())
>> check_emulated_instr();
>>
>> + warm_up();
>> check_gp_counters();
>> check_fixed_counters();
>> check_rdpmc();
>> --
>> 2.40.1
>>