diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -871,6 +871,15 @@ nchildren = 0; node = root; while (node != NULL) { + /* + * When some APICs are disabled, a node could be empty. It + * doesn't make sense to create a cpu group for an emtpy node. + * For that reason, skip it. + */ + if (CPU_EMPTY(&node->cpuset)) { + node = topo_next_node(root, node); + continue; + } if (CPU_CMP(&node->cpuset, &root->cpuset) == 0) { if (node->type == TOPO_TYPE_CACHE && cg_root->cg_level < node->subtype) @@ -896,8 +905,14 @@ if (nchildren == root->cpu_count) return; - cg_root->cg_child = smp_topo_alloc(nchildren); + /* + * We are not interested in nodes without children. + */ cg_root->cg_children = nchildren; + if (nchildren == 0) + return; + + cg_root->cg_child = smp_topo_alloc(nchildren); /* * Now find again the same cache nodes as above and recursively @@ -909,7 +924,8 @@ if ((node->type != TOPO_TYPE_GROUP && node->type != TOPO_TYPE_NODE && node->type != TOPO_TYPE_CACHE) || - CPU_CMP(&node->cpuset, &root->cpuset) == 0) { + (CPU_CMP(&node->cpuset, &root->cpuset) == 0) || + (CPU_EMPTY(&node->cpuset))) { node = topo_next_node(root, node); continue; }