Skip to contentSkip to conversation

kconfig: adjust NR_CPUS defaults

PATCH In review Jan Beulich 3 participants 5 messages Jan 14 – Jan 26

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kconfig: adjust NR_CPUS defaults

Discussion of a RISC-V change revealed that for PPC and RISC-V we don't really set any default, but rather rely on internals of kconfig picking the lowest of the permitted values in such a case. Let's make this explicit, requiring architectures that mean to permit SMP by default to explicitly record some sensible value here.

Leverage the adjustment to the "1" case to simplify all subsequent ones.

---
For not-yet-SMP-capable ports we might go even further and use

range 1 1 if !X86 && (!ARM || MPU)

at the top. Thoughts? (I've not done this right away as it is liable to get unwieldy when we have a larger number of SMP-capable ports.)

xen/arch/Kconfig +5 -5
@@ -9,11 +9,11 @@ config NR_CPUS
 	range 1 1 if ARM && MPU
 	range 1 16383
 	default "256" if X86
-	default "1" if ARM && MPU
-	default "8" if ARM && RCAR3
-	default "4" if ARM && QEMU
-	default "4" if ARM && MPSOC
-	default "128" if ARM
+	default "1" if !ARM || MPU
+	default "8" if RCAR3
+	default "4" if QEMU
+	default "4" if MPSOC
+	default "128"
 	help
 	  Controls the build-time size of various arrays and bitmaps
 	  associated with multiple-cpu management.  It is the upper bound of
#1 lore raw
Quoted 9 lines · Jan Beulich

Discussion of a RISC-V change revealed that for PPC and RISC-V we don't really set any default, but rather rely on internals of kconfig picking the lowest of the permitted values in such a case. Let's make this explicit, requiring architectures that mean to permit SMP by default to explicitly record some sensible value here.

Leverage the adjustment to the "1" case to simplify all subsequent ones.

LGTM: Reviewed-by: Oleksii Kurochko <[email protected]>

Now I have to drop the same patch from my list. Likely I checked my e-mail before sending it.

~ Oleksii

Reviewed-by on v1 1/1
#2 lore raw
In reply to Jan Beulich
Quoted 9 lines · Jan Beulich

Discussion of a RISC-V change revealed that for PPC and RISC-V we don't really set any default, but rather rely on internals of kconfig picking the lowest of the permitted values in such a case. Let's make this explicit, requiring architectures that mean to permit SMP by default to explicitly record some sensible value here.

Leverage the adjustment to the "1" case to simplify all subsequent ones.

with one question...

xen/arch/Kconfig config NR_CPUS · line 9

Quoted 12 lines

---
For not-yet-SMP-capable ports we might go even further and use

range 1 1 if !X86 && (!ARM || MPU)

at the top. Thoughts? (I've not done this right away as it is liable to get unwieldy when we have a larger number of SMP-capable ports.)

xen/arch/Kconfig +0 -0
@@ -9,11 +9,11 @@ config NR_CPUS
 	range 1 1 if ARM && MPU

Why not simply && MPU given that MPU is an ARM specific option in our Kconfig.

~Michal

Quoted 15 lines
xen/arch/Kconfig +5 -5
 	range 1 16383
 	default "256" if X86
-	default "1" if ARM && MPU
-	default "8" if ARM && RCAR3
-	default "4" if ARM && QEMU
-	default "4" if ARM && MPSOC
-	default "128" if ARM
+	default "1" if !ARM || MPU
+	default "8" if RCAR3
+	default "4" if QEMU
+	default "4" if MPSOC
+	default "128"
 	help
 	  Controls the build-time size of various arrays and bitmaps
 	  associated with multiple-cpu management.  It is the upper bound of
#3 lore raw
Quoted 11 lines · Michal
Quoted 9 lines · Jan Beulich

Discussion of a RISC-V change revealed that for PPC and RISC-V we don't really set any default, but rather rely on internals of kconfig picking the lowest of the permitted values in such a case. Let's make this explicit, requiring architectures that mean to permit SMP by default to explicitly record some sensible value here.

Leverage the adjustment to the "1" case to simplify all subsequent ones.

Thanks.

Quoted 7 lines

with one question...

Quoted 5 lines

---
For not-yet-SMP-capable ports we might go even further and use

range 1 1 if !X86 && (!ARM || MPU)

Quoted 8 lines

xen/arch/Kconfig config NR_CPUS · line 9

Quoted 7 lines

at the top. Thoughts? (I've not done this right away as it is liable to get unwieldy when we have a larger number of SMP-capable ports.)

xen/arch/Kconfig +0 -0
@@ -9,11 +9,11 @@ config NR_CPUS
 	range 1 1 if ARM && MPU

Why not simply && MPU given that MPU is an ARM specific option in our Kconfig.

Good question, to be answered by whoever put this here. I guess the anticipation may have been that "MPU" might end up meaning something else on another arch, at some future point?

Jan

#4 lore raw
Quoted 31 lines · Jan Beulich
Quoted 11 lines · Michal
Quoted 9 lines · Jan Beulich

Discussion of a RISC-V change revealed that for PPC and RISC-V we don't really set any default, but rather rely on internals of kconfig picking the lowest of the permitted values in such a case. Let's make this explicit, requiring architectures that mean to permit SMP by default to explicitly record some sensible value here.

Leverage the adjustment to the "1" case to simplify all subsequent ones.

Thanks.

Quoted 7 lines

with one question...

Quoted 5 lines

---
For not-yet-SMP-capable ports we might go even further and use

range 1 1 if !X86 && (!ARM || MPU)

Quoted 8 lines

xen/arch/Kconfig config NR_CPUS · line 9

Quoted 7 lines

at the top. Thoughts? (I've not done this right away as it is liable to get unwieldy when we have a larger number of SMP-capable ports.)

xen/arch/Kconfig +0 -0
@@ -9,11 +9,11 @@ config NR_CPUS
 	range 1 1 if ARM && MPU

Why not simply && MPU given that MPU is an ARM specific option in our Kconfig.

Quoted 3 lines

Good question, to be answered by whoever put this here. I guess the anticipation may have been that "MPU" might end up meaning something else on another arch, at some future point?

Except for this specific case, there is no other use of MPU in non-arch Kconfig or code, so it's difficult to say. I would be more willing to tie it to Arm, so that we don't need ARM/CONFIG_ARM before MPU/CONFIG_MPU.

~Michal