This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] [PATCH] fix bug 169

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] fix bug 169
From: "Li, Xin B" <xin.b.li@xxxxxxxxx>
Date: Thu, 25 Aug 2005 23:01:24 +0800
Delivery-date: Thu, 25 Aug 2005 14:59:35 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcWphdyRaNyALQtKTYWkUriUf1z3Bg==
Thread-topic: [PATCH] fix bug 169
This patch fixes bug 169.

The root cause of bug 169 is, machine_to_phys_mapping, starting from
0xffff800000000000, is mapped using 2M pages.  When the system has RAM
no more than 2G, only one 2M page is allocated and only one PDE entry is
created correspondingly, so calling mfn_to_pfn with mfn > 0x80000 will
overflow this 2M page and cause a unable handled kernel paging request.
The mfn > 0x80000 comes from PCI device I/O memory, here from AGP
display card when booting X server.  Jun suggested to use something like
get_user() when accessing machine_to_phys_mapping.

Signed-off-by: Xin Li <xin.b.li@xxxxxxxxx>

diff -r d8fd24b43080
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/page.h    Mon Aug
22 10:18:14 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/page.h    Thu Aug
25 22:49:59 2005
@@ -64,7 +64,28 @@
 extern u32 *phys_to_machine_mapping;
 #define pfn_to_mfn(_pfn) ((unsigned long)
phys_to_machine_mapping[(unsigned int)(_pfn)])
-#define mfn_to_pfn(_mfn) ((unsigned long)
machine_to_phys_mapping[(unsigned int)(_mfn)])
+//#define mfn_to_pfn(_mfn) ((unsigned long)
machine_to_phys_mapping[(unsigned int)(_mfn)])
+static inline unsigned long mfn_to_pfn(unsigned long mfn)
+       unsigned int pfn;
+       u32* addr = &machine_to_phys_mapping[(unsigned int)(mfn)];
+       __asm__ __volatile__(
+               "1:     movl %1,%k0\n"
+               "2:\n"
+               ".section .fixup,\"ax\"\n"
+               "3:     movl %2,%k0\n"
+               "       jmp 2b\n"
+               ".previous\n"
+               ".section __ex_table,\"a\"\n"
+               "       .align 8\n"
+               "       .quad 1b,3b\n"
+               ".previous"
+               : "=r"(pfn)
+               : "m"(*addr), "i"(0x55555555));
+       return (unsigned long)pfn;

 /* Definitions for machine and pseudophysical addresses. */
 typedef unsigned long paddr_t;

Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>