DF-2846 / fix.diff
--- a/sys/kern/subr_cpu_topology.c +++ b/sys/kern/subr_cpu_topology.c @@ -719,11 +719,19 @@ static void sbuf_print_cpuset(struct sbuf *sb, cpumask_t *mask) { int i; int b = -1; int e = -1; int more = 0; sbuf_printf(sb, "cpus("); - CPUSET_FOREACH(i, *mask) { + /* + * CPUSET_FOREACH is bounded by ncpus, but this helper runs + * during SI_BOOT2_CPU_TOPOLOGY, i.e. before the APs are + * started and before ncpus is set to naps + 1 (ncpus == 1 + * there). Iterate the full mask width instead so the + * boot-time renderings of hw.cpu_topology.members and the + * per-cpu physical_siblings/core_siblings strings are + * complete. CPUMASK_TESTBIT masks the bit index itself. + */ + for (i = 0; i < MAXCPU; ++i) { + if (!CPUMASK_TESTBIT(*mask, i)) + continue; if (b < 0) { b = i; e = b + 1; continue; ``` |