[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] x86-64: fix hotplug fault handling for 32-bit domains' M2P range



- handle only when memory hotplug regions were actually found
- fix off-by-one error in fault handler's sanity checking
- use first L4 table entry

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- 2010-03-02.orig/xen/arch/x86/x86_64/mm.c    2010-03-02 09:24:28.000000000 
+0100
+++ 2010-03-02/xen/arch/x86/x86_64/mm.c 2010-03-03 12:04:31.000000000 +0100
@@ -1215,12 +1215,9 @@ int pagefault_by_memadd(unsigned long ad
 {
     struct domain *d = current->domain;
 
-    if (guest_mode(regs) &&
-        is_pv_32bit_domain(d) &&
-        ((addr >= HYPERVISOR_COMPAT_VIRT_START(d)) &&
-             (addr < MACH2PHYS_COMPAT_VIRT_END)) )
-            return 1;
-    return 0;
+    return mem_hotplug && guest_mode(regs) && is_pv_32bit_domain(d) &&
+           (addr >= HYPERVISOR_COMPAT_VIRT_START(d)) &&
+           (addr < MACH2PHYS_COMPAT_VIRT_END);
 }
 
 int handle_memadd_fault(unsigned long addr, struct cpu_user_regs *regs)
@@ -1238,15 +1235,15 @@ int handle_memadd_fault(unsigned long ad
     if (!is_pv_32on64_domain(d))
         return 0;
 
-    if ((addr < HYPERVISOR_COMPAT_VIRT_START(d)) ||
-             (addr > MACH2PHYS_COMPAT_VIRT_END) )
+    if ( (addr < HYPERVISOR_COMPAT_VIRT_START(d)) ||
+         (addr >= MACH2PHYS_COMPAT_VIRT_END) )
         return 0;
 
     mfn = (read_cr3()) >> PAGE_SHIFT;
 
     pl4e = map_domain_page(mfn);
 
-    l4e = pl4e[addr];
+    l4e = pl4e[0];
 
     if (!(l4e_get_flags(l4e) & _PAGE_PRESENT))
         goto unmap;



Attachment: x86_64-memadd-fault.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.