Skip to contentSkip to conversation

KVM: arm64: Increase number of user memslots

PATCH Superseded [email protected] 3 participants 7 messages Mar 7, 2017

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover KVM: arm64: Increase number of user memslots

From: Linu Cherian <[email protected]>

v2 -> v3:
- Added documentation for KVM_CAP_NR_MEMSLOTS
- Removed KVM_PRIVATE_MEM_SLOTS which is unused
- KVM_USER_MEM_SLOTS changed to 512 from 508

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 (4):
KVM: Add documentation for KVM_CAP_NR_MEMSLOTS
KVM: arm/arm64: Enable KVM_CAP_NR_MEMSLOTS on arm/arm64
KVM: arm/arm64: Remove KVM_PRIVATE_MEM_SLOTS definition that are
unused
KVM: arm64: Increase number of user memslots to 512

 Documentation/virtual/kvm/api.txt | 4 ++++
 arch/arm/include/asm/kvm_host.h   | 1 -
 arch/arm/kvm/arm.c                | 3 +++
 arch/arm64/include/asm/kvm_host.h | 3 +--
 4 files changed, 8 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/4 KVM: Add documentation for KVM_CAP_NR_MEMSLOTS

From: Linu Cherian <[email protected]>

---
 Documentation/virtual/kvm/api.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/virtual/kvm/api.txt +4 -0
index 03145b7..7b82f1c 100644
@@ -951,6 +951,10 @@ This ioctl allows the user to create or modify a guest physical memory
 slot.  When changing an existing slot, it may be moved in the guest
 physical memory space, or its flags may be modified.  It may not be
 resized.  Slots may not overlap in guest physical address space.
+Bits 0-15 of "slot" specifies the slot id and this value should be
+less than the maximum number of user memory slots supported per VM.
+The maximum allowed slots can be queried using KVM_CAP_NR_MEMSLOTS,
+if this capability is supported by the architecture.
 
 If KVM_CAP_MULTI_ADDRESS_SPACE is available, bits 16-31 of "slot"
 specifies the address space which is being modified.  They must be
Signature · 1 line
1.9.1
#3 lore raw

PATCH v3 2/4 KVM: arm/arm64: Enable KVM_CAP_NR_MEMSLOTS on arm/arm64

In reply to [email protected]

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
#4 lore raw

PATCH v3 3/4 KVM: arm/arm64: Remove KVM_PRIVATE_MEM_SLOTS definition that are unused

In reply to [email protected]

From: Linu Cherian <[email protected]>

---
 arch/arm/include/asm/kvm_host.h   | 1 -
 arch/arm64/include/asm/kvm_host.h | 1 -
 2 files changed, 2 deletions(-)
arch/arm/include/asm/kvm_host.h +0 -1
index d5423ab..b9b39f0 100644
@@ -30,7 +30,6 @@
 #define __KVM_HAVE_ARCH_INTC_INITIALIZED
 
 #define KVM_USER_MEM_SLOTS 32
-#define KVM_PRIVATE_MEM_SLOTS 4
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
 #define KVM_HAVE_ONE_REG
 #define KVM_HALT_POLL_NS_DEFAULT 500000
arch/arm64/include/asm/kvm_host.h +0 -1
index e505038..a0409b0 100644
@@ -31,7 +31,6 @@
 #define __KVM_HAVE_ARCH_INTC_INITIALIZED
 
 #define KVM_USER_MEM_SLOTS 32
-#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

PATCH v3 4/4 KVM: arm64: Increase number of user memslots to 512

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 512 as done in other archs like 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 a0409b0..4027002 100644
@@ -30,7 +30,7 @@
 
 #define __KVM_HAVE_ARCH_INTC_INITIALIZED
 
-#define KVM_USER_MEM_SLOTS 32
+#define KVM_USER_MEM_SLOTS 512
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
 #define KVM_HALT_POLL_NS_DEFAULT 500000
 
Signature · 1 line
1.9.1
Acked-by on v3 1/4
#2 lore raw

Re: [PATCH V3 1/4] KVM: Add documentation for KVM_CAP_NR_MEMSLOTS

In reply to [email protected]
Quoted 1 line · On Tue, Mar 07, 2017 at 11:22:41AM +0530, [email protected] wrote:

From: Linu Cherian <[email protected]>

Please add a patch description, even if it just repeats the subject line as in this case.

Otherwise:

Quoted 24 lines
---
 Documentation/virtual/kvm/api.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/virtual/kvm/api.txt +4 -0
index 03145b7..7b82f1c 100644
@@ -951,6 +951,10 @@ This ioctl allows the user to create or modify a guest physical memory
 slot.  When changing an existing slot, it may be moved in the guest
 physical memory space, or its flags may be modified.  It may not be
 resized.  Slots may not overlap in guest physical address space.
+Bits 0-15 of "slot" specifies the slot id and this value should be
+less than the maximum number of user memory slots supported per VM.
+The maximum allowed slots can be queried using KVM_CAP_NR_MEMSLOTS,
+if this capability is supported by the architecture.
 
 If KVM_CAP_MULTI_ADDRESS_SPACE is available, bits 16-31 of "slot"
 specifies the address space which is being modified.  They must be
Signature · 1 line
1.9.1
#5 lore raw

Re: [PATCH V3 3/4] KVM: arm/arm64: Remove KVM_PRIVATE_MEM_SLOTS definition that are unused

In reply to [email protected]
Quoted 3 lines · On Tue, Mar 07 2017 at 5:52:43 am GMT, [email protected] wrote:

From: Linu Cherian <[email protected]>

Please add a decent commit message. Even if this is an obvious patch, explain the rational behind it. Patch 1 has the same problem.

Thanks,

	M.
Signature · 1 line
Jazz is not dead, it just smell funny.