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

[Xen-changelog] [xen-unstable] x86-64: fix hotplug fault handling for 32-bit domains' M2P range



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1267638118 0
# Node ID b8d2a4134a6823f6d5179928a0618eaf33be4684
# Parent  401c0012b8273dbe6711c48d9d5bd2409808330f
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>
---
 xen/arch/x86/x86_64/mm.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff -r 401c0012b827 -r b8d2a4134a68 xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c  Wed Mar 03 17:40:48 2010 +0000
+++ b/xen/arch/x86/x86_64/mm.c  Wed Mar 03 17:41:58 2010 +0000
@@ -1213,12 +1213,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)
@@ -1236,15 +1233,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;

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


 


Rackspace

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