xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: Jan Beulich <JBeulich@suse.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: kexec@lists.infradead.org, xen-devel@lists.xensource.com,
	Daniel Kiper <dkiper@net-space.pl>,
	linux-kernel@vger.kernel.org
Subject: Re: [Xen-devel] incorrect layout of globals from head_64.S during kexec boot
Date: Tue, 10 Jul 2012 11:33:27 +0200	[thread overview]
Message-ID: <20120710093327.GA13864@aepfle.de> (raw)
In-Reply-To: <20120706172918.GA15222@aepfle.de>

On Fri, Jul 06, Olaf Hering wrote:

> On Fri, Jul 06, Jan Beulich wrote:
> 
> > > Could it be that some code tweaks the stack content used by decompress()
> > > in some odd way? But that would most likely lead to a crash, not to
> > > unexpected uncompressing results.
> > 
> > Especially if the old and new kernel are using the exact same
> > image, how about the decompression writing over the shared
> > info page causing all this? As the decompressor wouldn't
> > expect Xen to possibly write stuff there itself, it could easily be
> > that some repeat count gets altered, thus breaking the
> > decompressed data without the decompression code necessarily
> > noticing.
> 
> In my case the gfn of the shared info page is 1f54.
> Is it possible to move the page at runtime? It looks like it can be done
> because the hvm loader configures fffff initially.
> 
> Perhaps the PVonHVM code has to give up the shared pages or move them to
> some dedicated unused page during the process of booting into the new
> kernel.

The pfn 1f54 of the shared info page is in the middle of the new bzImage:
pfn    32080 KiB
_head  29360 KiB
_text  33826 KiB
_end   33924 KiB

In other words, the compressed vmlinux.bin gets slightly modified during
uncompression. For some reason this does not lead to decompression
errors.

In the patch below the pfn is moved from the bss to the data section. As
a result the new location is now at 28680 KiB, which is outside of the
bzImage.

Maybe there is a way to use another dedicated page as shared info page.

Olaf


diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index ff962d4..258e8f3 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1469,19 +1469,16 @@ void __ref xen_hvm_init_shared_info(void)
 {
 	int cpu;
 	struct xen_add_to_physmap xatp;
-	static struct shared_info *shared_info_page = 0;
+	static struct shared_info shared_info_page __page_aligned_data = {  };
 
-	if (!shared_info_page)
-		shared_info_page = (struct shared_info *)
-			extend_brk(PAGE_SIZE, PAGE_SIZE);
 	xatp.domid = DOMID_SELF;
 	xatp.idx = 0;
 	xatp.space = XENMAPSPACE_shared_info;
-	xatp.gpfn = __pa(shared_info_page) >> PAGE_SHIFT;
+	xatp.gpfn = __pa(&shared_info_page) >> PAGE_SHIFT;
 	if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
 		BUG();
 
-	HYPERVISOR_shared_info = (struct shared_info *)shared_info_page;
+	HYPERVISOR_shared_info = &shared_info_page;
 
 	/* xen_vcpu is a pointer to the vcpu_info struct in the shared_info
 	 * page, we use it in the event channel upcall and in some pvclock

  reply	other threads:[~2012-07-10  9:33 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05 21:06 incorrect layout of globals from head_64.S during kexec boot Olaf Hering
     [not found] ` <20120705210607.GA26908-QOLJcTWqO2uzQB+pC5nmwQ@public.gmane.org>
2012-07-06  8:29   ` [Xen-devel] " Jan Beulich
2012-07-06  8:41 ` Daniel Kiper
2012-07-06 12:07   ` Olaf Hering
2012-07-06 12:56     ` [Xen-devel] " Jan Beulich
     [not found]       ` <4FF6FCA9020000780008E0BB-ce6RLXgGx+vWGUEhTRrCg1aTQe2KTcn/@public.gmane.org>
2012-07-06 13:31         ` Olaf Hering
2012-07-06 13:53           ` Jan Beulich
2012-07-06 14:14           ` Olaf Hering
2012-07-06 14:50             ` Jan Beulich
2012-07-06 17:29               ` Olaf Hering
2012-07-10  9:33                 ` Olaf Hering [this message]
2012-07-10 14:14                   ` Konrad Rzeszutek Wilk
2012-07-10 14:46                     ` Ian Campbell
     [not found]                       ` <1341931594.8586.44.camel-T6UX0E5iMSquecqUINmzht73F7V6hmMc@public.gmane.org>
2012-07-10 14:51                         ` Konrad Rzeszutek Wilk
     [not found]                           ` <20120710145110.GA15218-6K5HmflnPlqSPmnEAIUT9EEOCMrvLtNR@public.gmane.org>
2012-07-10 15:29                             ` Ian Campbell
2012-07-10 15:37                               ` Olaf Hering
2012-07-10 15:23                     ` Olaf Hering
     [not found]                       ` <20120710152308.GA31819-QOLJcTWqO2uzQB+pC5nmwQ@public.gmane.org>
2012-07-10 17:26                         ` Konrad Rzeszutek Wilk
2012-07-10 18:09                           ` Olaf Hering
2012-07-10 18:32                             ` Konrad Rzeszutek Wilk
2012-07-10 19:08                             ` Keir Fraser
2012-07-13 20:20                               ` Olaf Hering
     [not found]                                 ` <20120713202003.GA20972-QOLJcTWqO2uzQB+pC5nmwQ@public.gmane.org>
2012-07-14  4:54                                   ` Keir Fraser
2012-07-15 16:06                               ` Olaf Hering
2012-07-15 17:17                                 ` Keir Fraser
2012-07-16 15:46                                 ` Konrad Rzeszutek Wilk
2012-07-17 10:24                                   ` Olaf Hering
2012-07-17 12:34                                     ` Olaf Hering
2012-07-06 15:54     ` Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120710093327.GA13864@aepfle.de \
    --to=olaf@aepfle.de \
    --cc=JBeulich@suse.com \
    --cc=dkiper@net-space.pl \
    --cc=kexec@lists.infradead.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).