History

KVM: x86: Provide per VM capability for disabling PMU virtualization

Add a new capability, KVM_CAP_PMU_CAPABILITY, that takes a bitmask of settings/features to allow userspace to configure PMU virtualization on a per-VM basis. For now, support a single flag, KVM_PMU_CAP_DISABLE, to allow disabling PMU virtualization for a VM even when KVM is configured with enable_pmu=true a module level. To keep KVM simple, disallow changing VM's PMU configuration after vCPUs have been created.

David Dunn committed 4 years ago

Commit ba7bb661 parent 92508877 files · +50 −2Browse files

Showing the changes to include/uapi (1 of 7 files). Show all

Unified · Split

include/uapi/linux/kvm.h+3−0
@@ -1142,6 +1142,7 @@ struct kvm_ppc_resize_hpt { · 1141 unmodified lines
11421142 #define KVM_CAP_SYS_ATTRIBUTES 209
11431143 #define KVM_CAP_PPC_AIL_MODE_3 210
11441144 #define KVM_CAP_S390_MEM_OP_EXTENSION 211
1145+#define KVM_CAP_PMU_CAPABILITY 212
11451146
11461147 #ifdef KVM_CAP_IRQ_ROUTING
11471148
@@ -1978,6 +1979,8 @@ struct kvm_dirty_gfn { · 830 unmodified lines
19781979 #define KVM_BUS_LOCK_DETECTION_OFF (1 << 0)
19791980 #define KVM_BUS_LOCK_DETECTION_EXIT (1 << 1)
19801981
1982+#define KVM_PMU_CAP_DISABLE (1 << 0)
1983+
19811984 /**
19821985 * struct kvm_stats_header - Header of per vm/vcpu binary statistics data.
19831986 * @flags: Some extra information for header, always 0 for now.