From: "Jan Beulich" Subject: Re: [PATCH] x86-64 linux: unmap temporary mappings established for setup of 1:1 mappings Date: Tue, 06 Jun 2006 14:38:36 +0200 Message-ID: <4485936C.76E4.0078.0@novell.com> References: <447DB394.76E4.0078.0@novell.com> <368ae6e00389bbd4d2b4fdd55ddc5411@cl.cam.ac.uk> <4480050A.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part82A74E5C.1__=" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part82A74E5C.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline >I backed out the patch in -unstable since it didn't build. In any case >I felt that it was doing more than just zapping the extra init mappings >(it changed various bits and pieces, I think to allow safe calling of >init_memory_mapping() after bootstrap, which I think we never currently >do -- it belongs in a separate patch anyway). > >I think I will wait until someone has a chance to look at this more >thoroughly and can make a patch that zaps all the init mappings in one >single place. I'll then look at backporting that patch to -testing. While I saw that the essential part of the patch was applied (again), here is a patch to remove all early mappings (except for the kernel image itself, of course). Signed-off-by: Jan Beulich --=__Part82A74E5C.1__= Content-Type: text/plain; name="xenlinux-x86_64-unmap-early-2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xenlinux-x86_64-unmap-early-2.patch" Index: head-2006-06-06/arch/x86_64/kernel/setup-xen.c =================================================================== --- head-2006-06-06.orig/arch/x86_64/kernel/setup-xen.c 2006-06-06 14:13:44.000000000 +0200 +++ head-2006-06-06/arch/x86_64/kernel/setup-xen.c 2006-06-06 12:55:07.000000000 +0200 @@ -819,14 +819,6 @@ void __init setup_arch(char **cmdline_p) #ifdef CONFIG_XEN { int i, j, k, fpp; - unsigned long va; - - /* 'Initial mapping' of initrd must be destroyed. */ - for (va = xen_start_info->mod_start; - va < (xen_start_info->mod_start+xen_start_info->mod_len); - va += PAGE_SIZE) { - HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0); - } if (!xen_feature(XENFEAT_auto_translated_physmap)) { /* Make sure we have a large enough P->M table. */ @@ -842,14 +842,6 @@ void __init setup_arch(char **cmdline_p) PFN_PHYS(PFN_UP(xen_start_info->nr_pages * sizeof(unsigned long)))); - /* Destroyed 'initial mapping' of old p2m table. */ - for (va = xen_start_info->mfn_list; - va < (xen_start_info->mfn_list + - (xen_start_info->nr_pages*sizeof(unsigned long))); - va += PAGE_SIZE) { - HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0); - } - /* * Initialise the list of the frames that specify the * list of frames that make up the p2m table. Used by Index: head-2006-06-06/arch/x86_64/mm/init-xen.c =================================================================== --- head-2006-06-06.orig/arch/x86_64/mm/init-xen.c 2006-06-06 14:13:44.000000000 +0200 +++ head-2006-06-06/arch/x86_64/mm/init-xen.c 2006-06-06 14:14:41.000000000 +0200 @@ -668,11 +668,23 @@ void __meminit init_memory_mapping(unsig if (!after_bootmem) { BUG_ON(start_pfn != table_end); - /* - * Destroy the temporary mappings created above. Prevents - * overlap with modules area (if init mapping is very big). - */ - start = __START_KERNEL_map + (table_start << PAGE_SHIFT); + + /* Re-vector virtual addresses pointing into the initial + mapping to the just established permanent ones. */ + xen_start_info = __va(__pa(xen_start_info)); + xen_start_info->pt_base = (unsigned long)__va(__pa(xen_start_info->pt_base)); + if (!xen_feature(XENFEAT_auto_translated_physmap)) { + phys_to_machine_mapping = __va(__pa(xen_start_info->mfn_list)); + xen_start_info->mfn_list = (unsigned long)phys_to_machine_mapping; + } + if (xen_start_info->mod_start) + xen_start_info->mod_start = (unsigned long)__va(__pa(xen_start_info->mod_start)); + + /* Destroy the Xen-created mappings beyond the kernel image as well + * as the temporary mappings created above. Prevents overlap with + * modules area (if init mapping is very big). + */ + start = PAGE_ALIGN((unsigned long)_end); end = __START_KERNEL_map + (table_end << PAGE_SHIFT); for (; start < end; start += PAGE_SIZE) WARN_ON(HYPERVISOR_update_va_mapping( --=__Part82A74E5C.1__= 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 --=__Part82A74E5C.1__=--