From: Ralf Baechle <ralf@linux-mips.org>
To: Attila Kinali <attila@kinali.ch>
Cc: linux-mips@linux-mips.org
Subject: Re: crash in first printk of start_kernel
Date: Tue, 13 Mar 2007 01:02:52 +0000 [thread overview]
Message-ID: <20070313010252.GB26119@linux-mips.org> (raw)
In-Reply-To: <20070309191354.f962e57b.attila@kinali.ch>
On Fri, Mar 09, 2007 at 07:13:54PM +0100, Attila Kinali wrote:
Grüzi Attila,
> I'm using a 2.6.16.11 (an old snapshot from about last august,
> when we started development of another board) that has slight
> adjustments in various drivers to accomodate for our platform
> specific stuff.
You may want to update anyway. between the linux-2.6.16.11 tag of the
linux-mips.org and the top of the linux-2.6.16-stable branch there are
almost 58,000 lines of patch. Even more if your compare the MIPS -stable
branch to kernel.org's 2.6.16.11. Iow a few metric buttloads.
> While booting from u-boot works fine, ie it can load the kernel
> from tftp, checksum is ok, uncompression is ok. It then jumps
> into the kernel but ends up in an exception handler when executing
> the first printk in start_kernel (ie the printk(KERN_NOTICE);
> at init/main.c:451).
>
> While in the "exception handler" endless loop from u-boot
> ra points to vscnprintf() (lib/vsprintf.c:512)
> where it calls vsnprintf() (at line 517).
>
> If i set a breakpoint at lib/vsprintf.c:517 and follow it
> into vsnprintf, i get the follwing gdb log:
>
> ---
> Breakpoint 3, vscnprintf (buf=0x80411548 "", size=0x803b1fac,
> fmt=0x8036f10c "<5>", args=0x803b1fac) at lib/vsprintf.c:517
> 517 i=vsnprintf(buf,size,fmt,args);
> (gdb) step
> vsnprintf (buf=0x80411548 "", size=0x400, fmt=0x8036f10c "<5>", args=0xff0000)
> at lib/vsprintf.c:276
> 276 if (unlikely((int) size < 0)) {
> (gdb) next
> 285 end = buf + size - 1;
> (gdb) next
> 287 if (end < buf - 1) {
> (gdb) p end
> $1 = 0x80411947 ""
> (gdb) p buf
> $2 = 0x80411548 ""
> ---
>
> if i go here further (either next/step or continue), then i end up
> in the exception handler. So, it must be something in the asm
> of this line:
>
> ---
> (gdb) disassemble $pc $pc+100
> Dump of assembler code from 0x8026612c to 0x80266190:
> 0xffffffff80266134 <vsnprintf+76>: beqz v0,0x80266144 <vsnprintf+92>
> 0xffffffff80266138 <vsnprintf+80>: bltz a0,0x802461c0 <jffs2_remount_fs+144>
A branch in the delay slot of another branch is forbidden by the MIPS
architecture. All processors I every tried this on missbehave in very
unobvious ways when this is attempted.
You may want to compare that against your vmlinux file. If the vmlinux
binary also contains this bug, try building the affected source file with
-S to find if the bug is cause by compiler or assembler.
> End of assembler dump.
> ---
>
> But if i use stepi from here on, then it looks like that the
> BDI2000's breakpoint (both soft and hard) somehow interferes
> with the execution of the code:
In single stepping mode your debugger probably executes branches by
software emulation. Chances are the emulation does something different
for this illegal code sequence than actual hardware.
> ---
> (gdb) display/i $pc
> 1: x/i $pc 0x8026612c <vsnprintf+68>: addiu v0,a0,-1
> (gdb) stepi
> 0xffffffff80266130 287 if (end < buf - 1) {
> 1: x/i $pc 0x80266130 <vsnprintf+72>: sltu v0,s2,v0
> (gdb) stepi
> 287 if (end < buf - 1) {
> 1: x/i $pc 0x80266134 <vsnprintf+76>: beqz v0,0x80266144 <vsnprintf+92>
> (gdb) stepi
> 287 if (end < buf - 1) {
> 1: x/i $pc 0x80266134 <vsnprintf+76>: beqz v0,0x80266144 <vsnprintf+92>
> (gdb) stepi
> 287 if (end < buf - 1) {
> 1: x/i $pc 0x80266134 <vsnprintf+76>: beqz v0,0x80266144 <vsnprintf+92>
> (gdb) stepi
> 287 if (end < buf - 1) {
> 1: x/i $pc 0x80266134 <vsnprintf+76>: beqz v0,0x80266144 <vsnprintf+92>
> (gdb) stepi
> ---
>
> Yes, the next instruction (bltz a0,0x802461c0 <jffs2_remount_fs+144>)
> looks fishy and should be most probably a NOP. If i patch this point
> by hand and continue it crashes at another point.
>
> The only two reasons why the instruction at this point could be
> wrong, is either a gcc bug or a bug in u-boot's gunzip function.
> And i somewhat doubt both. gcc is a 3.3.1 from Montavista and both
> gcc and u-boot work on our other board which has a similar layout.
3.3.1 is _dangerously_ old. At the very least update to 3.3.6 - or even
4.1.2. A vanilla source gcc tree from ftp.gnu.org is fine to build the
kernel.
Ralf
next prev parent reply other threads:[~2007-03-13 1:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-09 18:13 crash in first printk of start_kernel Attila Kinali
2007-03-13 1:02 ` Ralf Baechle [this message]
2007-03-14 8:04 ` Attila Kinali
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=20070313010252.GB26119@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=attila@kinali.ch \
--cc=linux-mips@linux-mips.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