Re: [PATCH for-next v3 1/9] slub_kunit: fall back to SW perf events when HW PMU is not available
From: Alexei Starovoitov
Date: Mon Jun 15 2026 - 16:03:10 EST
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().
VMs need to configured properly. Even nested VMs support
PERF_COUNT_HW_CPU_CYCLES.
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.