On 8/13/2025 1:55 PM, Dave Hansen wrote: > > But that's not the problem. The issue is that this line of code: > > #define cpu_primary_thread_mask cpu_none_mask With CONFIG_SMP=n, on the core side (include/linux/cpu_smt.h), the code clarifies there is no SMT: # define cpu_smt_control (CPU_SMT_NOT_IMPLEMENTED) This leads kernel/cpu.c to return an empty mask: static inline const struct cpumask *cpuhp_get_primary_thread_mask(void) { return cpu_none_mask; } On the x86 side, the definition is explicit that “primary threads” are SMT threads (arch/x86/kernel/smpboot.c): /* CPUs which are the primary SMT threads */ struct cpumask __cpu_primary_thread_mask __read_mostly; And via ifdeffery, this mask is only available to SMP kernels. So it seems I had been subscribing this model -- no primary threads without SMP. > reads as 100% bogus to me. Even on !SMP kernels, > 'cpu_primary_thread_mask' should have one CPU in it. Right? The _one_ > thread that's present is a primary thread. If this were a mask for > secondary threads, 'cpu_none_mask' would make sense. But it's not. Your confidence made me take another look. Digging into the history, I found that x86 used to have this in the !SMP case: static inline bool topology_is_primary_thread(unsigned int cpu) { return true; } That stayed until the recent commit 4b455f59945aa ("cpu/SMT: Provide a default topology_is_primary_thread()"), which now defines it in include/linux/topology.h with this telling comment: /* * When disabling SMT, the primary thread of the SMT will remain * enabled/active. Architectures that have a special primary thread * (e.g. x86) need to override this function. ... */ This comment basically supports your point. > So could we please make use 'cpu_primary_thread_mask' is getting defined > correctly whether it's really getting compiled into the end image or not? Given that, I’m thinking of simplifying the x86 side a bit -- by making the primary thread mask configured and available regardless of CONFIG_SMP, matching the behavior of other cpumasks. And its relevant helpers are also available, like in the attached diff. I think the change still aligns x86 with the core code -- especially with the note in topology_is_primary_thread(). With that, the user may be introduced here.