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: Show module_id column

Get the "module_id" from the Linux topology "cluster_id".
If the there is more than one id, show it by default.

Module joins Die etc. in the "topology" group.

Display in hex, as it is usually based mask of the APIC-id

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

+36 -2
+36 -2
tools/power/x86/turbostat/turbostat.c
··· 191 191 { 0x0, "Any%C0", NULL, 0, 0, 0, NULL, 0 }, 192 192 { 0x0, "GFX%C0", NULL, 0, 0, 0, NULL, 0 }, 193 193 { 0x0, "CPUGFX%", NULL, 0, 0, 0, NULL, 0 }, 194 + { 0x0, "Module", NULL, 0, 0, 0, NULL, 0 }, 194 195 { 0x0, "Core", NULL, 0, 0, 0, NULL, 0 }, 195 196 { 0x0, "CPU", NULL, 0, 0, 0, NULL, 0 }, 196 197 { 0x0, "APIC", NULL, 0, 0, 0, NULL, 0 }, ··· 265 264 BIC_Any_c0, 266 265 BIC_GFX_c0, 267 266 BIC_CPUGFX, 267 + BIC_Module, 268 268 BIC_Core, 269 269 BIC_CPU, 270 270 BIC_APIC, ··· 366 364 SET_BIC(BIC_Node, &bic_group_topology); 367 365 SET_BIC(BIC_CoreCnt, &bic_group_topology); 368 366 SET_BIC(BIC_PkgCnt, &bic_group_topology); 367 + SET_BIC(BIC_Module, &bic_group_topology); 369 368 SET_BIC(BIC_Core, &bic_group_topology); 370 369 SET_BIC(BIC_CPU, &bic_group_topology); 371 370 SET_BIC(BIC_Die, &bic_group_topology); ··· 2386 2383 struct cpu_topology { 2387 2384 int cpu_id; 2388 2385 int core_id; /* unique within a package */ 2386 + int module_id; 2389 2387 int package_id; 2390 2388 int die_id; 2391 2389 int l3_id; ··· 2408 2404 int allowed_cores; 2409 2405 int max_cpu_num; 2410 2406 int max_core_id; /* within a package */ 2407 + int min_module_id; /* system wide */ 2408 + int max_module_id; /* system wide */ 2411 2409 int max_package_id; 2412 2410 int max_die_id; 2413 2411 int max_l3_id; ··· 2925 2919 outp += sprintf(outp, "%sL3", (printed++ ? delim : "")); 2926 2920 if (DO_BIC(BIC_Node)) 2927 2921 outp += sprintf(outp, "%sNode", (printed++ ? delim : "")); 2922 + if (DO_BIC(BIC_Module)) 2923 + outp += sprintf(outp, "%sModule", (printed++ ? delim : "")); 2928 2924 if (DO_BIC(BIC_Core)) 2929 2925 outp += sprintf(outp, "%sCore", (printed++ ? delim : "")); 2930 2926 if (DO_BIC(BIC_CPU)) ··· 3396 3388 outp += sprintf(outp, "%s-", (printed++ ? delim : "")); 3397 3389 if (DO_BIC(BIC_Node)) 3398 3390 outp += sprintf(outp, "%s-", (printed++ ? delim : "")); 3391 + if (DO_BIC(BIC_Module)) 3392 + outp += sprintf(outp, "%s-", (printed++ ? delim : "")); 3399 3393 if (DO_BIC(BIC_Core)) 3400 3394 outp += sprintf(outp, "%s-", (printed++ ? delim : "")); 3401 3395 if (DO_BIC(BIC_CPU)) ··· 3428 3418 if (DO_BIC(BIC_Node)) { 3429 3419 if (t) 3430 3420 outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), cpus[t->cpu_id].physical_node_id); 3421 + else 3422 + outp += sprintf(outp, "%s-", (printed++ ? delim : "")); 3423 + } 3424 + if (DO_BIC(BIC_Module)) { 3425 + if (c) 3426 + outp += sprintf(outp, "%s0x%x", (printed++ ? delim : ""), cpus[t->cpu_id].module_id); 3431 3427 else 3432 3428 outp += sprintf(outp, "%s-", (printed++ ? delim : "")); 3433 3429 } ··· 6093 6077 int get_l3_id(int cpu) 6094 6078 { 6095 6079 return parse_int_file("/sys/devices/system/cpu/cpu%d/cache/index3/id", cpu); 6080 + } 6081 + 6082 + int get_module_id(int cpu) 6083 + { 6084 + return parse_int_file("/sys/devices/system/cpu/cpu%d/topology/cluster_id", cpu); 6096 6085 } 6097 6086 6098 6087 int get_core_id(int cpu) ··· 9662 9641 * For online cpus 9663 9642 * find max_core_id, max_package_id, num_cores (per system) 9664 9643 */ 9644 + topo.min_module_id = 0x7FFFFFFF; 9665 9645 for (i = 0; i <= topo.max_cpu_num; ++i) { 9666 9646 int siblings; 9667 9647 ··· 9694 9672 if (cpus[i].physical_node_id > topo.max_node_num) 9695 9673 topo.max_node_num = cpus[i].physical_node_id; 9696 9674 9675 + /* get module information */ 9676 + cpus[i].module_id = get_module_id(i); 9677 + if (cpus[i].module_id > topo.max_module_id) 9678 + topo.max_module_id = cpus[i].module_id; 9679 + if (cpus[i].module_id < topo.min_module_id) 9680 + topo.min_module_id = cpus[i].module_id; 9681 + 9697 9682 /* get core information */ 9698 9683 cpus[i].core_id = get_core_id(i); 9699 9684 if (cpus[i].core_id > max_core_id) ··· 9721 9692 fprintf(outf, "max_core_id %d, sizing for %d cores per package\n", max_core_id, topo.cores_per_pkg); 9722 9693 if (!summary_only) 9723 9694 BIC_PRESENT(BIC_Core); 9695 + 9696 + if (debug > 1) 9697 + fprintf(outf, "min_module_id %d max_module_id %d\n", topo.min_module_id, topo.max_module_id); 9698 + if (!summary_only && (topo.min_module_id != topo.max_module_id)) 9699 + BIC_PRESENT(BIC_Module); 9724 9700 9725 9701 topo.num_die = topo.max_die_id + 1; 9726 9702 if (debug > 1) ··· 9761 9727 if (cpu_is_not_present(i)) 9762 9728 continue; 9763 9729 fprintf(outf, 9764 - "cpu %d pkg %d die %d l3 %d node %d lnode %d core %d ht_id %d", 9730 + "cpu %d pkg %d die %d l3 %d node %d lnode %d module 0x%x core %d ht_id %d", 9765 9731 i, cpus[i].package_id, cpus[i].die_id, cpus[i].l3_id, 9766 - cpus[i].physical_node_id, cpus[i].logical_node_id, cpus[i].core_id, cpus[i].ht_id); 9732 + cpus[i].physical_node_id, cpus[i].logical_node_id, cpus[i].module_id, cpus[i].core_id, cpus[i].ht_id); 9767 9733 fprintf(outf, " siblings"); 9768 9734 for (ht_id = 0; ht_id <= MAX_HT_ID; ++ht_id) 9769 9735 fprintf(outf, " %d", cpus[i].ht_sibling_cpu_id[ht_id]);