Skip to content

Commit

Permalink
linux/cpukinds: remove sysfs cpu type support
Browse files Browse the repository at this point in the history
The kernel will rather use the "cpu_capacity" file,
cpu types support has never been merged.

This basically reverts 04a4977

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
  • Loading branch information
bgoglin committed Jun 30, 2021
1 parent 82ff122 commit 6ed7e9d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 50 deletions.
5 changes: 2 additions & 3 deletions doc/hwloc.doxy
Expand Up @@ -2195,11 +2195,10 @@ as reported by <tt>cpufreq</tt> drivers on Linux.
<dd>The base operating frequency of the core,
as reported by some <tt>cpufreq</tt> drivers on Linux (e.g. <tt>intel_pstate</tt>).
</dd>
<dt>CoreType (x86, Linux)</dt>
<dt>CoreType (x86)</dt>
<dd>A string describing the kind of core,
currently <tt>IntelAtom</tt> or <tt>IntelCore</tt>,
as reported by the x86 CPUID instruction and future Linux kernels
on some Intel processors.
as reported by the x86 CPUID instruction on some Intel processors.
</dd>
<dt>LinuxCapacity (Linux)</dt>
<dd>The Linux-specific CPU capacity found in sysfs,
Expand Down
40 changes: 0 additions & 40 deletions hwloc/topology-linux.c
Expand Up @@ -4189,7 +4189,6 @@ look_sysfscpukinds(struct hwloc_topology *topology,
struct hwloc_linux_cpukinds cpufreqs_max, cpufreqs_base, cpu_capacity;
char str[293];
int i;
DIR *dir;

/* look at the PU base+max frequency */
hwloc_linux_cpukinds_init(&cpufreqs_max);
Expand Down Expand Up @@ -4223,45 +4222,6 @@ look_sysfscpukinds(struct hwloc_topology *topology,
hwloc_linux_cpukinds_register(&cpu_capacity, topology, "LinuxCapacity", 1);
hwloc_linux_cpukinds_destroy(&cpu_capacity);

dir = hwloc_opendir("/sys/devices/system/cpu/types", data->root_fd); /* "types" is not in /sys/bus/cpu */
if (dir) {
struct dirent *dirent;
while ((dirent = readdir(dir)) != NULL) {
hwloc_bitmap_t cpukind_cpuset;

if (*dirent->d_name == '.')
continue;

sprintf(str, "/sys/devices/system/cpu/types/%s/cpumap", dirent->d_name);
cpukind_cpuset = hwloc__alloc_read_path_as_cpumask(str, data->root_fd);
if (cpukind_cpuset) {
if (!hwloc_bitmap_iszero(cpukind_cpuset)) {
struct hwloc_info_s infos[2];
unsigned nr_infos = 0;
/* expose a convenient CoreType if any */
if (!strncmp(dirent->d_name, "intel_atom", 10)) {
infos[nr_infos].name = (char*) "CoreType";
infos[nr_infos].value = (char*) "IntelAtom";
nr_infos++;
} else if (!strncmp(dirent->d_name, "intel_core", 10)) {
infos[nr_infos].name = (char*) "CoreType";
infos[nr_infos].value = (char*) "IntelCore";
nr_infos++;
}
/* then expose the raw LinuxCPUType */
infos[nr_infos].name = (char*) "LinuxCPUType";
infos[nr_infos].value = dirent->d_name;
nr_infos++;

hwloc_internal_cpukinds_register(topology, cpukind_cpuset, HWLOC_CPUKIND_EFFICIENCY_UNKNOWN, infos, nr_infos, 0);
} else {
hwloc_bitmap_free(cpukind_cpuset);
}
}
}
closedir(dir);
}

return 0;
}

Expand Down
3 changes: 0 additions & 3 deletions tests/hwloc/linux/fakeheterocpunuma.output
Expand Up @@ -94,16 +94,13 @@
<cpukind cpuset="0x00fff000">
<info name="FrequencyMaxMHz" value="2000"/>
<info name="FrequencyBaseMHz" value="1200"/>
<info name="LinuxCPUType" value="foo_bar"/>
</cpukind>
<cpukind cpuset="0x000000ff">
<info name="FrequencyMaxMHz" value="3000"/>
<info name="FrequencyBaseMHz" value="2500"/>
<info name="LinuxCPUType" value="foo_baz"/>
</cpukind>
<cpukind cpuset="0x00000f00">
<info name="FrequencyMaxMHz" value="3000"/>
<info name="FrequencyBaseMHz" value="1200"/>
<info name="LinuxCPUType" value="foo_baz"/>
</cpukind>
</topology>
4 changes: 0 additions & 4 deletions utils/hwloc/test-hwloc-info.output
Expand Up @@ -485,15 +485,12 @@ Machine L#0
cpukind = 0 (partially)
cpukind info FrequencyMaxMHz = 2000
cpukind info FrequencyBaseMHz = 1200
cpukind info LinuxCPUType = foo_bar
cpukind = 1 (partially)
cpukind info FrequencyMaxMHz = 3000
cpukind info FrequencyBaseMHz = 2500
cpukind info LinuxCPUType = foo_baz
cpukind = 2 (partially)
cpukind info FrequencyMaxMHz = 3000
cpukind info FrequencyBaseMHz = 1200
cpukind info LinuxCPUType = foo_baz

# cpukind for a single PU
PU L#15
Expand All @@ -518,5 +515,4 @@ PU L#15
cpukind = 0
cpukind info FrequencyMaxMHz = 2000
cpukind info FrequencyBaseMHz = 1200
cpukind info LinuxCPUType = foo_bar

0 comments on commit 6ed7e9d

Please sign in to comment.