All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][kvmtool] kvm: Request VM specific limits instead of system-wide ones
@ 2020-04-27 14:17 ` Marc Zyngier
  0 siblings, 0 replies; 14+ messages in thread
From: Marc Zyngier @ 2020-04-27 14:17 UTC (permalink / raw)
  To: kvmarm, kvm; +Cc: Andre Przywara, Will Deacon, Ard Biesheuvel

On arm64, the maximum number of vcpus is constrained by the type
of interrupt controller that has been selected (GICv2 imposes a
limit of 8 vcpus, while GICv3 currently has a limit of 512).

It is thus important to request this limit on the VM file descriptor
rather than on the one that corresponds to /dev/kvm, as the latter
is likely to return something that doesn't take the constraints into
account.

Reported-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
 kvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kvm.c b/kvm.c
index e327541..3d5173d 100644
--- a/kvm.c
+++ b/kvm.c
@@ -406,7 +406,7 @@ int kvm__recommended_cpus(struct kvm *kvm)
 {
 	int ret;
 
-	ret = ioctl(kvm->sys_fd, KVM_CHECK_EXTENSION, KVM_CAP_NR_VCPUS);
+	ret = ioctl(kvm->vm_fd, KVM_CHECK_EXTENSION, KVM_CAP_NR_VCPUS);
 	if (ret <= 0)
 		/*
 		 * api.txt states that if KVM_CAP_NR_VCPUS does not exist,
@@ -421,7 +421,7 @@ int kvm__max_cpus(struct kvm *kvm)
 {
 	int ret;
 
-	ret = ioctl(kvm->sys_fd, KVM_CHECK_EXTENSION, KVM_CAP_MAX_VCPUS);
+	ret = ioctl(kvm->vm_fd, KVM_CHECK_EXTENSION, KVM_CAP_MAX_VCPUS);
 	if (ret <= 0)
 		ret = kvm__recommended_cpus(kvm);
 
-- 
2.26.2

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

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

end of thread, other threads:[~2020-04-28  9:08 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-27 14:17 [PATCH][kvmtool] kvm: Request VM specific limits instead of system-wide ones Marc Zyngier
2020-04-27 14:17 ` Marc Zyngier
2020-04-27 14:44 ` Alexandru Elisei
2020-04-27 14:44   ` Alexandru Elisei
2020-04-27 15:00   ` Alexandru Elisei
2020-04-27 15:00     ` Alexandru Elisei
2020-04-27 17:33     ` Marc Zyngier
2020-04-27 17:33       ` Marc Zyngier
2020-04-28  9:09       ` Alexandru Elisei
2020-04-28  9:09         ` Alexandru Elisei
2020-04-27 15:37 ` André Przywara
2020-04-27 15:37   ` André Przywara
2020-04-27 16:49   ` Marc Zyngier
2020-04-27 16:49     ` Marc Zyngier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.