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
1142#define KVM_CAP_SYS_ATTRIBUTES 2091142#define KVM_CAP_SYS_ATTRIBUTES 209
1143#define KVM_CAP_PPC_AIL_MODE_3 2101143#define KVM_CAP_PPC_AIL_MODE_3 210
1144#define KVM_CAP_S390_MEM_OP_EXTENSION 2111144#define KVM_CAP_S390_MEM_OP_EXTENSION 211
1145#define KVM_CAP_PMU_CAPABILITY 212
1145 1146
1146#ifdef KVM_CAP_IRQ_ROUTING1147#ifdef KVM_CAP_IRQ_ROUTING
1147 1148
@@ -1978,6 +1979,8 @@ struct kvm_dirty_gfn { · 830 unmodified lines
1978#define KVM_BUS_LOCK_DETECTION_OFF (1 << 0)1979#define KVM_BUS_LOCK_DETECTION_OFF (1 << 0)
1979#define KVM_BUS_LOCK_DETECTION_EXIT (1 << 1)1980#define KVM_BUS_LOCK_DETECTION_EXIT (1 << 1)
1980 1981
1982#define KVM_PMU_CAP_DISABLE (1 << 0)
1983
1981/**1984/**
1982 * struct kvm_stats_header - Header of per vm/vcpu binary statistics data.1985 * struct kvm_stats_header - Header of per vm/vcpu binary statistics data.
1983 * @flags: Some extra information for header, always 0 for now.1986 * @flags: Some extra information for header, always 0 for now.