Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Zide Chen <zide.chen@intel.com>
Cc: sashiko-reviews@lists.linux.dev, kvm@vger.kernel.org
Subject: Re: [PATCH V4 3/4] KVM: x86/pmu: Support PERF_METRICS MSR in mediated vPMU
Date: Tue, 23 Jun 2026 16:33:25 -0700	[thread overview]
Message-ID: <ajsXxXHz-oIcSXDE@google.com> (raw)
In-Reply-To: <bcbc4f64-60e9-46a8-bf63-19e7d9d30595@intel.com>

On Tue, Jun 23, 2026, Zide Chen wrote:
> On 6/22/2026 11:48 PM, sashiko-bot@kernel.org wrote:
> >> diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c
> >> index 59b7a90c79e12..2c3367f5e2dfb 100644
> >> --- a/arch/x86/kvm/vmx/pmu_intel.c
> >> +++ b/arch/x86/kvm/vmx/pmu_intel.c
> > [ ... ]
> >> @@ -345,6 +347,11 @@ static int intel_pmu_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
> >>  	case MSR_CORE_PERF_FIXED_CTR_CTRL:
> >>  		msr_info->data = pmu->fixed_ctr_ctrl;
> >>  		break;
> >> +	case MSR_PERF_METRICS:
> >> +		if (!msr_info->host_initiated)
> >> +			return 1;
> > 
> > [Severity: High]
> > If KVM needs to emulate a guest RDMSR instruction targeting MSR_PERF_METRICS,
> > won't this unconditional return inject a #GP fault into the guest?
> 
> I can't think of a case that KVM needs to emulate RDMSR/WRMSR on
> MSR_PERF_METRICS.

If the literal emulator happens to emulate a RDMSR/WRMSR, KVM should behave
correctly.  Even if that weren't the case, KVM's implementation should adhere to
the architecture.  Assuming MSR_PERF_METRICS is read/write, KVM should emulate
it as such.

  reply	other threads:[~2026-06-23 23:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23  4:19 [PATCH V4 0/4] KVM: x86/pmu: Add hardware Topdown metrics support Zide Chen
2026-06-23  4:19 ` [PATCH V4 1/4] KVM: x86/pmu: Do not map fixed counters >= 3 to generic perf events Zide Chen
2026-06-23  4:19 ` [PATCH V4 2/4] KVM: x86/pmu: Support Intel fixed counter 3 on mediated vPMU Zide Chen
2026-06-23  4:19 ` [PATCH V4 3/4] KVM: x86/pmu: Support PERF_METRICS MSR in " Zide Chen
2026-06-23  4:48   ` sashiko-bot
2026-06-23 21:48     ` Chen, Zide
2026-06-23 23:33       ` Sean Christopherson [this message]
2026-06-24  3:16         ` Chen, Zide
2026-06-23  7:04   ` Mi, Dapeng
2026-06-23 21:38     ` Chen, Zide
2026-06-23  4:19 ` [PATCH V4 4/4] KVM: selftests: Add perf_metrics and fixed counter 3 tests Zide Chen
2026-06-23  4:43   ` sashiko-bot

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=ajsXxXHz-oIcSXDE@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zide.chen@intel.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