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: Enhance HT enumeration

Record the cpu_id of each CPU HT sibling -- will need this later.

Rename "thread_id" to "ht_id" to disambiguate that the scope
of this id is within a Core -- it is not a global cpu_id.

No functional change.

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

Len Brown 070e9236 ddf60e38

+19 -15
+19 -15
tools/power/x86/turbostat/turbostat.c
··· 2400 2400 int logical_cpu_id; 2401 2401 int physical_node_id; 2402 2402 int logical_node_id; /* 0-based count within the package */ 2403 - int thread_id; 2403 + int ht_id; /* unique within a core */ 2404 + int ht_sibling_cpu_id; 2404 2405 int type; 2405 2406 cpu_set_t *put_ids; /* Processing Unit/Thread IDs */ 2406 2407 } *cpus; ··· 6180 6179 int thread_id = 0; 6181 6180 6182 6181 thiscpu->put_ids = CPU_ALLOC((topo.max_cpu_num + 1)); 6183 - if (thiscpu->thread_id < 0) 6184 - thiscpu->thread_id = thread_id++; 6182 + if (thiscpu->ht_id < 0) 6183 + thiscpu->ht_id = thread_id++; 6185 6184 if (!thiscpu->put_ids) 6186 6185 return -1; 6187 6186 ··· 6205 6204 sib_core = get_core_id(so); 6206 6205 if (sib_core == thiscpu->core_id) { 6207 6206 CPU_SET_S(so, size, thiscpu->put_ids); 6208 - if ((so != cpu) && (cpus[so].thread_id < 0)) 6209 - cpus[so].thread_id = thread_id++; 6207 + if ((so != cpu) && (cpus[so].ht_id < 0)) { 6208 + cpus[so].ht_id = thread_id++; 6209 + cpus[cpu].ht_sibling_cpu_id = so; 6210 + } 6210 6211 } 6211 6212 } 6212 6213 } ··· 6391 6388 return 0; 6392 6389 } 6393 6390 6394 - int init_thread_id(int cpu) 6391 + int init_ht_id(int cpu) 6395 6392 { 6396 - cpus[cpu].thread_id = -1; 6393 + cpus[cpu].ht_id = -1; 6394 + cpus[cpu].ht_sibling_cpu_id = -1; 6397 6395 return 0; 6398 6396 } 6399 6397 ··· 9579 9575 cpu_affinity_setsize = CPU_ALLOC_SIZE((topo.max_cpu_num + 1)); 9580 9576 CPU_ZERO_S(cpu_affinity_setsize, cpu_affinity_set); 9581 9577 9582 - for_all_proc_cpus(init_thread_id); 9578 + for_all_proc_cpus(init_ht_id); 9583 9579 9584 9580 for_all_proc_cpus(set_cpu_hybrid_type); 9585 9581 9586 9582 /* 9587 9583 * For online cpus 9588 - * find max_core_id, max_package_id 9584 + * find max_core_id, max_package_id, num_cores (per system) 9589 9585 */ 9590 9586 for (i = 0; i <= topo.max_cpu_num; ++i) { 9591 9587 int siblings; ··· 9627 9623 siblings = get_thread_siblings(&cpus[i]); 9628 9624 if (siblings > max_siblings) 9629 9625 max_siblings = siblings; 9630 - if (cpus[i].thread_id == 0) 9626 + if (cpus[i].ht_id == 0) 9631 9627 topo.num_cores++; 9632 9628 } 9633 - topo.max_core_id = max_core_id; 9629 + topo.max_core_id = max_core_id; /* within a package */ 9634 9630 topo.max_package_id = max_package_id; 9631 + topo.num_cores = (max_core_id + 1) * topo.num_packages; /* per system */ 9635 9632 9636 9633 topo.cores_per_node = max_core_id + 1; 9637 9634 if (debug > 1) ··· 9674 9669 fprintf(outf, 9675 9670 "cpu %d pkg %d die %d l3 %d node %d lnode %d core %d thread %d\n", 9676 9671 i, cpus[i].package_id, cpus[i].die_id, cpus[i].l3_id, 9677 - cpus[i].physical_node_id, cpus[i].logical_node_id, cpus[i].core_id, cpus[i].thread_id); 9672 + cpus[i].physical_node_id, cpus[i].logical_node_id, cpus[i].core_id, cpus[i].ht_id); 9678 9673 } 9679 9674 9680 9675 } ··· 9732 9727 /* 9733 9728 * init_counter() 9734 9729 * 9735 - * set FIRST_THREAD_IN_CORE and FIRST_CORE_IN_PACKAGE 9730 + * set t->cpu_id, FIRST_THREAD_IN_CORE and FIRST_CORE_IN_PACKAGE 9736 9731 */ 9737 9732 void init_counter(struct thread_data *thread_base, struct core_data *core_base, struct pkg_data *pkg_base, int cpu_id) 9738 9733 { 9739 9734 int pkg_id = cpus[cpu_id].package_id; 9740 9735 int node_id = cpus[cpu_id].logical_node_id; 9741 9736 int core_id = cpus[cpu_id].core_id; 9742 - int thread_id = cpus[cpu_id].thread_id; 9743 9737 struct thread_data *t; 9744 9738 struct core_data *c; 9745 9739 ··· 9748 9744 if (node_id < 0) 9749 9745 node_id = 0; 9750 9746 9751 - t = GET_THREAD(thread_base, thread_id, core_id, node_id, pkg_id); 9747 + t = GET_THREAD(thread_base, cpus[cpu_id].ht_id, core_id, node_id, pkg_id); 9752 9748 c = GET_CORE(core_base, core_id, node_id, pkg_id); 9753 9749 9754 9750 t->cpu_id = cpu_id;