Skip to content

Commit 506c4ff

Browse files
committed
linux/cpukinds: use Intel PMU directories to detect Atom/Core cpusets on Intel hybrid
Signed-off-by: Brice Goglin <[email protected]>
1 parent 079ac07 commit 506c4ff

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

doc/hwloc.doxy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2354,7 +2354,7 @@ as reported by some <tt>cpufreq</tt> drivers on Linux (e.g. <tt>intel_pstate</tt
23542354
<dt>CoreType (x86)</dt>
23552355
<dd>A string describing the kind of core,
23562356
currently <tt>IntelAtom</tt> or <tt>IntelCore</tt>,
2357-
as reported by the x86 CPUID instruction on some Intel processors.
2357+
as reported by the x86 CPUID instruction and Linux PMU on some Intel processors.
23582358
</dd>
23592359
<dt>LinuxCapacity (Linux)</dt>
23602360
<dd>The Linux-specific CPU capacity found in sysfs,

hwloc/topology-linux.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4510,6 +4510,7 @@ look_sysfscpukinds(struct hwloc_topology *topology,
45104510
int max_without_basefreq = 0; /* any cpu where we have maxfreq without basefreq? */
45114511
char str[293];
45124512
char *env;
4513+
hwloc_bitmap_t atom_pmu_set, core_pmu_set;
45134514
int maxfreq_enabled = -1; /* -1 means adjust (default), 0 means ignore, 1 means enforce */
45144515
unsigned adjust_max = 10;
45154516
int i;
@@ -4573,6 +4574,28 @@ look_sysfscpukinds(struct hwloc_topology *topology,
45734574
hwloc_linux_cpukinds_register(&cpu_capacity, topology, "LinuxCapacity", 1);
45744575
hwloc_linux_cpukinds_destroy(&cpu_capacity);
45754576

4577+
/* look at Intel core/atom PMUs */
4578+
atom_pmu_set = hwloc__alloc_read_path_as_cpulist("/sys/devices/cpu_atom/cpus", data->root_fd);
4579+
core_pmu_set = hwloc__alloc_read_path_as_cpulist("/sys/devices/cpu_core/cpus", data->root_fd);
4580+
if (atom_pmu_set) {
4581+
struct hwloc_info_s infoattr;
4582+
infoattr.name = (char *) "CoreType";
4583+
infoattr.value = (char *) "IntelAtom";
4584+
hwloc_internal_cpukinds_register(topology, atom_pmu_set, HWLOC_CPUKIND_EFFICIENCY_UNKNOWN, &infoattr, 1, 0);
4585+
/* the cpuset is given to the callee */
4586+
} else {
4587+
hwloc_bitmap_free(atom_pmu_set);
4588+
}
4589+
if (core_pmu_set) {
4590+
struct hwloc_info_s infoattr;
4591+
infoattr.name = (char *) "CoreType";
4592+
infoattr.value = (char *) "IntelCore";
4593+
hwloc_internal_cpukinds_register(topology, core_pmu_set, HWLOC_CPUKIND_EFFICIENCY_UNKNOWN, &infoattr, 1, 0);
4594+
/* the cpuset is given to the callee */
4595+
} else {
4596+
hwloc_bitmap_free(core_pmu_set);
4597+
}
4598+
45764599
return 0;
45774600
}
45784601

0 commit comments

Comments
 (0)