From patchwork Fri Apr 22 03:23:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 1155 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:49:42 -0000 Delivered-To: patches@linaro.org Received: by 10.220.162.205 with SMTP id w13cs132766vcx; Thu, 21 Apr 2011 20:23:26 -0700 (PDT) Received: by 10.52.184.98 with SMTP id et2mr940193vdc.285.1303442606096; Thu, 21 Apr 2011 20:23:26 -0700 (PDT) Received: from mail-qw0-f50.google.com (mail-qw0-f50.google.com [209.85.216.50]) by mx.google.com with ESMTPS id r27si2305644vbw.81.2011.04.21.20.23.25 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Apr 2011 20:23:26 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.216.50 is neither permitted nor denied by best guess record for domain of nicolas.pitre@linaro.org) client-ip=209.85.216.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.216.50 is neither permitted nor denied by best guess record for domain of nicolas.pitre@linaro.org) smtp.mail=nicolas.pitre@linaro.org Received: by qwe5 with SMTP id 5so170196qwe.37 for ; Thu, 21 Apr 2011 20:23:25 -0700 (PDT) Received: by 10.224.189.20 with SMTP id dc20mr506670qab.287.1303442604027; Thu, 21 Apr 2011 20:23:24 -0700 (PDT) Received: from xanadu.home (modemcable092.28-130-66.mc.videotron.ca [66.130.28.92]) by mx.google.com with ESMTPS id s9sm1796274qco.36.2011.04.21.20.23.22 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Apr 2011 20:23:23 -0700 (PDT) Date: Thu, 21 Apr 2011 23:23:22 -0400 (EDT) From: Nicolas Pitre X-X-Sender: nico@xanadu.home To: Tony Lindgren cc: Shawn Guo , linux-arm-kernel@lists.infradead.org, patches@linaro.org, Aaro Koskinen , linux-omap@vger.kernel.org Subject: Re: [PATCH] ARM: Fix relocation if image end past uncompressed kernel end In-Reply-To: Message-ID: References: <1303272904-31392-1-git-send-email-nicolas.pitre@linaro.org> <20110420072156.GA28679@atomide.com> <20110420165514.GE10402@atomide.com> <20110421055945.GB13688@atomide.com> <20110421104954.GH13688@atomide.com> User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-Version: 1.0 On Thu, 21 Apr 2011, Nicolas Pitre wrote: > On Thu, 21 Apr 2011, Nicolas Pitre wrote: > > > On Thu, 21 Apr 2011, Tony Lindgren wrote: > > > > > Otherwise we end up overwriting ourselves. This fixes booting > > > on n900 after commit 6d7d0ae51574943bf571d269da3243257a2d15db > > > (ARM: 6750/1: improvements to compressed/head.S). > > > > > > Signed-off-by: Tony Lindgren > > > > I don't understand why this is needed. The copy loop is explicitly > > copying from the end going backward exactly to cope with this > > possibility. > > I think your patch is 1) unneeded (see the copy loop code and the > comment before it), and 2) simply hiding the real bug. > > I just need to modify the code in compressed/misc.c slightly for the > lzma decompressor to start or stop working randomly. It seems that this > code might be sensitive to slight displacement in memory caused by > modifications to totally unrelated code. I'm still trying to track this > down. I found the bugger. The problem was a bad stack alignment. ----- >8 From: Nicolas Pitre ARM: zImage: make sure the stack is 64-bit aligned With ARMv5+ and EABI, the compiler expects a 64-bit aligned stack so instructions like STRD and LDRD can be used. Without this, mysterious boot failures were seen semi randomly with the LZMA decompressor. While at it, let's align .bss as well. Signed-off-by: Nicolas Pitre diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 58ac434..79b5c62 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -74,7 +74,7 @@ ZTEXTADDR := $(CONFIG_ZBOOT_ROM_TEXT) ZBSSADDR := $(CONFIG_ZBOOT_ROM_BSS) else ZTEXTADDR := 0 -ZBSSADDR := ALIGN(4) +ZBSSADDR := ALIGN(8) endif SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in index 5309909..ea80abe 100644 --- a/arch/arm/boot/compressed/vmlinux.lds.in +++ b/arch/arm/boot/compressed/vmlinux.lds.in @@ -54,6 +54,7 @@ SECTIONS .bss : { *(.bss) } _end = .; + . = ALIGN(8); /* the stack must be 64-bit aligned */ .stack : { *(.stack) } .stab 0 : { *(.stab) }