{ 0x0, "Any%C0", NULL, 0, 0, 0, NULL, 0 },
{ 0x0, "GFX%C0", NULL, 0, 0, 0, NULL, 0 },
{ 0x0, "CPUGFX%", NULL, 0, 0, 0, NULL, 0 },
+ { 0x0, "Module", NULL, 0, 0, 0, NULL, 0 },
{ 0x0, "Core", NULL, 0, 0, 0, NULL, 0 },
{ 0x0, "CPU", NULL, 0, 0, 0, NULL, 0 },
{ 0x0, "APIC", NULL, 0, 0, 0, NULL, 0 },
BIC_Any_c0,
BIC_GFX_c0,
BIC_CPUGFX,
+ BIC_Module,
BIC_Core,
BIC_CPU,
BIC_APIC,
SET_BIC(BIC_Node, &bic_group_topology);
SET_BIC(BIC_CoreCnt, &bic_group_topology);
SET_BIC(BIC_PkgCnt, &bic_group_topology);
+ SET_BIC(BIC_Module, &bic_group_topology);
SET_BIC(BIC_Core, &bic_group_topology);
SET_BIC(BIC_CPU, &bic_group_topology);
SET_BIC(BIC_Die, &bic_group_topology);
struct cpu_topology {
int cpu_id;
int core_id; /* unique within a package */
+ int module_id;
int package_id;
int die_id;
int l3_id;
int allowed_cores;
int max_cpu_num;
int max_core_id; /* within a package */
+ int min_module_id; /* system wide */
+ int max_module_id; /* system wide */
int max_package_id;
int max_die_id;
int max_l3_id;
outp += sprintf(outp, "%sL3", (printed++ ? delim : ""));
if (DO_BIC(BIC_Node))
outp += sprintf(outp, "%sNode", (printed++ ? delim : ""));
+ if (DO_BIC(BIC_Module))
+ outp += sprintf(outp, "%sModule", (printed++ ? delim : ""));
if (DO_BIC(BIC_Core))
outp += sprintf(outp, "%sCore", (printed++ ? delim : ""));
if (DO_BIC(BIC_CPU))
outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
if (DO_BIC(BIC_Node))
outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
+ if (DO_BIC(BIC_Module))
+ outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
if (DO_BIC(BIC_Core))
outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
if (DO_BIC(BIC_CPU))
else
outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
}
+ if (DO_BIC(BIC_Module)) {
+ if (c)
+ outp += sprintf(outp, "%s0x%x", (printed++ ? delim : ""), cpus[t->cpu_id].module_id);
+ else
+ outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
+ }
if (DO_BIC(BIC_Core)) {
if (c)
outp += sprintf(outp, "%s0x%x", (printed++ ? delim : ""), cpus[t->cpu_id].core_id);
return parse_int_file("/sys/devices/system/cpu/cpu%d/cache/index3/id", cpu);
}
+int get_module_id(int cpu)
+{
+ return parse_int_file("/sys/devices/system/cpu/cpu%d/topology/cluster_id", cpu);
+}
+
int get_core_id(int cpu)
{
return parse_int_file("/sys/devices/system/cpu/cpu%d/topology/core_id", cpu);
* For online cpus
* find max_core_id, max_package_id, num_cores (per system)
*/
+ topo.min_module_id = 0x7FFFFFFF;
for (i = 0; i <= topo.max_cpu_num; ++i) {
int siblings;
if (cpus[i].physical_node_id > topo.max_node_num)
topo.max_node_num = cpus[i].physical_node_id;
+ /* get module information */
+ cpus[i].module_id = get_module_id(i);
+ if (cpus[i].module_id > topo.max_module_id)
+ topo.max_module_id = cpus[i].module_id;
+ if (cpus[i].module_id < topo.min_module_id)
+ topo.min_module_id = cpus[i].module_id;
+
/* get core information */
cpus[i].core_id = get_core_id(i);
if (cpus[i].core_id > max_core_id)
if (!summary_only)
BIC_PRESENT(BIC_Core);
+ if (debug > 1)
+ fprintf(outf, "min_module_id %d max_module_id %d\n", topo.min_module_id, topo.max_module_id);
+ if (!summary_only && (topo.min_module_id != topo.max_module_id))
+ BIC_PRESENT(BIC_Module);
+
topo.num_die = topo.max_die_id + 1;
if (debug > 1)
fprintf(outf, "max_die_id %d, sizing for %d die\n", topo.max_die_id, topo.num_die);
if (cpu_is_not_present(i))
continue;
fprintf(outf,
- "cpu %d pkg %d die %d l3 %d node %d lnode %d core %d ht_id %d",
+ "cpu %d pkg %d die %d l3 %d node %d lnode %d module 0x%x core %d ht_id %d",
i, cpus[i].package_id, cpus[i].die_id, cpus[i].l3_id,
- cpus[i].physical_node_id, cpus[i].logical_node_id, cpus[i].core_id, cpus[i].ht_id);
+ cpus[i].physical_node_id, cpus[i].logical_node_id, cpus[i].module_id, cpus[i].core_id, cpus[i].ht_id);
fprintf(outf, " siblings");
for (ht_id = 0; ht_id <= MAX_HT_ID; ++ht_id)
fprintf(outf, " %d", cpus[i].ht_sibling_cpu_id[ht_id]);