Skip to contentSkip to conversation

KVM: arm64: Increase number of user memslots

PATCH Superseded [email protected] 2 participants 8 messages Feb 8, 2017 – Mar 2, 2017

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover KVM: arm64: Increase number of user memslots

From: Linu Cherian <[email protected]>

v1 -> v2:
- Enabling KVM_CAP_NR_MEMSLOTS for arm/arm64 moved to separate patch.
- Updated commit message so that what is reported to userspace is explicit.

Linu Cherian (2):
KVM: arm/arm64: Enable KVM_CAP_NR_MEMSLOTS on arm/arm64
KVM: arm64: Increase number of user memslots to 508

 arch/arm/kvm/arm.c                | 3 +++
 arch/arm64/include/asm/kvm_host.h | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/2 KVM: arm/arm64: Enable KVM_CAP_NR_MEMSLOTS on arm/arm64

From: Linu Cherian <[email protected]>

Return KVM_USER_MEM_SLOTS for userspace capability query on NR_MEMSLOTS.

---
 arch/arm/kvm/arm.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/kvm/arm.c +3 -0
index 9d74464..b64b47f 100644
@@ -221,6 +221,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 	case KVM_CAP_MAX_VCPUS:
 		r = KVM_MAX_VCPUS;
 		break;
+	case KVM_CAP_NR_MEMSLOTS:
+		r = KVM_USER_MEM_SLOTS;
+		break;
 	case KVM_CAP_MSI_DEVID:
 		if (!kvm)
 			r = -EINVAL;
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH V2 1/2] KVM: arm/arm64: Enable KVM_CAP_NR_MEMSLOTS on arm/arm64

Quoted 4 lines · On Wed, Feb 08, 2017 at 12:45:40PM +0530, [email protected] wrote:

From: Linu Cherian <[email protected]>

Return KVM_USER_MEM_SLOTS for userspace capability query on NR_MEMSLOTS.

This feature seems to be undocumented (I cannot find it in Documentation/virtual/kvm/api.txt).

Can we add documentation for it?

What does user space do currently without this capability? Does it just rely on some default?

Thanks,
-Christoffer

Quoted 23 lines
---
 arch/arm/kvm/arm.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/kvm/arm.c +3 -0
index 9d74464..b64b47f 100644
@@ -221,6 +221,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 	case KVM_CAP_MAX_VCPUS:
 		r = KVM_MAX_VCPUS;
 		break;
+	case KVM_CAP_NR_MEMSLOTS:
+		r = KVM_USER_MEM_SLOTS;
+		break;
 	case KVM_CAP_MSI_DEVID:
 		if (!kvm)
 			r = -EINVAL;
Signature · 1 line
1.9.1
#3 lore raw

Re: [PATCH V2 1/2] KVM: arm/arm64: Enable KVM_CAP_NR_MEMSLOTS on arm/arm64

Quoted 6 lines · Christoffer Dall
Quoted 4 lines · On Wed, Feb 08, 2017 at 12:45:40PM +0530, [email protected] wrote:

From: Linu Cherian <[email protected]>

Return KVM_USER_MEM_SLOTS for userspace capability query on NR_MEMSLOTS.

Quoted 8 lines

This feature seems to be undocumented (I cannot find it in Documentation/virtual/kvm/api.txt).

Can we add documentation for it?

What does user space do currently without this capability? Does it just rely on some default?

Yes, without this capability, qemu userspace take the default value of 32. Will give it a try on the documentation part as a separate patch.

#4 lore raw

PATCH v2 2/2 KVM: arm64: Increase number of user memslots to 508

In reply to [email protected]

From: Linu Cherian <[email protected]>

Having only 32 memslots is a real constraint for the maximum number of PCI devices that can be assigned to a single guest. Assuming each PCI device/virtual function having two memory BAR regions, we could assign only 15 devices/virtual functions to a guest.

Hence increase KVM_USER_MEM_SLOTS to 508, so that KVM_MEM_SLOTS_NUM is 512 as done in other archs like x86 and powerpc.

---
 arch/arm64/include/asm/kvm_host.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/include/asm/kvm_host.h +1 -1
index e505038..88f017d 100644
@@ -30,7 +30,7 @@
 
 #define __KVM_HAVE_ARCH_INTC_INITIALIZED
 
-#define KVM_USER_MEM_SLOTS 32
+#define KVM_USER_MEM_SLOTS 508
 #define KVM_PRIVATE_MEM_SLOTS 4
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
 #define KVM_HALT_POLL_NS_DEFAULT 500000
Signature · 1 line
1.9.1
#5 lore raw

Re: [PATCH V2 2/2] KVM: arm64: Increase number of user memslots to 508

Quoted 10 lines · On Wed, Feb 08, 2017 at 12:45:41PM +0530, [email protected] wrote:

From: Linu Cherian <[email protected]>

Having only 32 memslots is a real constraint for the maximum number of PCI devices that can be assigned to a single guest. Assuming each PCI device/virtual function having two memory BAR regions, we could assign only 15 devices/virtual functions to a guest.

Hence increase KVM_USER_MEM_SLOTS to 508, so that KVM_MEM_SLOTS_NUM is 512 as done in other archs like x86 and powerpc.

Actually on powerpc they just define KVM_USER_MEM_SLOTS as 512 directly.

On x86 they define them as 509 and have 3 private mem slots.

I don't understand the difference and as far as I can tell we don't have any private memslots on arm/arm64, so this is just weird to me.

Thanks,
-Christoffer

Quoted 22 lines
---
 arch/arm64/include/asm/kvm_host.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/include/asm/kvm_host.h +1 -1
index e505038..88f017d 100644
@@ -30,7 +30,7 @@
 
 #define __KVM_HAVE_ARCH_INTC_INITIALIZED
 
-#define KVM_USER_MEM_SLOTS 32
+#define KVM_USER_MEM_SLOTS 508
 #define KVM_PRIVATE_MEM_SLOTS 4
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
 #define KVM_HALT_POLL_NS_DEFAULT 500000
Signature · 1 line
1.9.1
#6 lore raw

Re: [PATCH V2 2/2] KVM: arm64: Increase number of user memslots to 508

Quoted 12 lines · Christoffer Dall
Quoted 10 lines · On Wed, Feb 08, 2017 at 12:45:41PM +0530, [email protected] wrote:

From: Linu Cherian <[email protected]>

Having only 32 memslots is a real constraint for the maximum number of PCI devices that can be assigned to a single guest. Assuming each PCI device/virtual function having two memory BAR regions, we could assign only 15 devices/virtual functions to a guest.

Hence increase KVM_USER_MEM_SLOTS to 508, so that KVM_MEM_SLOTS_NUM is 512 as done in other archs like x86 and powerpc.

Quoted 7 lines

Actually on powerpc they just define KVM_USER_MEM_SLOTS as 512 directly.

On x86 they define them as 509 and have 3 private mem slots.

I don't understand the difference and as far as I can tell we don't have any private memslots on arm/arm64, so this is just weird to me.

Since the KVM_PRIVATE_MEM_SLOTS was already defined as 4, just kept it untouched. Should we remove this and keep KVM_USER_MEM_SLOTS as 512 ?

#7 lore raw

Re: [PATCH V2 2/2] KVM: arm64: Increase number of user memslots to 508

Quoted 15 lines · Linu Cherian
Quoted 14 lines · Christoffer Dall
Quoted 10 lines · On Wed, Feb 08, 2017 at 12:45:41PM +0530, [email protected] wrote:

From: Linu Cherian <[email protected]>

Having only 32 memslots is a real constraint for the maximum number of PCI devices that can be assigned to a single guest. Assuming each PCI device/virtual function having two memory BAR regions, we could assign only 15 devices/virtual functions to a guest.

Hence increase KVM_USER_MEM_SLOTS to 508, so that KVM_MEM_SLOTS_NUM is 512 as done in other archs like x86 and powerpc.

Actually on powerpc they just define KVM_USER_MEM_SLOTS as 512 directly.

Quoted 8 lines
Quoted 5 lines

On x86 they define them as 509 and have 3 private mem slots.

I don't understand the difference and as far as I can tell we don't have any private memslots on arm/arm64, so this is just weird to me.

Since the KVM_PRIVATE_MEM_SLOTS was already defined as 4, just kept it untouched. Should we remove this and keep KVM_USER_MEM_SLOTS as 512 ?

Do we have any use for KVM_PRIVATE_MEM_SLOTSA being 4? I can't seem to see this.

I think we should either get rid of the definition or at least make sure we understand why we're doing things this way.

Thanks,
-Christoffer