Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/power turbostat: Rename physical_core_id to core_id

The Linux Kernel topology sysfs is flawed.
core_id is not globally unique, but is per-package.

Turbostat works around this when it needs to, with

rapl_core_id = cpus[cpu].core_id;
rapl_core_id += cpus[cpu].package_id * nr_cores_per_package

Otherwise, turbostat handles core_id as subservient to each package.

As there is only one core_id namespace, rename
physical_core_id to simply be core_id.

No functional change.

Signed-off-by: Len Brown <len.brown@intel.com>

Len Brown 5e160646 4aaf7d07

+10 -10
+10 -10
tools/power/x86/turbostat/turbostat.c
··· 2394 2394 } platform_counters_odd, platform_counters_even; 2395 2395 2396 2396 struct cpu_topology { 2397 + int core_id; 2397 2398 int package_id; 2398 2399 int die_id; 2399 2400 int l3_id; 2400 2401 int logical_cpu_id; 2401 2402 int physical_node_id; 2402 2403 int logical_node_id; /* 0-based count within the package */ 2403 - int physical_core_id; 2404 2404 int thread_id; 2405 2405 int type; 2406 2406 cpu_set_t *put_ids; /* Processing Unit/Thread IDs */ ··· 2658 2658 return cpu; 2659 2659 2660 2660 case SCOPE_CORE: 2661 - return cpus[cpu].physical_core_id; 2661 + return cpus[cpu].core_id; 2662 2662 2663 2663 case SCOPE_PACKAGE: 2664 2664 return cpus[cpu].package_id; ··· 5180 5180 return cpus[cpu].package_id; 5181 5181 5182 5182 /* Compute the system-wide unique core-id for @cpu */ 5183 - rapl_core_id = cpus[cpu].physical_core_id; 5183 + rapl_core_id = cpus[cpu].core_id; 5184 5184 rapl_core_id += cpus[cpu].package_id * nr_cores_per_package; 5185 5185 5186 5186 return rapl_core_id; ··· 6216 6216 if ((map >> shift) & 0x1) { 6217 6217 so = shift + offset; 6218 6218 sib_core = get_core_id(so); 6219 - if (sib_core == thiscpu->physical_core_id) { 6219 + if (sib_core == thiscpu->core_id) { 6220 6220 CPU_SET_S(so, size, thiscpu->put_ids); 6221 6221 if ((so != cpu) && (cpus[so].thread_id < 0)) 6222 6222 cpus[so].thread_id = thread_id++; ··· 8948 8948 if (cpu_is_not_allowed(cpu)) 8949 8949 continue; 8950 8950 8951 - const int core_id = cpus[cpu].physical_core_id; 8951 + const int core_id = cpus[cpu].core_id; 8952 8952 const int pkg_id = cpus[cpu].package_id; 8953 8953 8954 8954 assert(core_id < cores_visited_elems); ··· 9629 9629 topo.max_node_num = cpus[i].physical_node_id; 9630 9630 9631 9631 /* get core information */ 9632 - cpus[i].physical_core_id = get_core_id(i); 9633 - if (cpus[i].physical_core_id > max_core_id) 9634 - max_core_id = cpus[i].physical_core_id; 9632 + cpus[i].core_id = get_core_id(i); 9633 + if (cpus[i].core_id > max_core_id) 9634 + max_core_id = cpus[i].core_id; 9635 9635 9636 9636 /* get thread information */ 9637 9637 siblings = get_thread_siblings(&cpus[i]); ··· 9683 9683 fprintf(outf, 9684 9684 "cpu %d pkg %d die %d l3 %d node %d lnode %d core %d thread %d\n", 9685 9685 i, cpus[i].package_id, cpus[i].die_id, cpus[i].l3_id, 9686 - cpus[i].physical_node_id, cpus[i].logical_node_id, cpus[i].physical_core_id, cpus[i].thread_id); 9686 + cpus[i].physical_node_id, cpus[i].logical_node_id, cpus[i].core_id, cpus[i].thread_id); 9687 9687 } 9688 9688 9689 9689 } ··· 9731 9731 { 9732 9732 int pkg_id = cpus[cpu_id].package_id; 9733 9733 int node_id = cpus[cpu_id].logical_node_id; 9734 - int core_id = cpus[cpu_id].physical_core_id; 9734 + int core_id = cpus[cpu_id].core_id; 9735 9735 int thread_id = cpus[cpu_id].thread_id; 9736 9736 struct thread_data *t; 9737 9737 struct core_data *c;