From e72c0d8ce202f7d4a611ffeb97e8fe6db4f6d431 Mon Sep 17 00:00:00 2001 From: Thomas Roehl Date: Tue, 17 Sep 2024 15:43:18 +0200 Subject: [PATCH] Intel Westmere (EX): Fix for Uncore units with ACCESSMODE=perf_event --- src/includes/perfmon_nehalem_counters.h | 6 ++++++ src/includes/perfmon_perfevent.h | 1 + src/perfmon.c | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/includes/perfmon_nehalem_counters.h b/src/includes/perfmon_nehalem_counters.h index abc5f5819..5b5f5d70c 100644 --- a/src/includes/perfmon_nehalem_counters.h +++ b/src/includes/perfmon_nehalem_counters.h @@ -65,3 +65,9 @@ static BoxMap nehalem_box_map[NUM_UNITS] = { [UNCORE] = {MSR_UNCORE_PERF_GLOBAL_CTRL, MSR_UNCORE_PERF_GLOBAL_STATUS, MSR_UNCORE_PERF_GLOBAL_OVF_CTRL, -1, 0, 0, 48} }; +static char* nehalem_translate_types[NUM_UNITS] = { + [FIXED] = "/sys/bus/event_source/devices/cpu", + [PMC] = "/sys/bus/event_source/devices/cpu", + [UNCORE] = "/sys/bus/event_source/devices/uncore", +}; + diff --git a/src/includes/perfmon_perfevent.h b/src/includes/perfmon_perfevent.h index 1794940a6..db9e59f80 100644 --- a/src/includes/perfmon_perfevent.h +++ b/src/includes/perfmon_perfevent.h @@ -1117,6 +1117,7 @@ int perfmon_setupCountersThread_perfevent( is_uncore = 1; break; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) + case UNCORE: case MBOX0: case MBOX1: case MBOX2: diff --git a/src/perfmon.c b/src/perfmon.c index b4588b07f..2322b50a5 100644 --- a/src/perfmon.c +++ b/src/perfmon.c @@ -984,7 +984,7 @@ perfmon_init_maps(void) counter_map = nehalem_counter_map; perfmon_numCounters = perfmon_numCountersNehalem; box_map = nehalem_box_map; - translate_types = default_translate_types; + translate_types = nehalem_translate_types; break; case NEHALEM_WESTMERE_M: @@ -994,7 +994,7 @@ perfmon_init_maps(void) counter_map = nehalem_counter_map; perfmon_numCounters = perfmon_numCountersNehalem; box_map = nehalem_box_map; - translate_types = default_translate_types; + translate_types = nehalem_translate_types; break; case IVYBRIDGE_EP: