|
@@ -73,18 +73,22 @@ int get_cpu_topology(struct cpupower_topology *cpu_top)
|
|
|
for (cpu = 0; cpu < cpus; cpu++) {
|
|
|
cpu_top->core_info[cpu].cpu = cpu;
|
|
|
cpu_top->core_info[cpu].is_online = sysfs_is_cpu_online(cpu);
|
|
|
- if (!cpu_top->core_info[cpu].is_online)
|
|
|
- continue;
|
|
|
if(sysfs_topology_read_file(
|
|
|
cpu,
|
|
|
"physical_package_id",
|
|
|
- &(cpu_top->core_info[cpu].pkg)) < 0)
|
|
|
- return -1;
|
|
|
+ &(cpu_top->core_info[cpu].pkg)) < 0) {
|
|
|
+ cpu_top->core_info[cpu].pkg = -1;
|
|
|
+ cpu_top->core_info[cpu].core = -1;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
if(sysfs_topology_read_file(
|
|
|
cpu,
|
|
|
"core_id",
|
|
|
- &(cpu_top->core_info[cpu].core)) < 0)
|
|
|
- return -1;
|
|
|
+ &(cpu_top->core_info[cpu].core)) < 0) {
|
|
|
+ cpu_top->core_info[cpu].pkg = -1;
|
|
|
+ cpu_top->core_info[cpu].core = -1;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
qsort(cpu_top->core_info, cpus, sizeof(struct cpuid_core_info),
|
|
@@ -95,12 +99,15 @@ int get_cpu_topology(struct cpupower_topology *cpu_top)
|
|
|
done by pkg value. */
|
|
|
last_pkg = cpu_top->core_info[0].pkg;
|
|
|
for(cpu = 1; cpu < cpus; cpu++) {
|
|
|
- if(cpu_top->core_info[cpu].pkg != last_pkg) {
|
|
|
+ if (cpu_top->core_info[cpu].pkg != last_pkg &&
|
|
|
+ cpu_top->core_info[cpu].pkg != -1) {
|
|
|
+
|
|
|
last_pkg = cpu_top->core_info[cpu].pkg;
|
|
|
cpu_top->pkgs++;
|
|
|
}
|
|
|
}
|
|
|
- cpu_top->pkgs++;
|
|
|
+ if (!cpu_top->core_info[0].pkg == -1)
|
|
|
+ cpu_top->pkgs++;
|
|
|
|
|
|
/* Intel's cores count is not consecutively numbered, there may
|
|
|
* be a core_id of 3, but none of 2. Assume there always is 0
|