Skip to content

Commit 9a54af4

Browse files
committed
x86: use a global is_hybrid flag
The Intel hybrid feature bit is reserved on AMD, so define our own flag that we'll update separately on AMD later. By the way, restrict the Intel cpukinds code to Intel now that it depends on that non-Intel-specific flag. Signed-off-by: Brice Goglin <[email protected]>
1 parent e40c3aa commit 9a54af4

File tree

1 file changed

+36
-29
lines changed

1 file changed

+36
-29
lines changed

hwloc/topology-x86.c

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct hwloc_x86_backend_data_s {
3838
int apicid_unique;
3939
char *src_cpuiddump_path;
4040
int is_knl;
41+
int is_hybrid;
4142
};
4243

4344
/************************************
@@ -704,12 +705,13 @@ static void look_proc(struct hwloc_backend *backend, struct procinfo *infos, uns
704705
}
705706

706707
if (highest_cpuid >= 0x1a && has_hybrid(features)) {
707-
/* Get hybrid cpu information from cpuid 0x1a */
708+
/* Get hybrid cpu information from cpuid 0x1a on Intel */
708709
eax = 0x1a;
709710
ecx = 0;
710711
cpuid_or_from_dump(&eax, &ebx, &ecx, &edx, src_cpuiddump);
711712
infos->hybridcoretype = eax >> 24;
712713
infos->hybridnativemodel = eax & 0xffffff;
714+
data->is_hybrid = 1;
713715
}
714716

715717
/*********************************************************************************
@@ -1349,35 +1351,39 @@ look_procs(struct hwloc_backend *backend, struct procinfo *infos, unsigned long
13491351
if (data->apicid_unique) {
13501352
summarize(backend, infos, flags);
13511353

1352-
if (has_hybrid(features) && !(topology->flags & HWLOC_TOPOLOGY_FLAG_NO_CPUKINDS)) {
1354+
if (data->is_hybrid
1355+
&& !(topology->flags & HWLOC_TOPOLOGY_FLAG_NO_CPUKINDS)) {
13531356
/* use hybrid info for cpukinds */
1354-
hwloc_bitmap_t atomset = hwloc_bitmap_alloc();
1355-
hwloc_bitmap_t coreset = hwloc_bitmap_alloc();
1356-
for(i=0; i<nbprocs; i++) {
1357-
if (infos[i].hybridcoretype == 0x20)
1358-
hwloc_bitmap_set(atomset, i);
1359-
else if (infos[i].hybridcoretype == 0x40)
1360-
hwloc_bitmap_set(coreset, i);
1361-
}
1362-
/* register IntelAtom set if any */
1363-
if (!hwloc_bitmap_iszero(atomset)) {
1364-
struct hwloc_info_s infoattr;
1365-
infoattr.name = (char *) "CoreType";
1366-
infoattr.value = (char *) "IntelAtom";
1367-
hwloc_internal_cpukinds_register(topology, atomset, HWLOC_CPUKIND_EFFICIENCY_UNKNOWN, &infoattr, 1, 0);
1368-
/* the cpuset is given to the callee */
1369-
} else {
1370-
hwloc_bitmap_free(atomset);
1371-
}
1372-
/* register IntelCore set if any */
1373-
if (!hwloc_bitmap_iszero(coreset)) {
1374-
struct hwloc_info_s infoattr;
1375-
infoattr.name = (char *) "CoreType";
1376-
infoattr.value = (char *) "IntelCore";
1377-
hwloc_internal_cpukinds_register(topology, coreset, HWLOC_CPUKIND_EFFICIENCY_UNKNOWN, &infoattr, 1, 0);
1378-
/* the cpuset is given to the callee */
1379-
} else {
1380-
hwloc_bitmap_free(coreset);
1357+
if (cpuid_type == intel) {
1358+
/* Hybrid Intel */
1359+
hwloc_bitmap_t atomset = hwloc_bitmap_alloc();
1360+
hwloc_bitmap_t coreset = hwloc_bitmap_alloc();
1361+
for(i=0; i<nbprocs; i++) {
1362+
if (infos[i].hybridcoretype == 0x20)
1363+
hwloc_bitmap_set(atomset, i);
1364+
else if (infos[i].hybridcoretype == 0x40)
1365+
hwloc_bitmap_set(coreset, i);
1366+
}
1367+
/* register IntelAtom set if any */
1368+
if (!hwloc_bitmap_iszero(atomset)) {
1369+
struct hwloc_info_s infoattr;
1370+
infoattr.name = (char *) "CoreType";
1371+
infoattr.value = (char *) "IntelAtom";
1372+
hwloc_internal_cpukinds_register(topology, atomset, HWLOC_CPUKIND_EFFICIENCY_UNKNOWN, &infoattr, 1, 0);
1373+
/* the cpuset is given to the callee */
1374+
} else {
1375+
hwloc_bitmap_free(atomset);
1376+
}
1377+
/* register IntelCore set if any */
1378+
if (!hwloc_bitmap_iszero(coreset)) {
1379+
struct hwloc_info_s infoattr;
1380+
infoattr.name = (char *) "CoreType";
1381+
infoattr.value = (char *) "IntelCore";
1382+
hwloc_internal_cpukinds_register(topology, coreset, HWLOC_CPUKIND_EFFICIENCY_UNKNOWN, &infoattr, 1, 0);
1383+
/* the cpuset is given to the callee */
1384+
} else {
1385+
hwloc_bitmap_free(coreset);
1386+
}
13811387
}
13821388
}
13831389
}
@@ -1825,6 +1831,7 @@ hwloc_x86_component_instantiate(struct hwloc_topology *topology,
18251831

18261832
/* default values */
18271833
data->is_knl = 0;
1834+
data->is_hybrid = 0;
18281835
data->apicid_set = hwloc_bitmap_alloc();
18291836
data->apicid_unique = 1;
18301837
data->src_cpuiddump_path = NULL;

0 commit comments

Comments
 (0)