summaryrefslogtreecommitdiff
path: root/Documentation/admin-guide/kernel-parameters.txt
diff options
context:
space:
mode:
authorDapeng Mi <dapeng1.mi@linux.intel.com>2025-12-05 16:17:09 -0800
committerSean Christopherson <seanjc@google.com>2026-01-08 11:52:15 -0800
commit860bcb1021f5234820592853d56ca12f69e9c81f (patch)
tree400689280bb0898309912c93b33b7afc99dec5bf /Documentation/admin-guide/kernel-parameters.txt
parent3b36160d9406863812883c96c1efc8bc5c04e2cc (diff)
downloadlwn-860bcb1021f5234820592853d56ca12f69e9c81f.tar.gz
lwn-860bcb1021f5234820592853d56ca12f69e9c81f.zip
KVM: x86/pmu: Expose enable_mediated_pmu parameter to user space
Expose enable_mediated_pmu parameter to user space, i.e. allow userspace to enable/disable mediated vPMU support. Document the mediated versus perf-based behavior as part of the kernel-parameters.txt entry, and opportunistically add an entry for the core enable_pmu param as well. Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com> Signed-off-by: Mingwei Zhang <mizhang@google.com> Tested-by: Xudong Hao <xudong.hao@intel.com> Co-developed-by: Sean Christopherson <seanjc@google.com> Tested-by: Manali Shukla <manali.shukla@amd.com> Link: https://patch.msgid.link/20251206001720.468579-34-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'Documentation/admin-guide/kernel-parameters.txt')
-rw-r--r--Documentation/admin-guide/kernel-parameters.txt49
1 files changed, 49 insertions, 0 deletions
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index a8d0afde7f85..c13a8877f5b3 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3044,6 +3044,26 @@ Kernel parameters
Default is Y (on).
+ kvm.enable_pmu=[KVM,X86]
+ If enabled, KVM will virtualize PMU functionality based
+ on the virtual CPU model defined by userspace. This
+ can be overridden on a per-VM basis via
+ KVM_CAP_PMU_CAPABILITY.
+
+ If disabled, KVM will not virtualize PMU functionality,
+ e.g. MSRs, PMCs, PMIs, etc., even if userspace defines
+ a virtual CPU model that contains PMU assets.
+
+ Note, KVM's vPMU support implicitly requires running
+ with an in-kernel local APIC, e.g. to deliver PMIs to
+ the guest. Running without an in-kernel local APIC is
+ not supported, though KVM will allow such a combination
+ (with severely degraded functionality).
+
+ See also enable_mediated_pmu.
+
+ Default is Y (on).
+
kvm.enable_virt_at_load=[KVM,ARM64,LOONGARCH,MIPS,RISCV,X86]
If enabled, KVM will enable virtualization in hardware
when KVM is loaded, and disable virtualization when KVM
@@ -3090,6 +3110,35 @@ Kernel parameters
If the value is 0 (the default), KVM will pick a period based
on the ratio, such that a page is zapped after 1 hour on average.
+ kvm-{amd,intel}.enable_mediated_pmu=[KVM,AMD,INTEL]
+ If enabled, KVM will provide a mediated virtual PMU,
+ instead of the default perf-based virtual PMU (if
+ kvm.enable_pmu is true and PMU is enumerated via the
+ virtual CPU model).
+
+ With a perf-based vPMU, KVM operates as a user of perf,
+ i.e. emulates guest PMU counters using perf events.
+ KVM-created perf events are managed by perf as regular
+ (guest-only) events, e.g. are scheduled in/out, contend
+ for hardware resources, etc. Using a perf-based vPMU
+ allows guest and host usage of the PMU to co-exist, but
+ incurs non-trivial overhead and can result in silently
+ dropped guest events (due to resource contention).
+
+ With a mediated vPMU, hardware PMU state is context
+ switched around the world switch to/from the guest.
+ KVM mediates which events the guest can utilize, but
+ gives the guest direct access to all other PMU assets
+ when possible (KVM may intercept some accesses if the
+ virtual CPU model provides a subset of hardware PMU
+ functionality). Using a mediated vPMU significantly
+ reduces PMU virtualization overhead and eliminates lost
+ guest events, but is mutually exclusive with using perf
+ to profile KVM guests and adds latency to most VM-Exits
+ (to context switch PMU state).
+
+ Default is N (off).
+
kvm-amd.nested= [KVM,AMD] Control nested virtualization feature in
KVM/SVM. Default is 1 (enabled).