xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86-64: fix hotplug fault handling for 32-bit domains' M2P range
@ 2010-03-03 11:09 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2010-03-03 11:09 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 1515 bytes --]

- 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@novell.com>

--- 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 #2: x86_64-memadd-fault.patch --]
[-- Type: text/plain, Size: 1509 bytes --]

- 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@novell.com>

--- 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 #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-03-03 11:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-03 11:09 [PATCH] x86-64: fix hotplug fault handling for 32-bit domains' M2P range Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).