Re: [PATCH for-next v3 1/9] slub_kunit: fall back to SW perf events when HW PMU is not available
From: Harry Yoo
Date: Tue Jun 16 2026 - 01:24:40 EST
On 6/16/26 5:01 AM, Alexei Starovoitov wrote:
> On Mon Jun 15, 2026 at 4:05 AM PDT, Harry Yoo (Oracle) wrote:
>> slub_kunit uses hardware perf events to invoke _nolock() APIs from NMI
>> context. However, creating a HW perf event fails when there is no
>> hardware PMU, or when running in a virtualized environment without a
>> virtual PMU configured.
>>
>> Since tests are often performed in virtualized environments, fall back
>> to a SW perf event so that the test can still run, even if it cannot
>> cover IRQ-disabled sections.
>
> Frankly, I wouldn't bother with this fallback, since it completely misses
> irq disabled section which is the one to test with *_nolock().
Right, it only covers percpu sheaves locks.
> VMs need to configured properly. Even nested VMs support
> PERF_COUNT_HW_CPU_CYCLES.
And now that even VMs that are not properly configured can test it using
kprobe with _some_ coverage, we don't really need the fallback.
Will drop the fallback.
> Also in overflow_handler_test_nolock()
> I would add
> even->hw.interrupts = 0;
> to the end to make sure it actually stress tests things.
> Without it NMIs are not firing quickly enough.
Will do.
Thanks!
--
Cheers,
Harry / Hyeonggon
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature