Skip to contentSkip to conversation

kvm-userland - raise max vcpus to 256 for ia64

PATCH Applied Jes Sorensen 3 participants 6 messages Oct 16, 2008 – Nov 13, 2008 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm-userland - raise max vcpus to 256 for ia64

Hi,

We can now boot upto 60 vcpus on ia64, but thats just the beginning. Would you please add this one to the kvm-userland tree.

Thanks,
Jes

Raise max number of vcpus for ia64 to 256.

---
 libkvm/kvm-common.h |   11 +++++++----
 qemu/vl.c           |    2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)
libkvm/kvm-common.h +7 -4
Index: kvm-userspace.git/libkvm/kvm-common.h
===================================================================
@@ -18,13 +18,16 @@
 
 /* FIXME: share this number with kvm */
 /* FIXME: or dynamically alloc/realloc regions */
-#ifndef __s390__
-#define KVM_MAX_NUM_MEM_REGIONS 32u
-#define MAX_VCPUS 16
-#else
+#ifdef __s390__
 #define KVM_MAX_NUM_MEM_REGIONS 1u
 #define MAX_VCPUS 64
 #define LIBKVM_S390_ORIGIN (0UL)
+#elif __ia64__
+#define KVM_MAX_NUM_MEM_REGIONS 32u
+#define MAX_VCPUS 256
+#else
+#define KVM_MAX_NUM_MEM_REGIONS 32u
+#define MAX_VCPUS 16
 #endif
 
 
qemu/vl.c +1 -1
Index: kvm-userspace.git/qemu/vl.c
===================================================================
@@ -224,7 +224,7 @@
 #elif defined(TARGET_I386)
 #define MAX_CPUS 255
 #elif defined(TARGET_IA64)
-#define MAX_CPUS 4
+#define MAX_CPUS 256
 #else
 #define MAX_CPUS 1
 #endif
#1 lore raw

It needs the kernel patch I sent to mailing list yesterday. Avi,
Could you check-in attached patch and queue it for 2.6.28? Thanks!
Xiantao

Quoted 7 lines · Jes Sorensen

Hi,

We can now boot upto 60 vcpus on ia64, but thats just the beginning. Would you please add this one to the kvm-userland tree.

Thanks,
Jes

From 64c68d78a3d3f5dffd84f84ad1e93ad6ea48de73 Mon Sep 17 00:00:00 2001
From: Xiantao Zhang <[email protected]>
Date: Wed, 15 Oct 2008 19:52:21 +0800
Subject: [PATCH] kvm/ia64: Code cleanup for Linux- 2.6.28.

Clean up the logic of allocating vm data area, and removed some coding style issues.

---
 arch/ia64/include/asm/kvm.h      |    1 -
 arch/ia64/include/asm/kvm_host.h |  183 ++++++++++++++++++++++++--------------
 arch/ia64/kvm/kvm-ia64.c         |   60 ++++++------
 arch/ia64/kvm/kvm_minstate.h     |    4 +-
 arch/ia64/kvm/misc.h             |    3 +-
 arch/ia64/kvm/vcpu.c             |    5 +-
 arch/ia64/kvm/vcpu.h             |    3 +-
 arch/ia64/kvm/vmm_ivt.S          |   15 ---
 arch/ia64/kvm/vtlb.c             |    4 +-
 9 files changed, 157 insertions(+), 121 deletions(-)
arch/ia64/include/asm/kvm.h +0 -1
index f38472a..de02c18 100644
@@ -207,5 +207,4 @@ struct kvm_sregs {
 
 struct kvm_fpu {
 };
-
 #endif
arch/ia64/include/asm/kvm_host.h +116 -67

213 lines not on this page · raw message

arch/ia64/kvm/kvm-ia64.c +30 -30

154 lines not on this page · raw message

arch/ia64/kvm/kvm_minstate.h +3 -1
index 2cc41d1..5fa5760 100644
@@ -24,6 +24,8 @@
 #include <asm/asmmacro.h>
 #include <asm/types.h>
 #include <asm/kregs.h>
+#include <asm/kvm_host.h>
+
 #include "asm-offsets.h"
 
 #define KVM_MINSTATE_START_SAVE_MIN	     					\
@@ -33,7 +35,7 @@
 	addl r22 = VMM_RBS_OFFSET,r1;            /* compute base of RBS */	\
 	;;									\
 	lfetch.fault.excl.nt1 [r22];						\
-	addl r1 = IA64_STK_OFFSET-VMM_PT_REGS_SIZE,r1;  /* compute base of memory stack */  \
+	addl r1 = KVM_STK_OFFSET-VMM_PT_REGS_SIZE,r1;  /* compute base of memory stack */  \
 	mov r23 = ar.bspstore;			/* save ar.bspstore */          \
 	;;									\
 	mov ar.bspstore = r22;				/* switch to kernel RBS */\
arch/ia64/kvm/misc.h +2 -1
index e585c46..c2ad19a 100644
@@ -27,7 +27,8 @@
  */
 static inline uint64_t *kvm_host_get_pmt(struct kvm *kvm)
 {
-	return (uint64_t *)(kvm->arch.vm_base + KVM_P2M_OFS);
+	return (uint64_t *)(kvm->arch.vm_base + 
+				offsetof(struct kvm_vm_data, kvm_p2m ));
 }
 
 static inline void kvm_set_pmt_entry(struct kvm *kvm, gfn_t gfn,
arch/ia64/kvm/vcpu.c +3 -2
index e44027c..a528d70 100644
@@ -816,8 +816,9 @@ static void vcpu_set_itc(struct kvm_vcpu *vcpu, u64 val)
 	unsigned long vitv = VCPU(vcpu, itv);
 
 	if (vcpu->vcpu_id == 0) {
-		for (i = 0; i < MAX_VCPU_NUM; i++) {
-			v = (struct kvm_vcpu *)((char *)vcpu + VCPU_SIZE * i);
+		for (i = 0; i < KVM_MAX_VCPUS; i++) {
+			v = (struct kvm_vcpu *)((char *)vcpu +
+					sizeof(struct kvm_vcpu_data) * i);
 			VMX(v, itc_offset) = itc_offset;
 			VMX(v, last_itc) = 0;
 		}
arch/ia64/kvm/vcpu.h +1 -2
index 341e3fe..5ed7896 100644
@@ -33,9 +33,8 @@
 
 #ifndef __ASSEMBLY__
 #include "vti.h"
-
-#include <linux/kvm_host.h>
 #include <linux/spinlock.h>
+#include <linux/kvm_host.h>
 
 typedef unsigned long IA64_INST;
 
arch/ia64/kvm/vmm_ivt.S +0 -15
index c1d7251..55294b6 100644
@@ -54,7 +54,6 @@
  * Table is based upon EAS2.6 (Oct 1999)
  */
 
-
 #include <asm/asmmacro.h>
 #include <asm/cache.h>
 #include <asm/pgtable.h>
@@ -64,20 +63,12 @@
 #include "kvm_minstate.h"
 #include "vti.h"
 
-#if 1
-# define PSR_DEFAULT_BITS   psr.ac
-#else
-# define PSR_DEFAULT_BITS   0
-#endif
-
-
 #define KVM_FAULT(n)    \
     kvm_fault_##n:;          \
     mov r19=n;;          \
     br.sptk.many kvm_fault_##n;         \
     ;;                  \
 
-
 #define KVM_REFLECT(n)    \
     mov r31=pr;           \
     mov r19=n;       /* prepare to save predicates */ \
@@ -87,16 +78,11 @@
 (p7)br.sptk.many kvm_dispatch_reflection;        \
     br.sptk.many kvm_panic;      \
 
-
 GLOBAL_ENTRY(kvm_panic)
     br.sptk.many kvm_panic
     ;;
 END(kvm_panic)
 
-
-
-
-
     .section .text.ivt,"ax"
 
     .align 32768    // align on 32KB boundary
@@ -108,7 +94,6 @@ ENTRY(kvm_vhpt_miss)
     KVM_FAULT(0)
 END(kvm_vhpt_miss)
 
-
     .org kvm_ia64_ivt+0x400
 ////////////////////////////////////////////////////////////////
 // 0x0400 Entry 1 (size 64 bundles) ITLB (21)
arch/ia64/kvm/vtlb.c +2 -2
index e22b933..6b6307a 100644
@@ -183,8 +183,8 @@ void mark_pages_dirty(struct kvm_vcpu *v, u64 pte, u64 ps)
 	u64 i, dirty_pages = 1;
 	u64 base_gfn = (pte&_PAGE_PPN_MASK) >> PAGE_SHIFT;
 	spinlock_t *lock = __kvm_va(v->arch.dirty_log_lock_pa);
-	void *dirty_bitmap = (void *)v - (KVM_VCPU_OFS + v->vcpu_id * VCPU_SIZE)
-						+ KVM_MEM_DIRTY_LOG_OFS;
+	void *dirty_bitmap = (void *)KVM_MEM_DIRTY_LOG_BASE;
+
 	dirty_pages <<= ps <= PAGE_SHIFT ? 0 : ps - PAGE_SHIFT;
 
 	vmm_spin_lock(lock);
Signature · 1 line
1.5.1
#2 lore raw
In reply to Jes Sorensen

Hi, Avi
Since kener side is ready, could you apply the patch from Jes?
Thanks
Xiantao

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jes Sorensen
Sent: Thursday, October 16, 2008 5:36 PM
To: Avi Kivity; [email protected]; [email protected]
Subject: [patch] kvm-userland - raise max vcpus to 256 for ia64

Hi,

We can now boot upto 60 vcpus on ia64, but thats just the beginning. Would you please add this one to the kvm-userland tree.

Thanks,
Jes

#3 lore raw
Quoted 3 lines · Xiantao

Hi, Avi
Since kener side is ready, could you apply the patch from Jes?

Needs changes since qemu changed in this area. Please rebase.

Signature · 1 line
error compiling committee.c: too many arguments to function
#4 lore raw
Quoted 5 lines · Avi Kivity
Quoted 1 line · Xiantao

Hi, Avi Since kener side is ready, could you apply the patch from Jes?

Needs changes since qemu changed in this area. Please rebase.

Hi,

Here's a rebase of the CPU number patch. Builds for me.

Cheers,
Jes

Raise max number of vcpus for ia64 to 256.

---
 libkvm/kvm-common.h |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
libkvm/kvm-common.h +7 -4
Index: kvm-userspace.git/libkvm/kvm-common.h
===================================================================
@@ -18,13 +18,16 @@
 
 /* FIXME: share this number with kvm */
 /* FIXME: or dynamically alloc/realloc regions */
-#ifndef __s390__
-#define KVM_MAX_NUM_MEM_REGIONS 32u
-#define MAX_VCPUS 16
-#else
+#ifdef __s390__
 #define KVM_MAX_NUM_MEM_REGIONS 1u
 #define MAX_VCPUS 64
 #define LIBKVM_S390_ORIGIN (0UL)
+#elif __ia64__
+#define KVM_MAX_NUM_MEM_REGIONS 32u
+#define MAX_VCPUS 256
+#else
+#define KVM_MAX_NUM_MEM_REGIONS 32u
+#define MAX_VCPUS 16
 #endif
 
 
Applied
#5 lore raw
Quoted 3 lines · Jes Sorensen

Here's a rebase of the CPU number patch. Builds for me.

Applied, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function