diff mbox

[RESEND] arm64: KVM: Add Kconfig option for max VCPUs per-Guest

Message ID 1386864747-29006-1-git-send-email-anup.patel@linaro.org
State Accepted
Commit da7814700a0c408bead58ce4714b7625ffbaade1
Headers show

Commit Message

Anup Patel Dec. 12, 2013, 4:12 p.m. UTC
Current max VCPUs per-Guest is set to 4 which is preventing
us from creating a Guest (or VM) with 8 VCPUs on Host (e.g.
X-Gene Storm SOC) with 8 Host CPUs.

The correct value of max VCPUs per-Guest should be same as
the max CPUs supported by GICv2 which is 8 but, increasing
value of max VCPUs per-Guest can make things slower hence
we add Kconfig option to let KVM users select appropriate
max VCPUs per-Guest.

Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
---
 arch/arm64/include/asm/kvm_host.h |    7 ++++++-
 arch/arm64/kvm/Kconfig            |   11 +++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

Comments

Anup Patel Dec. 12, 2013, 4:12 p.m. UTC | #1
The Power State and Coordination Interface (PSCI) specification defines
SYSTEM_OFF and SYSTEM_RESET functions for system poweroff and reboot.

This patchset adds emulation of PSCI SYSTEM_OFF and SYSTEM_RESET functions
in KVM ARM/ARM64 by forwarding them to user space (QEMU or KVMTOOL) using
KVM_EXIT_SYSTEM_EVENT exit reason.

To try this patch from guest kernel, we will need PSCI-based restart and
poweroff support in the guest kenel for both ARM and ARM64.

Rob Herring has already submitted patches for PSCI-based restart and
poweroff in ARM kernel but these are not merged yet due unstable device
tree bindings of kernel PSCI support. We will be having similar patches
for PSCI-based restart and poweroff in ARM64 kernel.
(Refer http://www.spinics.net/lists/arm-kernel/msg262217.html)
(Refer http://www.spinics.net/lists/devicetree/msg05348.html)

Change Log:

V2:
 - Replace KVM_EXIT_RESET with KVM_EXIT_SYSTEM_EVENT
 - Make kvm_psci_call() return convention to match 
   KVM ARM return convention

V1:
 - Initial revised patch after RFC PATCH.

Anup Patel (2):
  KVM: Add KVM_EXIT_SYSTEM_EVENT to user space API header
  ARM/ARM64: KVM: Forward PSCI SYSTEM_OFF and SYSTEM_RESET to user
    space

 Documentation/virtual/kvm/api.txt |   15 ++++++++++++
 arch/arm/include/asm/kvm_psci.h   |    2 +-
 arch/arm/include/uapi/asm/kvm.h   |    2 ++
 arch/arm/kvm/handle_exit.c        |   13 +++++++---
 arch/arm/kvm/psci.c               |   48 ++++++++++++++++++++++++++++++-------
 arch/arm64/include/asm/kvm_psci.h |    2 +-
 arch/arm64/include/uapi/asm/kvm.h |    2 ++
 arch/arm64/kvm/handle_exit.c      |   12 +++++++---
 include/uapi/linux/kvm.h          |    8 +++++++
 9 files changed, 88 insertions(+), 16 deletions(-)
Marc Zyngier Dec. 13, 2013, 5:35 p.m. UTC | #2
On 12/12/13 16:12, Anup Patel wrote:
> Current max VCPUs per-Guest is set to 4 which is preventing
> us from creating a Guest (or VM) with 8 VCPUs on Host (e.g.
> X-Gene Storm SOC) with 8 Host CPUs.
> 
> The correct value of max VCPUs per-Guest should be same as
> the max CPUs supported by GICv2 which is 8 but, increasing
> value of max VCPUs per-Guest can make things slower hence
> we add Kconfig option to let KVM users select appropriate
> max VCPUs per-Guest.
> 
> Signed-off-by: Anup Patel <anup.patel@linaro.org>
> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>

Acked-by: Marc Zyngier <marc.zyngier@arm.com>

	M.

> ---
>  arch/arm64/include/asm/kvm_host.h |    7 ++++++-
>  arch/arm64/kvm/Kconfig            |   11 +++++++++++
>  2 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> index 5d85a02..0a1d697 100644
> --- a/arch/arm64/include/asm/kvm_host.h
> +++ b/arch/arm64/include/asm/kvm_host.h
> @@ -26,7 +26,12 @@
>  #include <asm/kvm_asm.h>
>  #include <asm/kvm_mmio.h>
>  
> -#define KVM_MAX_VCPUS 4
> +#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
> +#define KVM_MAX_VCPUS CONFIG_KVM_ARM_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
> diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
> index 4480ab3..8ba85e9 100644
> --- a/arch/arm64/kvm/Kconfig
> +++ b/arch/arm64/kvm/Kconfig
> @@ -36,6 +36,17 @@ config KVM_ARM_HOST
>  	---help---
>  	  Provides host support for ARM processors.
>  
> +config KVM_ARM_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.
> +
>  config KVM_ARM_VGIC
>  	bool
>  	depends on KVM_ARM_HOST && OF
>
Christoffer Dall Dec. 13, 2013, 7:17 p.m. UTC | #3
On Thu, Dec 12, 2013 at 09:42:22PM +0530, Anup Patel wrote:
> Current max VCPUs per-Guest is set to 4 which is preventing
> us from creating a Guest (or VM) with 8 VCPUs on Host (e.g.
> X-Gene Storm SOC) with 8 Host CPUs.
> 
> The correct value of max VCPUs per-Guest should be same as
> the max CPUs supported by GICv2 which is 8 but, increasing
> value of max VCPUs per-Guest can make things slower hence
> we add Kconfig option to let KVM users select appropriate
> max VCPUs per-Guest.
> 

Acked-by: Christoffer Dall <christoffer.dall@linaro.org>

> Signed-off-by: Anup Patel <anup.patel@linaro.org>
> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> ---
>  arch/arm64/include/asm/kvm_host.h |    7 ++++++-
>  arch/arm64/kvm/Kconfig            |   11 +++++++++++
>  2 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> index 5d85a02..0a1d697 100644
> --- a/arch/arm64/include/asm/kvm_host.h
> +++ b/arch/arm64/include/asm/kvm_host.h
> @@ -26,7 +26,12 @@
>  #include <asm/kvm_asm.h>
>  #include <asm/kvm_mmio.h>
>  
> -#define KVM_MAX_VCPUS 4
> +#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
> +#define KVM_MAX_VCPUS CONFIG_KVM_ARM_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
> diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
> index 4480ab3..8ba85e9 100644
> --- a/arch/arm64/kvm/Kconfig
> +++ b/arch/arm64/kvm/Kconfig
> @@ -36,6 +36,17 @@ config KVM_ARM_HOST
>  	---help---
>  	  Provides host support for ARM processors.
>  
> +config KVM_ARM_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.
> +
>  config KVM_ARM_VGIC
>  	bool
>  	depends on KVM_ARM_HOST && OF
> -- 
> 1.7.9.5
>
Christoffer Dall Dec. 13, 2013, 7:19 p.m. UTC | #4
On Thu, Dec 12, 2013 at 09:42:25PM +0530, Anup Patel wrote:
> The Power State and Coordination Interface (PSCI) specification defines
> SYSTEM_OFF and SYSTEM_RESET functions for system poweroff and reboot.
> 
> This patchset adds emulation of PSCI SYSTEM_OFF and SYSTEM_RESET functions
> in KVM ARM/ARM64 by forwarding them to user space (QEMU or KVMTOOL) using
> KVM_EXIT_SYSTEM_EVENT exit reason.
> 
> To try this patch from guest kernel, we will need PSCI-based restart and
> poweroff support in the guest kenel for both ARM and ARM64.
> 
> Rob Herring has already submitted patches for PSCI-based restart and
> poweroff in ARM kernel but these are not merged yet due unstable device
> tree bindings of kernel PSCI support. We will be having similar patches
> for PSCI-based restart and poweroff in ARM64 kernel.
> (Refer http://www.spinics.net/lists/arm-kernel/msg262217.html)
> (Refer http://www.spinics.net/lists/devicetree/msg05348.html)

There's something really funky about the threading and reply-to settings
of all of these patches, please check your e-mail sending tool config.

> 
> Change Log:
> 
> V2:
>  - Replace KVM_EXIT_RESET with KVM_EXIT_SYSTEM_EVENT
>  - Make kvm_psci_call() return convention to match 
>    KVM ARM return convention
> 
> V1:
>  - Initial revised patch after RFC PATCH.
> 
> Anup Patel (2):
>   KVM: Add KVM_EXIT_SYSTEM_EVENT to user space API header
>   ARM/ARM64: KVM: Forward PSCI SYSTEM_OFF and SYSTEM_RESET to user
>     space
> 
>  Documentation/virtual/kvm/api.txt |   15 ++++++++++++
>  arch/arm/include/asm/kvm_psci.h   |    2 +-
>  arch/arm/include/uapi/asm/kvm.h   |    2 ++
>  arch/arm/kvm/handle_exit.c        |   13 +++++++---
>  arch/arm/kvm/psci.c               |   48 ++++++++++++++++++++++++++++++-------
>  arch/arm64/include/asm/kvm_psci.h |    2 +-
>  arch/arm64/include/uapi/asm/kvm.h |    2 ++
>  arch/arm64/kvm/handle_exit.c      |   12 +++++++---
>  include/uapi/linux/kvm.h          |    8 +++++++
>  9 files changed, 88 insertions(+), 16 deletions(-)
> 
> -- 
> 1.7.9.5
>
diff mbox

Patch

diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 5d85a02..0a1d697 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -26,7 +26,12 @@ 
 #include <asm/kvm_asm.h>
 #include <asm/kvm_mmio.h>
 
-#define KVM_MAX_VCPUS 4
+#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
+#define KVM_MAX_VCPUS CONFIG_KVM_ARM_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
diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
index 4480ab3..8ba85e9 100644
--- a/arch/arm64/kvm/Kconfig
+++ b/arch/arm64/kvm/Kconfig
@@ -36,6 +36,17 @@  config KVM_ARM_HOST
 	---help---
 	  Provides host support for ARM processors.
 
+config KVM_ARM_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.
+
 config KVM_ARM_VGIC
 	bool
 	depends on KVM_ARM_HOST && OF