Skip to content

Commit f0fe9f3

Browse files
sandip4nPeter Zijlstra
authored andcommitted
perf/x86/amd/uncore: Add PerfMonV2 RDPMC assignments
The current RDPMC assignment scheme maps four DF PMCs and six L3 PMCs from index 6 to 15. If AMD Performance Monitoring Version 2 (PerfMonV2) is supported, there may be additional DF counters available which are mapped starting from index 16 i.e. just after the L3 counters. Update the RDPMC assignments accordingly. Signed-off-by: Sandipan Das <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/1359379ef34da760f108b075ac138ab082caa3ba.1652954372.git.sandipan.das@amd.com
1 parent c390241 commit f0fe9f3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

arch/x86/events/amd/uncore.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,16 @@ static int amd_uncore_add(struct perf_event *event, int flags)
158158
hwc->event_base_rdpmc = uncore->rdpmc_base + hwc->idx;
159159
hwc->state = PERF_HES_UPTODATE | PERF_HES_STOPPED;
160160

161+
/*
162+
* The first four DF counters are accessible via RDPMC index 6 to 9
163+
* followed by the L3 counters from index 10 to 15. For processors
164+
* with more than four DF counters, the DF RDPMC assignments become
165+
* discontiguous as the additional counters are accessible starting
166+
* from index 16.
167+
*/
168+
if (is_nb_event(event) && hwc->idx >= NUM_COUNTERS_NB)
169+
hwc->event_base_rdpmc += NUM_COUNTERS_L3;
170+
161171
if (flags & PERF_EF_START)
162172
amd_uncore_start(event, PERF_EF_RELOAD);
163173

0 commit comments

Comments
 (0)