From: Dapeng Mi <dapeng1.mi@linux.intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <seanjc@google.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org,
Zhao Liu <zhao1.liu@intel.com>, Zide Chen <zide.chen@intel.com>,
Xiaoyao Li <xiaoyao.li@intel.com>,
Dongli Zhang <dongli.zhang@oracle.com>,
Mingwei Zhang <mizhang@google.com>,
Das Sandipan <Sandipan.Das@amd.com>,
Shukla Manali <Manali.Shukla@amd.com>,
Dapeng Mi <dapeng1.mi@intel.com>,
Dapeng Mi <dapeng1.mi@linux.intel.com>
Subject: [PATCH 0/3] Enable x86 mediated vPMU
Date: Mon, 24 Mar 2025 12:37:09 +0000 [thread overview]
Message-ID: <20250324123712.34096-1-dapeng1.mi@linux.intel.com> (raw)
This small patch series enables the newly introduced KVM x86 mediated
vPMU solution. As KVM maintainer's suggestion, KVM mediated vPMU is
disabled by default unless user explicitly calls KVM_CAP_PMU_CAPABILITY
ioctl to enable it.
As for mediated vPMU, it's a new pass-through vPMU solution which is
designed to replace the legacy perf-based vPMU which has several
drawbacks, such as high performance overhead, hard to support new PMU
features, etc. Most of PMU MSRs except EVENTSELx are passed through to
guest in mediated vPMU. Currently the latest mediated vPMU patch series
is v3[1], the v4 patchset would be sent soon.
In this series, patch 1/3 introduces a helper
kvm_arch_pre_create_vcpu() which would be called before creating vCPU.
This patch comes from Xiaoyao's "QEMU TDX support" patchset[2]. Patch
2/3 leverages the patch 1/3 introduced helper to call
KVM_CAP_PMU_CAPABILITY ioctl to enable/disable KVM vPMU (mediated vPMU).
This patch is similar with patch 4/10 of Dongli's
"target/i386/kvm/pmu: PMU Enhancement, Bugfix and Cleanup" patchset[3],
but can be considered as an enhanced version. Patch 3/3 provides support
for newly introduced VMCS bit SAVE_IA32_PERF_GLOBAL_CTRL.
Tests:
* Tests on Sapphire Rapids platform, both mediated vPMU and legacy
perf-based vPMU can be enabled/disabled with "+/-pmu" option.
Ref:
[1] https://lore.kernel.org/all/20240801045907.4010984-1-mizhang@google.com/
[2] https://lore.kernel.org/all/20250124132048.3229049-8-xiaoyao.li@intel.com/
[3] https://lore.kernel.org/all/20250302220112.17653-5-dongli.zhang@oracle.com/
Dapeng Mi (2):
target/i386: Call KVM_CAP_PMU_CAPABILITY iotcl to enable/disable PMU
target/i386: Support VMX_VM_EXIT_SAVE_IA32_PERF_GLOBAL_CTRL
Xiaoyao Li (1):
kvm: Introduce kvm_arch_pre_create_vcpu()
accel/kvm/kvm-all.c | 5 +++++
include/system/kvm.h | 1 +
target/arm/kvm.c | 5 +++++
target/i386/cpu.c | 12 ++++++++----
target/i386/cpu.h | 1 +
target/i386/kvm/kvm.c | 22 ++++++++++++++++++++++
target/loongarch/kvm/kvm.c | 5 +++++
target/mips/kvm.c | 5 +++++
target/ppc/kvm.c | 5 +++++
target/riscv/kvm/kvm-cpu.c | 5 +++++
target/s390x/kvm/kvm.c | 5 +++++
11 files changed, 67 insertions(+), 4 deletions(-)
base-commit: 71119ed3651622e1c531d1294839e9f3341adaf5
--
2.40.1
next reply other threads:[~2025-03-24 7:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-24 12:37 Dapeng Mi [this message]
2025-03-24 12:37 ` [PATCH 1/3] kvm: Introduce kvm_arch_pre_create_vcpu() Dapeng Mi
2025-03-24 12:37 ` [PATCH 2/3] target/i386: Call KVM_CAP_PMU_CAPABILITY iotcl to enable/disable PMU Dapeng Mi
2025-03-26 6:46 ` Dongli Zhang
2025-03-27 0:44 ` Mi, Dapeng
2025-03-27 2:15 ` Mingwei Zhang
2025-03-27 3:47 ` Mi, Dapeng
2025-03-24 12:37 ` [PATCH 3/3] target/i386: Support VMX_VM_EXIT_SAVE_IA32_PERF_GLOBAL_CTRL Dapeng Mi
2025-04-27 8:54 ` Zhao Liu
2025-04-27 9:42 ` Mi, Dapeng
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=20250324123712.34096-1-dapeng1.mi@linux.intel.com \
--to=dapeng1.mi@linux.intel.com \
--cc=Manali.Shukla@amd.com \
--cc=Sandipan.Das@amd.com \
--cc=dapeng1.mi@intel.com \
--cc=dongli.zhang@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=mizhang@google.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=seanjc@google.com \
--cc=xiaoyao.li@intel.com \
--cc=zhao1.liu@intel.com \
--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;
as well as URLs for NNTP newsgroup(s).