File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,16 @@ static void amd_uncore_read(struct perf_event *event)
96
96
*/
97
97
98
98
prev = local64_read (& hwc -> prev_count );
99
- rdpmcl (hwc -> event_base_rdpmc , new );
99
+
100
+ /*
101
+ * Some uncore PMUs do not have RDPMC assignments. In such cases,
102
+ * read counts directly from the corresponding PERF_CTR.
103
+ */
104
+ if (hwc -> event_base_rdpmc < 0 )
105
+ rdmsrl (hwc -> event_base , new );
106
+ else
107
+ rdpmcl (hwc -> event_base_rdpmc , new );
108
+
100
109
local64_set (& hwc -> prev_count , new );
101
110
delta = (new << COUNTER_SHIFT ) - (prev << COUNTER_SHIFT );
102
111
delta >>= COUNTER_SHIFT ;
@@ -164,6 +173,9 @@ static int amd_uncore_add(struct perf_event *event, int flags)
164
173
hwc -> event_base_rdpmc = pmu -> rdpmc_base + hwc -> idx ;
165
174
hwc -> state = PERF_HES_UPTODATE | PERF_HES_STOPPED ;
166
175
176
+ if (pmu -> rdpmc_base < 0 )
177
+ hwc -> event_base_rdpmc = -1 ;
178
+
167
179
if (flags & PERF_EF_START )
168
180
event -> pmu -> start (event , PERF_EF_RELOAD );
169
181
You can’t perform that action at this time.
0 commit comments