Skip to content

Commit b8bfee8

Browse files
jsmattsonjrbonzini
authored andcommitted
KVM: x86/pmu: Don't truncate the PerfEvtSeln MSR when creating a perf event
AMD's event select is 3 nybbles, with the high nybble in bits 35:32 of a PerfEvtSeln MSR. Don't drop the high nybble when setting up the config field of a perf_event_attr structure for a call to perf_event_create_kernel_counter(). Fixes: ca72430 ("KVM: x86/vPMU: Implement AMD vPMU code for KVM") Reported-by: Stephane Eranian <eranian@google.com> Signed-off-by: Jim Mattson <jmattson@google.com> Message-Id: <20220203014813.2130559-1-jmattson@google.com> Reviewed-by: David Dunn <daviddunn@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 66fa226 commit b8bfee8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/x86/kvm/pmu.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static void kvm_perf_overflow(struct perf_event *perf_event,
9595
}
9696

9797
static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type,
98-
unsigned config, bool exclude_user,
98+
u64 config, bool exclude_user,
9999
bool exclude_kernel, bool intr,
100100
bool in_tx, bool in_tx_cp)
101101
{
@@ -181,7 +181,8 @@ static int cmp_u64(const void *a, const void *b)
181181

182182
void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel)
183183
{
184-
unsigned config, type = PERF_TYPE_RAW;
184+
u64 config;
185+
u32 type = PERF_TYPE_RAW;
185186
struct kvm *kvm = pmc->vcpu->kvm;
186187
struct kvm_pmu_event_filter *filter;
187188
bool allow_event = true;

0 commit comments

Comments
 (0)