Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Luka Absandze <absandze@amazon.de>,
	Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org,  linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org,  Alexander Graf <graf@amazon.com>
Subject: Re: [RFC PATCH 1/2] KVM: x86/pmu: Add CAP to disable SW accounting of emulated instructions
Date: Tue, 21 Jul 2026 09:53:00 -0700	[thread overview]
Message-ID: <al-j7FTIRAECuhRt@google.com> (raw)
In-Reply-To: <d538bd8eba1058d52f8d32e311c12bf216ff4118.camel@infradead.org>

On Tue, Jul 21, 2026, David Woodhouse wrote:
> 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,

Conceptually, I 100% agree.  But in practice, making a per-guest choice requires
a priori knowledge of what the guest is doing and/or what the guest needs/wants.

And so I'm asking, do your use cases have that knowledge *and* will you run VMs
with different requirements on a single host?  Because if you'll end up
configuring all VMs on a given host the same way, then I'd strongly prefer a
module param to give us more flexibility for the future, e.g. if months/years
from now we figure out a way to provide acceptable correctness and efficiency
that would allows us to drop the param entirely.

> if we can't find a way to do it with *sufficient* correctness *and*
> efficiency (qv).



  reply	other threads:[~2026-07-21 16:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 19:22 [RFC PATCH 0/2] KVM: x86/pmu: Let userspace disable SW accounting of emulated instructions Luka Absandze
2026-07-20 19:22 ` [RFC PATCH 1/2] KVM: x86/pmu: Add CAP to " Luka Absandze
2026-07-20 22:27   ` Sean Christopherson
2026-07-21  7:33     ` David Woodhouse
2026-07-21 16:53       ` Sean Christopherson [this message]
2026-07-21 19:43         ` David Woodhouse
2026-07-20 19:22 ` [RFC PATCH 2/2] KVM: Documentation: Document KVM_CAP_X86_DISABLE_PMU_SW_ACCOUNTING Luka Absandze
2026-07-21  7:32 ` [RFC PATCH 0/2] KVM: x86/pmu: Let userspace disable SW accounting of emulated instructions David Woodhouse
2026-07-21 16:47   ` Sean Christopherson
2026-07-21 16:55     ` David Woodhouse
2026-07-21 17:05       ` Sean Christopherson
2026-07-21 17:32     ` Absandze, Luka
2026-07-21 17:49       ` Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=al-j7FTIRAECuhRt@google.com \
    --to=seanjc@google.com \
    --cc=absandze@amazon.de \
    --cc=dwmw2@infradead.org \
    --cc=graf@amazon.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox