Re: [RFC PATCH 1/2] KVM: x86/pmu: Add CAP to disable SW accounting of emulated instructions
From: David Woodhouse
Date: Tue Jul 21 2026 - 03:37:30 EST
On Mon, 2026-07-20 at 15:27 -0700, Sean Christopherson wrote:
> On Mon, Jul 20, 2026, Luka Absandze wrote:
> > The only functional change for an opted-in VM is reduced accuracy: a
> > guest counting instructions-retired or branches-retired undercounts by
> > the instructions KVM emulates in host context, i.e. the behavior that
> > predates the accounting cited above. Hardware-executed guest
> > instructions continue to be counted by the backing perf_event, and its
> > overflow/PMI path is unchanged.
>
> Do you *need* per-VM control, or would a module param (or a magic value for
> enable_pmu) suffice? While I mostly buy the "it used to work this way" argument
> (just "mostly", because that commit landed 4.5 years ago), I'm not exactly keen
> on adding uAPI that is effectively "re-introduce a bug to workaround fundamental
> design issues in KVM's emulated PMU implementation".
Which is the bug? Some would argue that timer interrupts running 50
times slower is also a bug. We just get to choose *which* bug we want
the guest to experience :)
And I think that is a per-guest choice, if we can't find a way to do it
with *sufficient* correctness *and* efficiency (qv).
Attachment:
smime.p7s
Description: S/MIME cryptographic signature