From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Parish Subject: Re: PAE xen + linux kernel boots ... Date: Sat, 30 Apr 2005 09:01:17 +0000 Message-ID: <20050430090117.GC16883@us.ibm.com> References: <20050425172624.GB22076@bytesex> <87ll74o29m.fsf@bytesex.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="LyciRD1jyfeSSjG0" Return-path: Resent-Message-ID: <20050430091254.GD16883@us.ibm.com> Resent-To: xen-devel@lists.xensource.com Content-Disposition: inline In-Reply-To: <87ll74o29m.fsf@bytesex.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Gerd Knorr List-Id: xen-devel@lists.xenproject.org --LyciRD1jyfeSSjG0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Apr 27, 2005 at 02:03:17PM +0200, Gerd Knorr wrote: > Well, now it does, boots up to a login prompt ;) I'm still not quite there, but the attached patch gets me a lot closer. The hypervisor was taking a pagefault in ptwr_emulated_update() when pl1e (a map_domain_mem() mapped page) was dereferenced to be copied. pl1e is a 64 bit type with pae, but only the first 4 bytes were getting mapped, and there was a case where pl1e would straddle a page boundary, so it was all over when the high bits were read. There's probably a better solution, but this at least got me past linux's kernel_physical_mapping_init(), which is where i was consistently crashing. sRp -- Scott Parish --LyciRD1jyfeSSjG0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="map-pairs.diff" diff -rN -u -p old-xen-unstable/xen/arch/x86/x86_32/domain_page.c new-xen-unstable/xen/arch/x86/x86_32/domain_page.c --- old-xen-unstable/xen/arch/x86/x86_32/domain_page.c 2005-04-27 20:19:53.000000000 +0000 +++ new-xen-unstable/xen/arch/x86/x86_32/domain_page.c 2005-04-30 08:42:30.000000000 +0000 @@ -20,7 +20,7 @@ #include l1_pgentry_t *mapcache; -static unsigned int map_idx, epoch, shadow_epoch[NR_CPUS]; +static unsigned int map_idx = 0, epoch, shadow_epoch[NR_CPUS]; static spinlock_t map_lock = SPIN_LOCK_UNLOCKED; /* Use a spare PTE bit to mark entries ready for recycling. */ @@ -39,7 +39,7 @@ static void flush_all_ready_maps(void) } -void *map_domain_mem(unsigned long pa) +void *map_domain_mem(unsigned long long pa) { unsigned long va; unsigned int idx, cpu = smp_processor_id(); @@ -62,7 +62,7 @@ void *map_domain_mem(unsigned long pa) } do { - idx = map_idx = (map_idx + 1) & (MAPCACHE_ENTRIES - 1); + idx = map_idx = (map_idx + 2) & (MAPCACHE_ENTRIES - 1); if ( unlikely(idx == 0) ) { ASSERT(flush_count++ == 0); @@ -75,6 +75,7 @@ void *map_domain_mem(unsigned long pa) while ( l1e_get_flags(cache[idx]) & _PAGE_PRESENT ); cache[idx] = l1e_create_phys(pa, __PAGE_HYPERVISOR); + cache[idx + 1] = l1e_create_phys(pa + sizeof(u32), __PAGE_HYPERVISOR); spin_unlock(&map_lock); @@ -89,4 +90,5 @@ void unmap_domain_mem(void *va) ASSERT(va < (void *)MAPCACHE_VIRT_END); idx = ((unsigned long)va - MAPCACHE_VIRT_START) >> PAGE_SHIFT; l1e_add_flags(&mapcache[idx], READY_FOR_TLB_FLUSH); + l1e_add_flags(&mapcache[idx + 1], READY_FOR_TLB_FLUSH); } diff -rN -u -p old-xen-unstable/xen/include/asm-x86/x86_32/domain_page.h new-xen-unstable/xen/include/asm-x86/x86_32/domain_page.h --- old-xen-unstable/xen/include/asm-x86/x86_32/domain_page.h 2005-04-27 20:19:53.000000000 +0000 +++ new-xen-unstable/xen/include/asm-x86/x86_32/domain_page.h 2005-04-30 08:05:25.000000000 +0000 @@ -19,7 +19,7 @@ extern l1_pgentry_t *mapcache; * The entire page containing that VA is now accessible until a * corresponding call to unmap_domain_mem(). */ -extern void *map_domain_mem(unsigned long pa); +extern void *map_domain_mem(unsigned long long pa); /* * Pass a VA within a page previously mapped with map_domain_mem(). --LyciRD1jyfeSSjG0 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --LyciRD1jyfeSSjG0--