linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Milton Miller <miltonm@bga.com>
To: Jim Keniston <jkenisto@linux.vnet.ibm.com>
Cc: Michael Neuling <mikey@neuling.org>, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc: fix call to subpage_protection()
Date: Tue, 30 Nov 2010 05:08:00 -0600	[thread overview]
Message-ID: <mdm-initramfs-debug-fix@mdm.bga.com> (raw)
In-Reply-To: <1290110779.32570.9.camel@pasglop>

[fixed Michael Neuling's address]

On Fri Nov 19 about 07:06:19 EST in 2010, Benjamin Herrenschmidt wrote:
> On Thu, 2010-11-18 at 10:23 -0800, Jim Keniston wrote:
> > FWIW, this failure isn't an obstacle for me.  I'm in no way attached to
> > my legacy configuration; pseries_defconfig is fine for me.  On the other
> > hand, I can continue testing fixes, and/or make my system available to
> > other IBMers when I'm not using it, if you want to continue to pursue
> > this problem.

> From the look of it your "legacy" config is lacking the necessary
> storage drivers...
> 

Looking closer, it would appear he intended to get them from initramfs
but unpacking it failed.  Pulling from his log in the original message:

> > 
> > Calling ibm,client-architecture-support... not implemented
> > command line: root=/dev/disk/by-id/scsi-SIBM_ST373453LC_3HW1CQ1400007445Q2A4-part3 quiet profile=2 sysrq=1 insmod=sym53c8xx insmod=ipr crashkernel=256M-:128M loglevel=8 
> > 
> > memory layout at init:
> >   memory_limit : 0000000000000000 (16 MB aligned)
> >   alloc_bottom : 0000000003550000
> >   alloc_top    : 0000000008000000
> >   alloc_top_hi : 0000000070000000
> >   amo_top      : 0000000008000000
> >   ram_top      : 0000000070000000
> > instantiating rtas at 0x00000000076a0000... done
> > boot cpu hw idx 0
> > starting cpu hw idx 2... done
> > copying OF device tree...
> > Building dt strings...
> > Building dt structure...
> > Device tree strings 0x0000000003560000 -> 0x000000000356129c
> > Device tree struct  0x0000000003570000 -> 0x0000000003580000
..
> > Found initrd at 0xc000000002d00000:0xc00000000354e28a
..
> > NET: Registered protocol family 1
> > PCI: CLS 128 bytes, default 128
> > Unpacking initramfs...
> > Initramfs unpacking failed: read error

"read error" occurs in lib/decompress_inflate.c if the fill routine
returns a negative count, which would inlclude a NULL fill pointer like
init/initramfs.c.


Maybe this debugging patch (against 2.6.35, applys with small offset to 
2.6.37-rc4) can help isolate the corruption?

From: Milton Miller <miltonm.bga.com>
initramfs: show input and output offsets on unpacking failures

When the initramfs input is corrupted, having the pointer to the buffer
segment being decompressed, and the decompress input and output byte
counts from the compressed stream can help isolate the source of the
corruption.

Signed-off-by: Milton Miller <miltonm@bga.com>

---
 init/initramfs.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: sim/init/initramfs.c
===================================================================
--- sim.orig/init/initramfs.c	2009-07-13 18:44:56.000000000 -0500
+++ sim/init/initramfs.c	2009-07-13 18:59:32.000000000 -0500
@@ -384,6 +384,9 @@ static int __init write_buffer(char *buf
 	return len - count;
 }
 
+static unsigned my_inptr;   /* index of next byte to be processed in inbuf */
+static unsigned bytes_out;  /* count of chars processed from current archive */
+
 static int __init flush_buffer(void *bufv, unsigned len)
 {
 	char *buf = (char *) bufv;
@@ -393,6 +396,7 @@ static int __init flush_buffer(void *buf
 		return -1;
 	while ((written = write_buffer(buf, len)) < len && !message) {
 		char c = buf[written];
+		bytes_out += written;
 		if (c == '0') {
 			buf += written;
 			len -= written;
@@ -407,8 +411,6 @@ static int __init flush_buffer(void *buf
 	return origLen;
 }
 
-static unsigned my_inptr;   /* index of next byte to be processed in inbuf */
-
 #include <linux/decompress/generic.h>
 
 static char * __init unpack_to_rootfs(char *buf, unsigned len)
@@ -430,6 +432,8 @@ static char * __init unpack_to_rootfs(ch
 	message = NULL;
 	while (!message && len) {
 		loff_t saved_offset = this_header;
+		bytes_out = 0;
+		my_inptr = 0;
 		if (*buf == '0' && !(this_header & 3)) {
 			state = Start;
 			written = write_buffer(buf, len);
@@ -462,6 +466,9 @@ static char * __init unpack_to_rootfs(ch
 		buf += my_inptr;
 		len -= my_inptr;
 	}
+	if (message) {
+		printk(KERN_ERR "Failed unpacking at %p input %d output %d \n",buf - my_inptr, my_inptr, bytes_out);
+	}
 	dir_utime();
 	kfree(name_buf);
 	kfree(symlink_buf);

  parent reply	other threads:[~2010-11-30 11:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-10 19:54 Can't boot benh/powerpc.git kernel Jim Keniston
2010-11-10 22:06 ` Benjamin Herrenschmidt
2010-11-12  0:07   ` Jim Keniston
2010-11-12  2:29     ` Benjamin Herrenschmidt
2010-11-16  3:26     ` Michael Neuling
2010-11-17  1:51       ` Jim Keniston
2010-11-17  2:03         ` Michael Neuling
2010-11-17 19:00           ` Jim Keniston
2010-11-18  2:32             ` [PATCH] powerpc: fix call to subpage_protection() Michael Neuling
2010-11-18 12:21               ` Michael Ellerman
2010-11-18 20:24                 ` Michael Neuling
2010-11-18 21:53                   ` Michael Ellerman
2010-11-18 18:23               ` Jim Keniston
2010-11-18 20:06                 ` Benjamin Herrenschmidt
2010-11-30 11:06                   ` Milton Miller
2010-11-30 11:08                   ` Milton Miller [this message]
2010-11-30 20:55                     ` Jim Keniston

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=mdm-initramfs-debug-fix@mdm.bga.com \
    --to=miltonm@bga.com \
    --cc=jkenisto@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    /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).