Re: [PATCH] x86/aperfmperf: Don't disable scheduler APERF/MPERF on bad samples

From: Andrew Cooper

Date: Thu Dec 04 2025 - 15:02:12 EST


> However this can happen without any malfunction when there is
> a long enough interruption between the two MSR reads, for
> example due to an unlucky NMI or SMI or other system event
> causing delays.

The list of problems is even longer under virt.  The vCPU can lose it's
timeslice (-> arbitrary delay), or be scheduled onto a different CPU
between the A and M reads (-> calculate the wrong ratio, and not in a
way you could exclude it as a bad sample).

Despite this, some people insist on having A/MPERF inside VMs.

~Andrew