Skip to content

Commit 76958a6

Browse files
Robert RichterIngo Molnar
Robert Richter
authored and
Ingo Molnar
committed
perf/x86/amd: Fix RDPMC index calculation for AMD family 15h
The RDPMC index calculation is wrong for AMD family 15h (X86_FEATURE_ PERFCTR_CORE set). This leads to a #GP when accessing the counter: Pid: 2237, comm: syslog-ng Not tainted 3.5.0-rc1-perf-x86_64-standard-g130ff90 #135 AMD Pike/Pike RIP: 0010:[<ffffffff8100dc33>] [<ffffffff8100dc33>] x86_perf_event_update+0x27/0x66 While the msr address offset is (index << 1) we must use index to select the correct rdpmc. Signed-off-by: Robert Richter <[email protected]> Acked-by: Peter Zijlstra <[email protected]> Cc: Vince Weaver <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 4983955 commit 76958a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kernel/cpu/perf_event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ static inline void x86_assign_hw_event(struct perf_event *event,
823823
} else {
824824
hwc->config_base = x86_pmu_config_addr(hwc->idx);
825825
hwc->event_base = x86_pmu_event_addr(hwc->idx);
826-
hwc->event_base_rdpmc = x86_pmu_addr_offset(hwc->idx);
826+
hwc->event_base_rdpmc = hwc->idx;
827827
}
828828
}
829829

0 commit comments

Comments
 (0)