Skip to contentSkip to conversation

KVM_MAX_VCPUS related changes

PATCH In review Andrew Jones 5 participants 17 messages Sep 14, 2013 – Sep 26, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover KVM_MAX_VCPUS related changes

Andrew Jones (3):
arm: kvm: clamp NR_VCPUS to MAX_VCPUS
arm32: kvm: rename CONFIG_KVM_ARM_MAX_VCPUS
aarch64: kvm: introduce CONFIG_KVM_MAX_VCPUS

 arch/arm/include/asm/kvm_host.h   |  4 ++--
 arch/arm/kvm/Kconfig              |  8 ++++----
 arch/arm/kvm/arm.c                |  2 +-
 arch/arm64/include/asm/kvm_host.h |  7 ++++++-
 arch/arm64/kvm/Kconfig            | 11 +++++++++++
 5 files changed, 24 insertions(+), 8 deletions(-)
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/3 arm: kvm: clamp NR_VCPUS to MAX_VCPUS

---
 arch/arm/kvm/arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kvm/arm.c +1 -1
index 741f66a2edbd7..9ebf8ac3a12ff 100644
@@ -201,7 +201,7 @@ int kvm_dev_ioctl_check_extension(long ext)
 		r = 1;
 		break;
 	case KVM_CAP_NR_VCPUS:
-		r = num_online_cpus();
+		r = min(num_online_cpus(), KVM_MAX_VCPUS);
 		break;
 	case KVM_CAP_MAX_VCPUS:
 		r = KVM_MAX_VCPUS;
Signature · 1 line
1.8.1.4
#2 lore raw

Re: [PATCH 1/3] arm: kvm: clamp NR_VCPUS to MAX_VCPUS

Am 14.09.2013 um 07:10 schrieb Andrew Jones <[email protected]>:

Quoted 10 lines

---
arch/arm/kvm/arm.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kvm/arm.c +0 -0
index 741f66a2edbd7..9ebf8ac3a12ff 100644

arch/arm/kvm/arm.c int kvm_dev_ioctl_check_extension(long ext) · line 204

Quoted 5 lines
arch/arm/kvm/arm.c +1 -1
@@ -201,7 +201,7 @@ int kvm_dev_ioctl_check_extension(long ext)
       r = 1;
       break;
   case KVM_CAP_NR_VCPUS:
-        r = num_online_cpus();
+        r = min(num_online_cpus(), KVM_MAX_VCPUS);

Is there any real reason to prohibit overcommit?

Alex

Quoted 10 lines
arch/arm/kvm/arm.c +0 -0
       break;
   case KVM_CAP_MAX_VCPUS:
       r = KVM_MAX_VCPUS;
Signature · 6 lines
1.8.1.4

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm
#3 lore raw

Re: [PATCH 1/3] arm: kvm: clamp NR_VCPUS to MAX_VCPUS

Quoted 7 lines · Alexander Graf

Am 14.09.2013 um 07:10 schrieb Andrew Jones <[email protected]>:

Quoted 5 lines

---
arch/arm/kvm/arm.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

arch/arm/kvm/arm.c int kvm_dev_ioctl_check_extension(long ext) · line 204

Quoted 10 lines
arch/arm/kvm/arm.c +1 -1
index 741f66a2edbd7..9ebf8ac3a12ff 100644
@@ -201,7 +201,7 @@ int kvm_dev_ioctl_check_extension(long ext)
       r = 1;
       break;
   case KVM_CAP_NR_VCPUS:
-        r = num_online_cpus();
+        r = min(num_online_cpus(), KVM_MAX_VCPUS);

Is there any real reason to prohibit overcommit?

I don't think this affects overcommit. This is the "recommended" limit, and you can still go up to KVM_MAX_CPUS.

        M.
Signature · 1 line
Fast, cheap, reliable. Pick two.
#4 lore raw

Re: [PATCH 1/3] arm: kvm: clamp NR_VCPUS to MAX_VCPUS

In reply to Alexander Graf
Quoted 9 lines · Alexander Graf

Am 14.09.2013 um 07:10 schrieb Andrew Jones <[email protected]>:

Quoted 5 lines

---
arch/arm/kvm/arm.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

arch/arm/kvm/arm.c int kvm_dev_ioctl_check_extension(long ext) · line 204

Quoted 10 lines
arch/arm/kvm/arm.c +1 -1
index 741f66a2edbd7..9ebf8ac3a12ff 100644
@@ -201,7 +201,7 @@ int kvm_dev_ioctl_check_extension(long ext)
       r = 1;
       break;
   case KVM_CAP_NR_VCPUS:
-        r = num_online_cpus();
+        r = min(num_online_cpus(), KVM_MAX_VCPUS);

Is there any real reason to prohibit overcommit?

This doesn't prohibit it. Users can attempt to configure anything they'd like, but only selections KVM_MAX_VCPUS and below will work.

drew

Quoted 13 lines

Alex

Quoted 10 lines
arch/arm/kvm/arm.c +0 -0
       break;
   case KVM_CAP_MAX_VCPUS:
       r = KVM_MAX_VCPUS;
Signature · 6 lines
1.8.1.4

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm
#5 lore raw

PATCH 2/3 arm32: kvm: rename CONFIG_KVM_ARM_MAX_VCPUS

In reply to Andrew Jones

Drop the _ARM_ part of the name. We can then introduce a config option like this to aarch64 and other arches using the same name - allowing grep to show them all. Also update the help text to describe the option more completely.

---
 arch/arm/include/asm/kvm_host.h | 4 ++--
 arch/arm/kvm/Kconfig            | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/include/asm/kvm_host.h +2 -2
index 7d22517d80711..c614d3eb176c6 100644
@@ -25,8 +25,8 @@
 #include <asm/fpstate.h>
 #include <kvm/arm_arch_timer.h>
 
-#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
-#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
+#if defined(CONFIG_KVM_MAX_VCPUS)
+#define KVM_MAX_VCPUS CONFIG_KVM_MAX_VCPUS
 #else
 #define KVM_MAX_VCPUS 0
 #endif
arch/arm/kvm/Kconfig +4 -4
index ebf5015508b52..de63bfccb3eb5 100644
@@ -40,16 +40,16 @@ config KVM_ARM_HOST
 	---help---
 	  Provides host support for ARM processors.
 
-config KVM_ARM_MAX_VCPUS
+config KVM_MAX_VCPUS
 	int "Number maximum supported virtual CPUs per VM"
 	depends on KVM_ARM_HOST
 	default 4
 	help
 	  Static number of max supported virtual CPUs per VM.
 
-	  If you choose a high number, the vcpu structures will be quite
-	  large, so only choose a reasonable number that you expect to
-	  actually use.
+	  The default is set to the highest number of vcpus that
+	  current hardware supports. Set to a lower number to save
+	  some resources. Set to a higher number to test scalability.
 
 config KVM_ARM_VGIC
 	bool "KVM support for Virtual GIC"
Signature · 1 line
1.8.1.4
#6 lore raw

Re: [PATCH 2/3] arm32: kvm: rename CONFIG_KVM_ARM_MAX_VCPUS

Quoted 35 lines · Andrew Jones

Drop the _ARM_ part of the name. We can then introduce a config option like this to aarch64 and other arches using the same name - allowing grep to show them all. Also update the help text to describe the option more completely.

---
 arch/arm/include/asm/kvm_host.h | 4 ++--
 arch/arm/kvm/Kconfig            | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/include/asm/kvm_host.h +2 -2
index 7d22517d80711..c614d3eb176c6 100644
@@ -25,8 +25,8 @@
 #include <asm/fpstate.h>
 #include <kvm/arm_arch_timer.h>
 
-#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
-#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
+#if defined(CONFIG_KVM_MAX_VCPUS)
+#define KVM_MAX_VCPUS CONFIG_KVM_MAX_VCPUS
 #else
 #define KVM_MAX_VCPUS 0
 #endif
arch/arm/kvm/Kconfig +0 -1
index ebf5015508b52..de63bfccb3eb5 100644
@@ -40,16 +40,16 @@ config KVM_ARM_HOST
 	---help---
 	  Provides host support for ARM processors.
 
-config KVM_ARM_MAX_VCPUS

arch/arm/kvm/Kconfig config KVM_ARM_HOST · line 52

Quoted 10 lines
arch/arm/kvm/Kconfig +1 -3
+config KVM_MAX_VCPUS
 	int "Number maximum supported virtual CPUs per VM"
 	depends on KVM_ARM_HOST
 	default 4
 	help
 	  Static number of max supported virtual CPUs per VM.
 
-	  If you choose a high number, the vcpu structures will be quite
-	  large, so only choose a reasonable number that you expect to
-	  actually use.

I do no see why on ARM vcpu structure size depends on KVM_ARM_MAX_VCPUS. Can somebody point me to it.

Quoted 8 lines
arch/arm/kvm/Kconfig +3 -0
+	  The default is set to the highest number of vcpus that
+	  current hardware supports. Set to a lower number to save
+	  some resources. Set to a higher number to test scalability.
 
 config KVM_ARM_VGIC
 	bool "KVM support for Virtual GIC"
Signature · 1 line
1.8.1.4

--
Gleb.

#7 lore raw

Re: [PATCH 2/3] arm32: kvm: rename CONFIG_KVM_ARM_MAX_VCPUS

Quoted 43 lines · Gleb Natapov
Quoted 42 lines · Andrew Jones

Drop the _ARM_ part of the name. We can then introduce a config option like this to aarch64 and other arches using the same name - allowing grep to show them all. Also update the help text to describe the option more completely.

---
 arch/arm/include/asm/kvm_host.h | 4 ++--
 arch/arm/kvm/Kconfig            | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/include/asm/kvm_host.h +2 -2
index 7d22517d80711..c614d3eb176c6 100644
@@ -25,8 +25,8 @@
 #include <asm/fpstate.h>
 #include <kvm/arm_arch_timer.h>
 
-#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
-#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
+#if defined(CONFIG_KVM_MAX_VCPUS)
+#define KVM_MAX_VCPUS CONFIG_KVM_MAX_VCPUS
 #else
 #define KVM_MAX_VCPUS 0
 #endif
arch/arm/kvm/Kconfig +1 -1
index ebf5015508b52..de63bfccb3eb5 100644
@@ -40,16 +40,16 @@ config KVM_ARM_HOST
 	---help---
 	  Provides host support for ARM processors.
 
-config KVM_ARM_MAX_VCPUS
+config KVM_MAX_VCPUS
 	int "Number maximum supported virtual CPUs per VM"
 	depends on KVM_ARM_HOST
 	default 4
 	help
 	  Static number of max supported virtual CPUs per VM.
 
Quoted 5 lines

arch/arm/kvm/Kconfig config KVM_ARM_HOST · line 52

Quoted 3 lines
arch/arm/kvm/Kconfig +0 -3
-	  If you choose a high number, the vcpu structures will be quite
-	  large, so only choose a reasonable number that you expect to
-	  actually use.

I do no see why on ARM vcpu structure size depends on KVM_ARM_MAX_VCPUS. Can somebody point me to it.

There's a number of indirections, but here you go:
arch/arm/include/asm/kvm_host.h:#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS

include/kvm/arm_vgic.h:#define VGIC_MAX_CPUS KVM_MAX_VCPUS

include/kvm/arm_vgic.h:#if (VGIC_MAX_CPUS > 8) include/kvm/arm_vgic.h: } percpu[VGIC_MAX_CPUS]; include/kvm/arm_vgic.h: u32 percpu[VGIC_MAX_CPUS][VGIC_NR_PRIVATE_IRQS / 4];
include/kvm/arm_vgic.h: u8 irq_sgi_sources[VGIC_MAX_CPUS][VGIC_NR_SGIS];
include/kvm/arm_vgic.h: struct vgic_bitmap irq_spi_target[VGIC_MAX_CPUS];

Basically, the GIC emulation data structures are sized on the number of VCPUs (as well as the number of supported interrupts).

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#8 lore raw

Re: [PATCH 2/3] arm32: kvm: rename CONFIG_KVM_ARM_MAX_VCPUS

Quoted 55 lines · Marc Zyngier
Quoted 43 lines · Gleb Natapov
Quoted 42 lines · Andrew Jones

Drop the _ARM_ part of the name. We can then introduce a config option like this to aarch64 and other arches using the same name - allowing grep to show them all. Also update the help text to describe the option more completely.

---
 arch/arm/include/asm/kvm_host.h | 4 ++--
 arch/arm/kvm/Kconfig            | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/include/asm/kvm_host.h +2 -2
index 7d22517d80711..c614d3eb176c6 100644
@@ -25,8 +25,8 @@
 #include <asm/fpstate.h>
 #include <kvm/arm_arch_timer.h>
 
-#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
-#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
+#if defined(CONFIG_KVM_MAX_VCPUS)
+#define KVM_MAX_VCPUS CONFIG_KVM_MAX_VCPUS
 #else
 #define KVM_MAX_VCPUS 0
 #endif
arch/arm/kvm/Kconfig +1 -1
index ebf5015508b52..de63bfccb3eb5 100644
@@ -40,16 +40,16 @@ config KVM_ARM_HOST
 	---help---
 	  Provides host support for ARM processors.
 
-config KVM_ARM_MAX_VCPUS
+config KVM_MAX_VCPUS
 	int "Number maximum supported virtual CPUs per VM"
 	depends on KVM_ARM_HOST
 	default 4
 	help
 	  Static number of max supported virtual CPUs per VM.
 
Quoted 5 lines

arch/arm/kvm/Kconfig config KVM_ARM_HOST · line 52

Quoted 3 lines
arch/arm/kvm/Kconfig +0 -3
-	  If you choose a high number, the vcpu structures will be quite
-	  large, so only choose a reasonable number that you expect to
-	  actually use.

I do no see why on ARM vcpu structure size depends on KVM_ARM_MAX_VCPUS. Can somebody point me to it.

There's a number of indirections, but here you go:
arch/arm/include/asm/kvm_host.h:#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS

include/kvm/arm_vgic.h:#define VGIC_MAX_CPUS KVM_MAX_VCPUS

Quoted 9 lines

include/kvm/arm_vgic.h:#if (VGIC_MAX_CPUS > 8) include/kvm/arm_vgic.h: } percpu[VGIC_MAX_CPUS]; include/kvm/arm_vgic.h: u32 percpu[VGIC_MAX_CPUS][VGIC_NR_PRIVATE_IRQS / 4];
include/kvm/arm_vgic.h: u8 irq_sgi_sources[VGIC_MAX_CPUS][VGIC_NR_SGIS];
include/kvm/arm_vgic.h: struct vgic_bitmap irq_spi_target[VGIC_MAX_CPUS];

Basically, the GIC emulation data structures are sized on the number of VCPUs (as well as the number of supported interrupts).

But vgic is per VM though, not per cpu as far as I can see, so the overhead is also per VM, no? Is VGIC_MAX_CPUS limit architectural or juts an implementation detail?

--
Gleb.

#9 lore raw

Re: [PATCH 2/3] arm32: kvm: rename CONFIG_KVM_ARM_MAX_VCPUS

Quoted 62 lines · Gleb Natapov
Quoted 61 lines · Marc Zyngier
Quoted 43 lines · Gleb Natapov
Quoted 42 lines · Andrew Jones

Drop the _ARM_ part of the name. We can then introduce a config option like this to aarch64 and other arches using the same name - allowing grep to show them all. Also update the help text to describe the option more completely.

---
 arch/arm/include/asm/kvm_host.h | 4 ++--
 arch/arm/kvm/Kconfig            | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/include/asm/kvm_host.h +2 -2
index 7d22517d80711..c614d3eb176c6 100644
@@ -25,8 +25,8 @@
 #include <asm/fpstate.h>
 #include <kvm/arm_arch_timer.h>
 
-#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
-#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
+#if defined(CONFIG_KVM_MAX_VCPUS)
+#define KVM_MAX_VCPUS CONFIG_KVM_MAX_VCPUS
 #else
 #define KVM_MAX_VCPUS 0
 #endif
arch/arm/kvm/Kconfig +1 -1
index ebf5015508b52..de63bfccb3eb5 100644
@@ -40,16 +40,16 @@ config KVM_ARM_HOST
 	---help---
 	  Provides host support for ARM processors.
 
-config KVM_ARM_MAX_VCPUS
+config KVM_MAX_VCPUS
 	int "Number maximum supported virtual CPUs per VM"
 	depends on KVM_ARM_HOST
 	default 4
 	help
 	  Static number of max supported virtual CPUs per VM.
 
Quoted 5 lines

arch/arm/kvm/Kconfig config KVM_ARM_HOST · line 52

Quoted 3 lines
arch/arm/kvm/Kconfig +0 -3
-	  If you choose a high number, the vcpu structures will be quite
-	  large, so only choose a reasonable number that you expect to
-	  actually use.

I do no see why on ARM vcpu structure size depends on KVM_ARM_MAX_VCPUS. Can somebody point me to it.

There's a number of indirections, but here you go:
arch/arm/include/asm/kvm_host.h:#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS

include/kvm/arm_vgic.h:#define VGIC_MAX_CPUS KVM_MAX_VCPUS

include/kvm/arm_vgic.h:#if (VGIC_MAX_CPUS > 8) include/kvm/arm_vgic.h: } percpu[VGIC_MAX_CPUS]; include/kvm/arm_vgic.h: u32 percpu[VGIC_MAX_CPUS][VGIC_NR_PRIVATE_IRQS / 4];
include/kvm/arm_vgic.h: u8 irq_sgi_sources[VGIC_MAX_CPUS][VGIC_NR_SGIS];
include/kvm/arm_vgic.h: struct vgic_bitmap irq_spi_target[VGIC_MAX_CPUS];

Quoted 6 lines
Quoted 3 lines

Basically, the GIC emulation data structures are sized on the number of VCPUs (as well as the number of supported interrupts).

But vgic is per VM though, not per cpu as far as I can see, so the overhead is also per VM, no? Is VGIC_MAX_CPUS limit architectural or juts an implementation detail?

Indeed, the MAX_VCPU overhead is per VM. The MAX_IRQS overhead is both per-vm and per-vcpu.

The GICv2 architecture has a limit of 8 CPUs - not at all an implementation detail. GICv3 remove this limitation.

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#10 lore raw

Re: [PATCH 2/3] arm32: kvm: rename CONFIG_KVM_ARM_MAX_VCPUS

In reply to Andrew Jones
Quoted 38 lines · Andrew Jones

Drop the _ARM_ part of the name. We can then introduce a config option like this to aarch64 and other arches using the same name - allowing grep to show them all. Also update the help text to describe the option more completely.

---
 arch/arm/include/asm/kvm_host.h | 4 ++--
 arch/arm/kvm/Kconfig            | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/include/asm/kvm_host.h +2 -2
index 7d22517d80711..c614d3eb176c6 100644
@@ -25,8 +25,8 @@
 #include <asm/fpstate.h>
 #include <kvm/arm_arch_timer.h>
 
-#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
-#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
+#if defined(CONFIG_KVM_MAX_VCPUS)
+#define KVM_MAX_VCPUS CONFIG_KVM_MAX_VCPUS
 #else
 #define KVM_MAX_VCPUS 0
 #endif
arch/arm/kvm/Kconfig +1 -1
index ebf5015508b52..de63bfccb3eb5 100644
@@ -40,16 +40,16 @@ config KVM_ARM_HOST
 	---help---
 	  Provides host support for ARM processors.
 
-config KVM_ARM_MAX_VCPUS
+config KVM_MAX_VCPUS
 	int "Number maximum supported virtual CPUs per VM"
 	depends on KVM_ARM_HOST

arch/arm/kvm/Kconfig config KVM_ARM_HOST · line 52

Quoted 10 lines
arch/arm/kvm/Kconfig +3 -3
 	default 4
 	help
 	  Static number of max supported virtual CPUs per VM.
 
-	  If you choose a high number, the vcpu structures will be quite
-	  large, so only choose a reasonable number that you expect to
-	  actually use.
+	  The default is set to the highest number of vcpus that
+	  current hardware supports. Set to a lower number to save
+	  some resources. Set to a higher number to test scalability.

Consider rephrasing the "Set to a lower number..." sentence to something like "Choosing a lower number decreases the size of the VM data structure.".

Also, please rephrase or get rid of the "Set to a higher number to test scalability." sentence; you increase this value to be able to be able to run more VCPUs (for whatever reason).

Signature · 1 line
Christoffer
#11 lore raw

PATCH v2 1/1 arm32: kvm: rename CONFIG_KVM_ARM_MAX_VCPUS

In reply to Andrew Jones

Drop the _ARM_ part of the name. We can then introduce a config option like this to aarch64 and other arches using the same name - allowing grep to show them all. Also update the help text to describe the option more completely.

---
v2: reword help text some more

---
 arch/arm/include/asm/kvm_host.h | 4 ++--
 arch/arm/kvm/Kconfig            | 9 +++++----
 2 files changed, 7 insertions(+), 6 deletions(-)
arch/arm/include/asm/kvm_host.h +2 -2
index 7d22517d80711..c614d3eb176c6 100644
@@ -25,8 +25,8 @@
 #include <asm/fpstate.h>
 #include <kvm/arm_arch_timer.h>
 
-#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
-#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
+#if defined(CONFIG_KVM_MAX_VCPUS)
+#define KVM_MAX_VCPUS CONFIG_KVM_MAX_VCPUS
 #else
 #define KVM_MAX_VCPUS 0
 #endif
arch/arm/kvm/Kconfig +5 -4
index ebf5015508b52..8e56ccf45edce 100644
@@ -40,16 +40,17 @@ config KVM_ARM_HOST
 	---help---
 	  Provides host support for ARM processors.
 
-config KVM_ARM_MAX_VCPUS
+config KVM_MAX_VCPUS
 	int "Number maximum supported virtual CPUs per VM"
 	depends on KVM_ARM_HOST
 	default 4
 	help
 	  Static number of max supported virtual CPUs per VM.
 
-	  If you choose a high number, the vcpu structures will be quite
-	  large, so only choose a reasonable number that you expect to
-	  actually use.
+	  The default is set to the highest number of vcpus that
+	  current hardware supports. Choosing a lower number decreases
+	  the size of the VM data structure. This number may also be
+	  increased.
 
 config KVM_ARM_VGIC
 	bool "KVM support for Virtual GIC"
Signature · 1 line
1.8.1.4
#12 lore raw

Re: [PATCH v2] arm32: kvm: rename CONFIG_KVM_ARM_MAX_VCPUS

Quoted 43 lines · Andrew Jones

Drop the _ARM_ part of the name. We can then introduce a config option like this to aarch64 and other arches using the same name - allowing grep to show them all. Also update the help text to describe the option more completely.

---
v2: reword help text some more

---
 arch/arm/include/asm/kvm_host.h | 4 ++--
 arch/arm/kvm/Kconfig            | 9 +++++----
 2 files changed, 7 insertions(+), 6 deletions(-)
arch/arm/include/asm/kvm_host.h +2 -2
index 7d22517d80711..c614d3eb176c6 100644
@@ -25,8 +25,8 @@
 #include <asm/fpstate.h>
 #include <kvm/arm_arch_timer.h>
 
-#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
-#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
+#if defined(CONFIG_KVM_MAX_VCPUS)
+#define KVM_MAX_VCPUS CONFIG_KVM_MAX_VCPUS
 #else
 #define KVM_MAX_VCPUS 0
 #endif
arch/arm/kvm/Kconfig +1 -1
index ebf5015508b52..8e56ccf45edce 100644
@@ -40,16 +40,17 @@ config KVM_ARM_HOST
 	---help---
 	  Provides host support for ARM processors.
 
-config KVM_ARM_MAX_VCPUS
+config KVM_MAX_VCPUS
 	int "Number maximum supported virtual CPUs per VM"
 	depends on KVM_ARM_HOST
 	default 4
 	help

arch/arm/kvm/Kconfig config KVM_ARM_HOST · line 54

Quoted 10 lines
arch/arm/kvm/Kconfig +4 -3
 	  Static number of max supported virtual CPUs per VM.
 
-	  If you choose a high number, the vcpu structures will be quite
-	  large, so only choose a reasonable number that you expect to
-	  actually use.
+	  The default is set to the highest number of vcpus that
+	  current hardware supports. Choosing a lower number decreases
+	  the size of the VM data structure. This number may also be
+	  increased.
 

Maybe I'm being forgetful, but what do you mean by "This number may also be increased" ?

-Christoffer

#13 lore raw

Re: [PATCH v2] arm32: kvm: rename CONFIG_KVM_ARM_MAX_VCPUS

Quoted 46 lines · Christoffer Dall
Quoted 45 lines · Andrew Jones

Drop the _ARM_ part of the name. We can then introduce a config option like this to aarch64 and other arches using the same name - allowing grep to show them all. Also update the help text to describe the option more completely.

---
v2: reword help text some more

---
 arch/arm/include/asm/kvm_host.h | 4 ++--
 arch/arm/kvm/Kconfig            | 9 +++++----
 2 files changed, 7 insertions(+), 6 deletions(-)
arch/arm/include/asm/kvm_host.h +2 -2
index 7d22517d80711..c614d3eb176c6 100644
@@ -25,8 +25,8 @@
 #include <asm/fpstate.h>
 #include <kvm/arm_arch_timer.h>
 
-#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
-#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
+#if defined(CONFIG_KVM_MAX_VCPUS)
+#define KVM_MAX_VCPUS CONFIG_KVM_MAX_VCPUS
 #else
 #define KVM_MAX_VCPUS 0
 #endif
arch/arm/kvm/Kconfig +1 -1
index ebf5015508b52..8e56ccf45edce 100644
@@ -40,16 +40,17 @@ config KVM_ARM_HOST
 	---help---
 	  Provides host support for ARM processors.
 
-config KVM_ARM_MAX_VCPUS
+config KVM_MAX_VCPUS
 	int "Number maximum supported virtual CPUs per VM"
 	depends on KVM_ARM_HOST
 	default 4
 	help
 	  Static number of max supported virtual CPUs per VM.
 
Quoted 10 lines

arch/arm/kvm/Kconfig config KVM_ARM_HOST · line 54

Quoted 8 lines
arch/arm/kvm/Kconfig +4 -3
-	  If you choose a high number, the vcpu structures will be quite
-	  large, so only choose a reasonable number that you expect to
-	  actually use.
+	  The default is set to the highest number of vcpus that
+	  current hardware supports. Choosing a lower number decreases
+	  the size of the VM data structure. This number may also be
+	  increased.
 

Maybe I'm being forgetful, but what do you mean by "This number may also be increased" ?

Originally I was proposing we write 'increase for scalability testing', as would be the purpose on the x86 side. However, you suggested it can be increased for other purposes, although you didn't mention what. I just dropped the 'scalability testing' to allow users to fill the blank in themselves. If it doesn't really make sense on arm to increase this beyond what hardware supports, then we can drop the 'increase' completely and add a

range 1 <same-as-default>

to the Kconfig entry instead.

drew

#14 lore raw

PATCH 3/3 aarch64: kvm: introduce CONFIG_KVM_MAX_VCPUS

In reply to Andrew Jones

Take CONFIG_KVM_MAX_VCPUS from arm32, but set the default to 8.

---
 arch/arm64/include/asm/kvm_host.h |  7 ++++++-
 arch/arm64/kvm/Kconfig            | 11 +++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
arch/arm64/include/asm/kvm_host.h +6 -1
index 0859a4ddd1e7d..d1af8c49a5ca4 100644
@@ -26,7 +26,12 @@
 #include <asm/kvm_asm.h>
 #include <asm/kvm_mmio.h>
 
-#define KVM_MAX_VCPUS 4
+#if defined(CONFIG_KVM_MAX_VCPUS)
+#define KVM_MAX_VCPUS CONFIG_KVM_MAX_VCPUS
+#else
+#define KVM_MAX_VCPUS 0
+#endif
+
 #define KVM_USER_MEM_SLOTS 32
 #define KVM_PRIVATE_MEM_SLOTS 4
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
arch/arm64/kvm/Kconfig +11 -0
index 21e90820bd23c..c9924b02e84f7 100644
@@ -35,6 +35,17 @@ config KVM_ARM_HOST
 	---help---
 	  Provides host support for ARM processors.
 
+config KVM_MAX_VCPUS
+	int "Number maximum supported virtual CPUs per VM"
+	depends on KVM_ARM_HOST
+	default 8
+	help
+	  Static number of max supported virtual CPUs per VM.
+
+	  The default is set to the highest number of vcpus that
+	  current hardware supports. Set to a lower number to save
+	  some resources. Set to a higher number to test scalability.
+
 config KVM_ARM_VGIC
 	bool
 	depends on KVM_ARM_HOST && OF
Signature · 1 line
1.8.1.4
#15 lore raw

Re: [PATCH 3/3] aarch64: kvm: introduce CONFIG_KVM_MAX_VCPUS

Quoted 31 lines · Andrew Jones

Take CONFIG_KVM_MAX_VCPUS from arm32, but set the default to 8.

---
 arch/arm64/include/asm/kvm_host.h |  7 ++++++-
 arch/arm64/kvm/Kconfig            | 11 +++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
arch/arm64/include/asm/kvm_host.h +6 -1
index 0859a4ddd1e7d..d1af8c49a5ca4 100644
@@ -26,7 +26,12 @@
 #include <asm/kvm_asm.h>
 #include <asm/kvm_mmio.h>
 
-#define KVM_MAX_VCPUS 4
+#if defined(CONFIG_KVM_MAX_VCPUS)
+#define KVM_MAX_VCPUS CONFIG_KVM_MAX_VCPUS
+#else
+#define KVM_MAX_VCPUS 0
+#endif
+
 #define KVM_USER_MEM_SLOTS 32
 #define KVM_PRIVATE_MEM_SLOTS 4
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
arch/arm64/kvm/Kconfig +0 -0
index 21e90820bd23c..c9924b02e84f7 100644

arch/arm64/kvm/Kconfig config KVM_ARM_HOST · line 41

Quoted 7 lines
arch/arm64/kvm/Kconfig +4 -0
@@ -35,6 +35,17 @@ config KVM_ARM_HOST
 	---help---
 	  Provides host support for ARM processors.
 
+config KVM_MAX_VCPUS
+	int "Number maximum supported virtual CPUs per VM"
+	depends on KVM_ARM_HOST
+	default 8

That data structure gets really big with 8 max vcpus. I think we should keep this at 4 for now, a quad-core VM is quite reasonable for now.

Quoted 13 lines
arch/arm64/kvm/Kconfig +7 -0
+	help
+	  Static number of max supported virtual CPUs per VM.
+
+	  The default is set to the highest number of vcpus that
+	  current hardware supports. Set to a lower number to save
+	  some resources. Set to a higher number to test scalability.
+
 config KVM_ARM_VGIC
 	bool
 	depends on KVM_ARM_HOST && OF
Signature · 1 line
1.8.1.4
Signature · 1 line
Christoffer
#16 lore raw

Re: [PATCH 3/3] aarch64: kvm: introduce CONFIG_KVM_MAX_VCPUS

Quoted 35 lines · Christoffer Dall
Quoted 34 lines · Andrew Jones

Take CONFIG_KVM_MAX_VCPUS from arm32, but set the default to 8.

---
 arch/arm64/include/asm/kvm_host.h |  7 ++++++-
 arch/arm64/kvm/Kconfig            | 11 +++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
arch/arm64/include/asm/kvm_host.h +6 -1
index 0859a4ddd1e7d..d1af8c49a5ca4 100644
@@ -26,7 +26,12 @@
 #include <asm/kvm_asm.h>
 #include <asm/kvm_mmio.h>
 
-#define KVM_MAX_VCPUS 4
+#if defined(CONFIG_KVM_MAX_VCPUS)
+#define KVM_MAX_VCPUS CONFIG_KVM_MAX_VCPUS
+#else
+#define KVM_MAX_VCPUS 0
+#endif
+
 #define KVM_USER_MEM_SLOTS 32
 #define KVM_PRIVATE_MEM_SLOTS 4
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
arch/arm64/kvm/Kconfig +0 -0
index 21e90820bd23c..c9924b02e84f7 100644
@@ -35,6 +35,17 @@ config KVM_ARM_HOST
 	---help---
 	  Provides host support for ARM processors.
 
Quoted 8 lines

arch/arm64/kvm/Kconfig config KVM_ARM_HOST · line 41

Quoted 4 lines
arch/arm64/kvm/Kconfig +4 -0
+config KVM_MAX_VCPUS
+	int "Number maximum supported virtual CPUs per VM"
+	depends on KVM_ARM_HOST
+	default 8

That data structure gets really big with 8 max vcpus. I think we should keep this at 4 for now, a quad-core VM is quite reasonable for now.

Which data structure? vgic? IIRC with 8 vcpus it will be something like 500 bytes bigger then it is now.

--
Gleb.