mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] riscv: Raise default NR_CPUS for 64BIT to 256
@ 2026-06-25  6:34 Vivian Wang
  2026-06-25 17:46 ` Paul Walmsley
  0 siblings, 1 reply; 2+ messages in thread
From: Vivian Wang @ 2026-06-25  6:34 UTC (permalink / raw)
  To: Drew Fustini, Paul Walmsley, Palmer Dabbelt, Alexandre Ghiti, Yixun Lan
  Cc: linux-riscv, linux-kernel, spacemit, Lufei Zheng, Han Gao, Vivian Wang

SpacemiT has already produced a 80-core RVA23 RISC-V server [1], and
going further back, the dual-socket SG2042-based Sophgo Pisces has 128
cores (although that had some issues achieving mainline support).
Therefore, an NR_CPUS of 64 is not enough.

Raise default NR_CPUS to 256 for 64BIT (when !RISCV_SBI_V01, since very
old firmware can't support more than 64 cores). The number was picked as
a power of two that is at least double the known max. I believe this
should be the right balance between not wasting too much memory and not
having to touch this too often.

Ubuntu has already been shipping NR_CPUS=512 for riscv64. We have also
been testing NR_CPUS=256 internally at ISCAS and found negligible
performance impact and no ill effects.

Reported-by: Lufei Zheng <lufei.zheng@spacemit.com>
Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1140651 # [1]
Suggested-by: Han Gao <gaohan@iscas.ac.cn>
Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
---
 arch/riscv/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 3f0a647218e4..c0a6992933e4 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -454,7 +454,8 @@ config NR_CPUS
 	range 2 32 if RISCV_SBI_V01 && 32BIT
 	range 2 64 if RISCV_SBI_V01 && 64BIT
 	default "32" if 32BIT
-	default "64" if 64BIT
+	default "64" if RISCV_SBI_V01 && 64BIT
+	default "256" if !RISCV_SBI_V01 && 64BIT
 
 config HOTPLUG_CPU
 	bool "Support for hot-pluggable CPUs"

---
base-commit: ab9de95c9cf952332ab79453b4b5d1bfca8e514f
change-id: 20260625-riscv-more-nr-cpus-8158dbb4640c

Best regards,
--  
Vivian Wang <wangruikang@iscas.ac.cn>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] riscv: Raise default NR_CPUS for 64BIT to 256
  2026-06-25  6:34 [PATCH] riscv: Raise default NR_CPUS for 64BIT to 256 Vivian Wang
@ 2026-06-25 17:46 ` Paul Walmsley
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Walmsley @ 2026-06-25 17:46 UTC (permalink / raw)
  To: Vivian Wang
  Cc: Drew Fustini, Paul Walmsley, Palmer Dabbelt, Alexandre Ghiti,
	Yixun Lan, linux-riscv, linux-kernel, spacemit, Lufei Zheng,
	Han Gao

On Thu, 25 Jun 2026, Vivian Wang wrote:

> SpacemiT has already produced a 80-core RVA23 RISC-V server [1], and
> going further back, the dual-socket SG2042-based Sophgo Pisces has 128
> cores (although that had some issues achieving mainline support).
> Therefore, an NR_CPUS of 64 is not enough.
> 
> Raise default NR_CPUS to 256 for 64BIT (when !RISCV_SBI_V01, since very
> old firmware can't support more than 64 cores). The number was picked as
> a power of two that is at least double the known max. I believe this
> should be the right balance between not wasting too much memory and not
> having to touch this too often.
> 
> Ubuntu has already been shipping NR_CPUS=512 for riscv64. We have also
> been testing NR_CPUS=256 internally at ISCAS and found negligible
> performance impact and no ill effects.
> 
> Reported-by: Lufei Zheng <lufei.zheng@spacemit.com>
> Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1140651 # [1]
> Suggested-by: Han Gao <gaohan@iscas.ac.cn>
> Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>

Thanks, queued for v7.2-rc.


- Paul

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-25 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-25  6:34 [PATCH] riscv: Raise default NR_CPUS for 64BIT to 256 Vivian Wang
2026-06-25 17:46 ` Paul Walmsley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome