Skip to contentSkip to conversation

windows patch seems to have broken allocation on demand patches

DISCUSSION Jes Sorensen 2 participants 6 messages Mar 27, 2009 – Mar 30, 2009

lore
Share & tools
lore
#0 lore raw

Hi Xiantao,

The recent changes adding support for windows to KVM/ia64, seems to have broken the allocation on demand patches, needed to boot with large memory support.

Is there any chance you have an update version of these patches?

Cheers,
Jes

#1 lore raw

Which patches ?
Xiantao

-----Original Message-----
From: Jes Sorensen [mailto:[email protected]]
Sent: Saturday, March 28, 2009 12:00 AM
To: Zhang, Xiantao
Cc: [email protected]
Subject: windows patch seems to have broken allocation on demand patches

Hi Xiantao,

The recent changes adding support for windows to KVM/ia64, seems to have broken the allocation on demand patches, needed to boot with large memory support.

Is there any chance you have an update version of these patches?

Cheers,
Jes

#2 lore raw
In reply to Jes Sorensen
Quoted 2 lines · Xiantao

Which patches ?
Xiantao

This is the one I keep applying - but modified to be against the latest kernel, which is broken.

You came up with this due to the long startup time for KVM when booting large guests, like 64GB+ etc.

Cheers,
Jes

Quoted 8 lines

-----Original Message-----
From: Jes Sorensen [mailto:[email protected]] Sent: Saturday, March 28, 2009 12:00 AM
To: Zhang, Xiantao
Cc: [email protected]
Subject: windows patch seems to have broken allocation on demand patches

Hi Xiantao,

Quoted 8 lines

The recent changes adding support for windows to KVM/ia64, seems to have broken the allocation on demand patches, needed to boot with large memory support.

Is there any chance you have an update version of these patches?

Cheers,
Jes

---
 arch/ia64/include/asm/kvm_host.h |    8 ++++++
 arch/ia64/kvm/kvm-ia64.c         |   49 ++++++++++++++++++++++++++++++++-------
 arch/ia64/kvm/misc.h             |    7 +++++
 arch/ia64/kvm/vtlb.c             |   29 ++++++++++++++++++++++-
 4 files changed, 84 insertions(+), 9 deletions(-)
arch/ia64/include/asm/kvm_host.h +8 -0
Index: linux-2.6.git/arch/ia64/include/asm/kvm_host.h
===================================================================
@@ -39,6 +39,7 @@
 #define EXIT_REASON_EXTERNAL_INTERRUPT	6
 #define EXIT_REASON_IPI			7
 #define EXIT_REASON_PTC_G		8
+#define EXIT_REASON_ALLOC_MEM		9
 #define EXIT_REASON_DEBUG		20
 
 /*Define vmm address space and vm data space.*/
@@ -313,6 +314,12 @@
 	struct kvm_vcpu *vcpu;
 };
 
+/* Alloc real memory exit */
+struct kvm_alloc_mem {
+	unsigned long gpfn;
+	unsigned long pmt_val;
+};
+
 /*Exit control data */
 struct exit_ctl_data{
 	uint32_t exit_reason;
@@ -324,6 +331,7 @@
 		struct kvm_switch_rr6	rr_data;
 		struct kvm_ipi_data	ipi_data;
 		struct kvm_ptc_g	ptc_g_data;
+		struct kvm_alloc_mem    alloc_mem;
 	} u;
 };
 
arch/ia64/kvm/kvm-ia64.c +41 -8

77 lines not on this page · raw message

arch/ia64/kvm/misc.h +7 -0
Index: linux-2.6.git/arch/ia64/kvm/misc.h
===================================================================
@@ -41,6 +41,13 @@
 	pmt_base[gfn] = pte;
 }
 
+static inline uint64_t kvm_get_pmt_entry(struct kvm *kvm, gfn_t gfn)
+{
+	uint64_t *pmt_base = kvm_host_get_pmt(kvm);
+
+	return pmt_base[gfn];
+}
+
 /*Function for translating host address to guest address*/
 
 static inline void *to_guest(struct kvm *kvm, void *addr)
arch/ia64/kvm/vtlb.c +28 -1
Index: linux-2.6.git/arch/ia64/kvm/vtlb.c
===================================================================
@@ -558,14 +558,41 @@
 	}
 }
 
+static unsigned long alloc_real_maddr(unsigned long gpfn)
+{
+	struct exit_ctl_data *p = &current_vcpu->arch.exit_data;
+	unsigned long psr;
+
+	local_irq_save(psr);
+
+	p->exit_reason = EXIT_REASON_ALLOC_MEM;
+	p->u.alloc_mem.gpfn = gpfn;
+	p->u.alloc_mem.pmt_val = 0;
+	vmm_transition(current_vcpu);
+
+	local_irq_restore(psr);
+
+	return p->u.alloc_mem.pmt_val;
+}
+
 u64 kvm_get_mpt_entry(u64 gpfn)
 {
 	u64 *base = (u64 *) KVM_P2M_BASE;
+	u64 pmt_val;
 
 	if (gpfn >= (KVM_P2M_SIZE >> 3))
 		panic_vm(current_vcpu, "Invalid gpfn =%lx\n", gpfn);
 
-	return *(base + gpfn);
+	pmt_val = *(base + gpfn);
+
+	if (!pmt_val) {
+		pmt_val = alloc_real_maddr(gpfn);
+		if (!pmt_val) {
+			//printk(KERN_ERR"kvm: NO Enough memory!\n");
+			panic_vm(current_vcpu, "not enough memory\n");
+		}
+	}
+	return pmt_val;
 }
 
 u64 kvm_lookup_mpa(u64 gpfn)
#3 lore raw
In reply to Jes Sorensen

Could you attach the kernel message info dumped by dmesg after breaking windows ? Actually, I am not aware of this. Xiantao

-----Original Message-----
From: Jes Sorensen [mailto:[email protected]]
Sent: Saturday, March 28, 2009 12:20 AM
To: Zhang, Xiantao
Cc: [email protected]
Subject: Re: windows patch seems to have broken allocation on demand patches

Quoted 2 lines · Xiantao

Which patches ?
Xiantao

This is the one I keep applying - but modified to be against the latest kernel, which is broken.

You came up with this due to the long startup time for KVM when booting large guests, like 64GB+ etc.

Cheers,
Jes

Quoted 17 lines

-----Original Message-----
From: Jes Sorensen [mailto:[email protected]]
Sent: Saturday, March 28, 2009 12:00 AM
To: Zhang, Xiantao
Cc: [email protected]
Subject: windows patch seems to have broken allocation on demand patches

Hi Xiantao,

The recent changes adding support for windows to KVM/ia64, seems to have broken the allocation on demand patches, needed to boot with large memory support.

Is there any chance you have an update version of these patches?

Cheers,
Jes

#4 lore raw
In reply to Jes Sorensen
Quoted 2 lines · Xiantao

Could you attach the kernel message info dumped by dmesg after breaking windows ? Actually, I am not aware of this. Xiantao

Hi Xiantao,

No sorry, I think I wasn't clear. After I did a pull and the windows patches were applied, it seems KVM no longer works here. I had a conflict in the attached patch with the windows changes and I believe that caused it - I will try and investigate further on Monday to see if I can track it down.

Regards,
Jes

#5 lore raw
In reply to Jes Sorensen
Quoted 11 lines · Jes Sorensen
Quoted 2 lines · Xiantao

Could you attach the kernel message info dumped by dmesg after breaking windows ? Actually, I am not aware of this. Xiantao

Hi Xiantao,

No sorry, I think I wasn't clear. After I did a pull and the windows patches were applied, it seems KVM no longer works here. I had a conflict in the attached patch with the windows changes and I believe that caused it - I will try and investigate further on Monday to see if I can track it down.

Okay, I think they have no much big changes in windows patch, should be easy to make it work again. Thanks! Xiantao