|
@@ -536,6 +536,34 @@ static bool pmu_is_uncore(const char *name)
|
|
return !!cpus;
|
|
return !!cpus;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * PMU CORE devices have different name other than cpu in sysfs on some
|
|
|
|
+ * platforms. looking for possible sysfs files to identify as core device.
|
|
|
|
+ */
|
|
|
|
+static int is_pmu_core(const char *name)
|
|
|
|
+{
|
|
|
|
+ struct stat st;
|
|
|
|
+ char path[PATH_MAX];
|
|
|
|
+ const char *sysfs = sysfs__mountpoint();
|
|
|
|
+
|
|
|
|
+ if (!sysfs)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ /* Look for cpu sysfs (x86 and others) */
|
|
|
|
+ scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu", sysfs);
|
|
|
|
+ if ((stat(path, &st) == 0) &&
|
|
|
|
+ (strncmp(name, "cpu", strlen("cpu")) == 0))
|
|
|
|
+ return 1;
|
|
|
|
+
|
|
|
|
+ /* Look for cpu sysfs (specific to arm) */
|
|
|
|
+ scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus",
|
|
|
|
+ sysfs, name);
|
|
|
|
+ if (stat(path, &st) == 0)
|
|
|
|
+ return 1;
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* Return the CPU id as a raw string.
|
|
* Return the CPU id as a raw string.
|
|
*
|
|
*
|
|
@@ -609,7 +637,6 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
|
|
*/
|
|
*/
|
|
i = 0;
|
|
i = 0;
|
|
while (1) {
|
|
while (1) {
|
|
- const char *pname;
|
|
|
|
|
|
|
|
pe = &map->table[i++];
|
|
pe = &map->table[i++];
|
|
if (!pe->name) {
|
|
if (!pe->name) {
|
|
@@ -618,9 +645,13 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- pname = pe->pmu ? pe->pmu : "cpu";
|
|
|
|
- if (strncmp(pname, name, strlen(pname)))
|
|
|
|
- continue;
|
|
|
|
|
|
+ if (!is_pmu_core(name)) {
|
|
|
|
+ /* check for uncore devices */
|
|
|
|
+ if (pe->pmu == NULL)
|
|
|
|
+ continue;
|
|
|
|
+ if (strncmp(pe->pmu, name, strlen(pe->pmu)))
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
/* need type casts to override 'const' */
|
|
/* need type casts to override 'const' */
|
|
__perf_pmu__new_alias(head, NULL, (char *)pe->name,
|
|
__perf_pmu__new_alias(head, NULL, (char *)pe->name,
|