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] [RFC] fix xen_in_range()

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: [Xen-devel] [RFC] fix xen_in_range()
From: "Cihula, Joseph" <joseph.cihula@xxxxxxxxx>
Date: Wed, 22 Apr 2009 16:53:37 -0700
Accept-language: en-US
Acceptlanguage: en-US
Cc: "Cui, Dexuan" <dexuan.cui@xxxxxxxxx>, "Wang, Shane" <shane.wang@xxxxxxxxx>, "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>, "Yang, Xiaowei" <xiaowei.yang@xxxxxxxxx>, "Ke, Liping" <liping.ke@xxxxxxxxx>, "Li, Xin" <xin.li@xxxxxxxxx>
Delivery-date: Wed, 22 Apr 2009 16:54:06 -0700
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcnDpY3Rx9vYpAhLRJKuPa7HelNYvQ==
Thread-topic: [RFC] fix xen_in_range()
The frametable check in xen_in_range() incorrectly compares virtual addresses 
to physical addresses (i.e. the parameters).

Unfortunately, the frametable is only contiguous in the virtual address space, 
so one can't simply take __pa() of its start and end.  And since it is quite 
large, iterating through each page to gets its phys addr adds a perceptible 
delay when that check has to be done for each page of physical memory (as is 
the case in the only caller, the VT-d routine that maps memory for dom0).  But 
it also appears that we can't convert the phys addr arguments into their virt 
addrs to compare with the contiguous frametable range because they will convert 
to the DIRECTMAP va's instead.

So while I would prefer to find a way to keep the check against the frametable, 
I don't see any obvious way to do so.  So this RFC is to see if there are any 
ideas for how the test could be re-written.

If not, then the below patch should be applied to remove the frametable check 

Signed-off-by:  Joseph Cihula <joseph.cihula@xxxxxxxxx>

diff -r 655dc3bc1d8e xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Thu Apr 16 11:54:06 2009 +0100
+++ b/xen/arch/x86/setup.c      Wed Apr 22 15:23:46 2009 -0700
@@ -1119,7 +1119,7 @@ int xen_in_range(paddr_t start, paddr_t
     int i;
     static struct {
         paddr_t s, e;
-    } xen_regions[5];
+    } xen_regions[4];

     /* initialize first time */
     if ( !xen_regions[0].s )
@@ -1140,10 +1140,6 @@ int xen_in_range(paddr_t start, paddr_t
         /* bss + boot allocator bitmap */
         xen_regions[3].s = __pa(&__bss_start);
         xen_regions[3].e = allocator_bitmap_end;
-        /* frametable */
-        xen_regions[4].s = (unsigned long)frame_table;
-        xen_regions[4].e = (unsigned long)frame_table +
-                           PFN_UP(max_page * sizeof(*frame_table));

     for ( i = 0; i < ARRAY_SIZE(xen_regions); i++ )

Xen-devel mailing list