Re: [RFC PATCH 0/2] KVM: x86/pmu: Let userspace disable SW accounting of emulated instructions
From: David Woodhouse
Date: Tue Jul 21 2026 - 03:32:59 EST
On Mon, 2026-07-20 at 19:22 +0000, Luka Absandze wrote:
> On hosts that run guests with an *emulated* vPMU -- guest PMU MSR
> accesses trap into KVM and each guest counter is backed by a host
> perf_event -- the per-emulated-instruction PMU accounting added by commit
> 9cd803d496e7 ("KVM: x86: Update vPMCs when retiring instructions") is
> pathologically expensive.
Given that the guest PMU MSR accesses are trapped... is there a reason
we can't fold a *separate* count of emulated instructions into the
value we return to the guest?
I guess the overflow would come late... but isn't that tolerable? And
we could probably impose a limit on how large the addend could be —
even if we only reprogram the PMU once every 100 times, that's still a
win?
Attachment:
smime.p7s
Description: S/MIME cryptographic signature