public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Like Xu <like.xu.linux@gmail.com>
Cc: Anselm Busse <abusse@amazon.com>,
	dwmw@amazon.co.uk, hborghor@amazon.de, sironi@amazon.de,
	Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] KVM support for Intel PMU v5 fixed function PMC bitmap
Date: Thu, 25 May 2023 15:30:11 -0700	[thread overview]
Message-ID: <ZG/hc+9/2BraMrZB@google.com> (raw)
In-Reply-To: <2d7f7f80-278d-9fcf-cfc4-c433e95d9842@gmail.com>

On Tue, May 16, 2023, Like Xu wrote:
> On 27/4/2023 5:53 pm, Anselm Busse wrote:
> > Starting with v5, the Intel PMU allows to indicate the available fixed
> > function PMCs not only through CPUID.0AH.EDX[4:0] but also through a
> > bit mask in CPUID.0AH.ECX. According to the SDM the OS can consider a
> > fix function PMC i supported for:
> > 
> > CPUID.0AH.ECX[i] || (CPUID.0AH.EDX[4:0] > i)
> 
> Yes, this feature is attractive for virtualization scenarios, and it gives
> flexibility to control which fixed counters are available or not in the
> virtual machine.
> 
> However, currently KVM/x86 also supports Intel PMU V2, so I would expect
> that we will review the enablement code for v3 and v4 first.

Looking at v3, I think we probably want to skip straight to v5.  I don't see a sane
way for KVM to emulate/virtualize AnyThread, which comes in v3 without a separate
CPUID feature flag.  The SDM even calls out that it'd be a mess to deal with in a
virtualized environment.  v5 introduces a CPUID bit to allow deprecating AnyThread,
i.e. would give KVM the ability to advertise a sane vPMU model to userspace.
Amusingly, KVM advertises "edx.split.anythread_deprecated = 1" for v1+, so maybe
we don't even need to do any enabling?  At glance, I don't see any other changes
in v3 that require KVM support.

v4 looks to be an entirely different story than v3 though.  So I agree with Like
that we need to enable v3 and v4 before advertising support for v5.  And KVM *does*
need to actually advertise v5.  Emulating the fixed counter bitmap without a way to
tell userspace about the functionality will create a mess.

TL;DR: If y'all want the shiny features in v5, please enable v3 and v4 first.  I'm
totally fine taking a series to go all the way to v5 (might even be preferred due
to the AnyThread crud), but I don't want to advertise v5 without supporting the
required v3/v4 features.

> Ref: https://lore.kernel.org/kvm/CALMp9eQVnk8gkOpX5AHhaCr8-5Fe=qNuX8PUP1Gv2H5FSYmHSw@mail.gmail.com/

I agree 100% with Jim, the bitmask stuff is firmly v5+.

      reply	other threads:[~2023-05-25 22:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-27  9:53 [PATCH 0/2] KVM support for Intel PMU v5 fixed function PMC bitmap Anselm Busse
2023-04-27  9:53 ` [PATCH 1/2] KVM: vmx/pmu: Indicate available fixed function PMCs through a bitmap Anselm Busse
2023-05-25 22:35   ` Sean Christopherson
2023-04-27  9:53 ` [PATCH 2/2] KVM: vmx/pmu: Add support for selected fixed vPMU enablement for PMU v5 Anselm Busse
2023-05-16 13:29 ` [PATCH 0/2] KVM support for Intel PMU v5 fixed function PMC bitmap Like Xu
2023-05-25 22:30   ` Sean Christopherson [this message]

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=ZG/hc+9/2BraMrZB@google.com \
    --to=seanjc@google.com \
    --cc=abusse@amazon.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dwmw@amazon.co.uk \
    --cc=hborghor@amazon.de \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=like.xu.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=sironi@amazon.de \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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