From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Cihula, Joseph" Subject: [RFC] fix xen_in_range() Date: Wed, 22 Apr 2009 16:53:37 -0700 Message-ID: <4F65016F6CB04E49BFFA15D4F7B798D9988CF1A3@orsmsx506.amr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Return-path: Content-Language: en-US List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" , Keir Fraser Cc: "Cui, Dexuan" , "Wang, Shane" , "Jiang, Yunhong" , "Yang, Xiaowei" , "Ke, Liping" , "Li, Xin" List-Id: xen-devel@lists.xenproject.org The frametable check in xen_in_range() incorrectly compares virtual address= es to physical addresses (i.e. the parameters). Unfortunately, the frametable is only contiguous in the virtual address spa= ce, 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 perce= ptible delay when that check has to be done for each page of physical memor= y (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 becau= se they will convert to the DIRECTMAP va's instead. So while I would prefer to find a way to keep the check against the frameta= ble, 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 che= ck altogether. Signed-off-by: Joseph Cihula 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 =3D __pa(&__bss_start); xen_regions[3].e =3D allocator_bitmap_end; - /* frametable */ - xen_regions[4].s =3D (unsigned long)frame_table; - xen_regions[4].e =3D (unsigned long)frame_table + - PFN_UP(max_page * sizeof(*frame_table)); } for ( i =3D 0; i < ARRAY_SIZE(xen_regions); i++ )