From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Subject: Re: [Xen-devel] incorrect layout of globals from head_64.S during kexec boot Date: Fri, 13 Jul 2012 22:20:03 +0200 Message-ID: <20120713202003.GA20972@aepfle.de> References: <20120710180953.GB20075@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Keir Fraser Cc: Konrad Rzeszutek Wilk , Jan Beulich , xen-devel@lists.xensource.com, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Daniel Kiper List-Id: xen-devel@lists.xenproject.org On Tue, Jul 10, Keir Fraser wrote: > On 10/07/2012 19:09, "Olaf Hering" wrote: > > I'm not sure, most likely the gfn will just disappear from the guest, > > like a ballooned page disappears. Accessing it will likely cause a > > crash. > > Best thing to do, is possible, is map the shared-info page in the > xen-platform pci device's BAR memory range. Then it will not conflict with > any RAM. > > If you do map it over the top of an existing RAM page, you will have to > repopulate that RAM page before kexec, using populate_physmap hypercall. The > good news is that the populate_physmap hypercall will have the side effect > of unmapping the shared-info page, reayd to be mapped wherever the new > kernel would like it to reside :) Keir, is this a safe thing to do in a SMP guest? If arch/x86/xen/enlighten.c:xen_hvm_init_shared_info() allocates a page (backed by mfn M and pfn A) and assigns *HYPERVISOR_shared_info and *xen_vcpu then everything will reference these pointers. If drivers/xen/platform-pci.c:platform_pci_init would also do a XENMAPSPACE_shared_info call with pfn B, isnt there a small window where pfn A is not backed by a mfn because mfn M is now connected to pfn C? As a result other code paths which access *HYPERVISOR_shared_info and *xen_vcpu between the hypercall and the update of the pointers will read 0xff. If I read the hypercall code of XENMEM_add_to_physmap correctly the mfn backing *HYPERVISOR_shared_info will remain the same, so there is no need to copy data from the old to the new *HYPERVISOR_shared_info. What do you think, is that race real? Olaf