|
@@ -36,6 +36,7 @@
|
|
|
|
|
|
static int num_counters_llc;
|
|
|
static int num_counters_nb;
|
|
|
+static bool l3_mask;
|
|
|
|
|
|
static HLIST_HEAD(uncore_unused_list);
|
|
|
|
|
@@ -209,6 +210,13 @@ static int amd_uncore_event_init(struct perf_event *event)
|
|
|
hwc->config = event->attr.config & AMD64_RAW_EVENT_MASK_NB;
|
|
|
hwc->idx = -1;
|
|
|
|
|
|
+ /*
|
|
|
+ * SliceMask and ThreadMask need to be set for certain L3 events in
|
|
|
+ * Family 17h. For other events, the two fields do not affect the count.
|
|
|
+ */
|
|
|
+ if (l3_mask)
|
|
|
+ hwc->config |= (AMD64_L3_SLICE_MASK | AMD64_L3_THREAD_MASK);
|
|
|
+
|
|
|
if (event->cpu < 0)
|
|
|
return -EINVAL;
|
|
|
|
|
@@ -525,6 +533,7 @@ static int __init amd_uncore_init(void)
|
|
|
amd_llc_pmu.name = "amd_l3";
|
|
|
format_attr_event_df.show = &event_show_df;
|
|
|
format_attr_event_l3.show = &event_show_l3;
|
|
|
+ l3_mask = true;
|
|
|
} else {
|
|
|
num_counters_nb = NUM_COUNTERS_NB;
|
|
|
num_counters_llc = NUM_COUNTERS_L2;
|
|
@@ -532,6 +541,7 @@ static int __init amd_uncore_init(void)
|
|
|
amd_llc_pmu.name = "amd_l2";
|
|
|
format_attr_event_df = format_attr_event;
|
|
|
format_attr_event_l3 = format_attr_event;
|
|
|
+ l3_mask = false;
|
|
|
}
|
|
|
|
|
|
amd_nb_pmu.attr_groups = amd_uncore_attr_groups_df;
|