[PATCH] riscv: Populate boot CPU topology on UP kernels

Chen Pei cp0613 at linux.alibaba.com
Tue Oct 20 07:26:26 PDT 2026


On Tue, Oct 20, 2026 at 01:24:00PM +0100, Sudeep Holla wrote:
> Commit 4b3dc9679cf7 ("arm64: force CONFIG_SMP=y and remove redundant #ifdefs")
> removed UP support and made SMP default enabled.

Thanks. RISC-V still allows UP: CONFIG_SMP is a plain bool with no
default, yet arch/riscv/Kconfig selects GENERIC_ARCH_TOPOLOGY
unconditionally while the only callers of init_cpu_topology() and
store_cpu_topology() sit in smpboot.c, which is built only for
CONFIG_SMP. That mismatch is what this patch closes.

Gating that select on SMP instead does not work. UP would then fall back
to the cpumask_of(cpu) defaults in include/linux/topology.h and report
the same sysfs, but vmlinux no longer links: arch_freq_scale,
capacity_freq_ref, topology_scale_freq_tick and topology_set_freq_scale
all become undefined references.

arch/riscv/include/asm/topology.h binds the arch_scale_freq_* and
arch_set_freq_scale hooks to symbols that only drivers/base/arch_topology.c
provides, and those defines suppress the generic fallbacks in
kernel/sched/sched.h and include/linux/sched/topology.h. Making the
gating work needs extra conditionals at several Kconfig and Makefile
gates, and gives up freq and capacity invariance on UP, which is a much
larger change than the twelve lines here.

Conor, and RISC-V maintainers: would you rather force CONFIG_SMP=y on
RISC-V as well and drop UP altogether, or keep UP buildable and take
this fix? I would keep the current approach unless you prefer the
former.

Best regards,
Pei



More information about the linux-riscv mailing list