From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from parcelfarce.linux.theplanet.co.uk (parcelfarce.linux.theplanet.co.uk [195.92.249.252]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTP id 9260167BAA for ; Sat, 2 Jul 2005 00:34:34 +1000 (EST) Date: Fri, 1 Jul 2005 06:44:38 -0300 From: Marcelo Tosatti To: Anton =?iso-8859-1?Q?W=F6llert?= Message-ID: <20050701094438.GA11121@logos.cnet> References: <42C1AAC1.4060702@gmail.com> <20050629085913.GA2153@logos.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 In-Reply-To: Cc: linux-ppc-embedded Subject: Re: mpc8xx and ld.so problem List-Id: Linux on Embedded PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Hi Anton, (moving to ppc-embedded since it might be of interesting for other=20 8xx users) On Thu, Jun 30, 2005 at 04:13:30PM +0200, Anton W=F6llert wrote: > Hello Marcelo >=20 > I suggest you should find out why binaries hang and where. > >=20 > > You can see where processes are sleeping with: > >=20 > > ps -axeo "command nwchan" > >=20 >=20 > thank you for that tip. but i found out (what i should have had to do=20 > before), that the application doesn't hang in kernel-mode. so wchan doe= sn't=20 > say anything. but with gdb i saw the problem, the application hangs in = the=20 > function memset at the instruction dcbz, this should be a instruction, = that=20 > loops until it something is zero or so ( sorry, that i didn't looked up= it=20 > yet, i will do that ). and because of the bug of these dcbx instruction= s on=20 > 8xx i think, that this is the cause. here my gdb-session, i hope you ma= y=20 > find it helpful or give me an advise how to fix that : >=20 > awoeller@zwiebel > :~/ToolChains/new.usr.chain/powerpc-linux-toolchain/src/busybox-1.00$po= werpc-linux-gdb > GNU gdb 6.3 > Copyright 2004 Free Software Foundation, Inc. > GDB is free software, covered by the GNU General Public License, and yo= u are > welcome to change it and/or distribute copies of it under certain=20 > conditions. > Type "show copying" to see the conditions. > There is absolutely no warranty for GDB. Type "show warranty" for detai= ls. > This GDB was configured as "--host=3Di686-linux --target=3Dpowerpc-linu= x". > (gdb) set solib-absolute-prefix /tmp/fakelibc=20 > (gdb) file busybox > Reading symbols from=20 > /home/awoeller/ToolChains/new.usr.chain/powerpc-linux-toolchain/src/bus= ybox- > 1.00/busybox...done. > (gdb) b main > Breakpoint 1 at 0x1000398c: file=20 > /home/awoeller/ToolChains/new.usr.chain/powerpc-linux-toolchain/src/bus= ybox- > 1.00/applets/busybox.c, line 75. > (gdb) target remote tqm850l:123 > Remote debugging using tqm850l:123 > 0x300103f4 in ?? () > (gdb) cont > Continuing. > # here i interrupt, because it hangs > Program received signal SIGINT, Interrupt. > 0x30013e58 in ?? () > (gdb) return > Make selected stack frame return now? (y or n) y > #0 0x3000e374 in ?? () > (gdb) cont > Continuing. >=20 > Breakpoint 1, main (argc=3D1, argv=3D0x7ffffeb4) at=20 > /home/awoeller/ToolChains/new.usr.chain/powerpc-linux-toolchain/src/bus= ybox- > 1.00/applets/busybox.c:75 > 75 bb_applet_name =3D argv[0]; >=20 > (gdb) disas 0x30013e58 > Dump of assembler code for function memset: > 0x30013ba4 : cmplwi cr1,r5,4 > 0x30013ba8 : andi. r7,r3,3 > 0x30013bac : mr r6,r3 > 0x30013bb0 : ble- cr1,0x30013d40 > 0x30013bb4 : cmplwi cr5,r5,31 > 0x30013bb8 : rlwimi r4,r4,8,16,23 > 0x30013bbc : beq+ 0x30013be0 > 0x30013bc0 : mtcrf 1,r3 > 0x30013bc4 : subfic r7,r7,4 > 0x30013bc8 : add r6,r6,r7 > 0x30013bcc : subf r5,r7,r5 > 0x30013bd0 : bns+ cr7,0x30013bdc > 0x30013bd4 : stb r4,0(r3) > 0x30013bd8 : beq- cr7,0x30013be0 > 0x30013bdc : sth r4,-2(r6) > 0x30013be0 : mtcrf 1,r5 > 0x30013be4 : rlwimi r4,r4,16,0,15 > 0x30013be8 : ble- cr5,0x30013d80 > 0x30013bec : andi. r7,r6,28 > 0x30013bf0 : subfic r7,r7,32 > 0x30013bf4 : beq- 0x30013c34 > 0x30013bf8 : mtcrf 1,r7 > 0x30013bfc : add r6,r6,r7 > 0x30013c00 : subf r5,r7,r5 > 0x30013c04 : cmplwi cr1,r7,16 > 0x30013c08 : mr r8,r6 > 0x30013c0c : bge- cr7,0x30013c18 > 0x30013c10 : stw r4,-4(r8) > 0x30013c14 : stwu r4,-8(r8) > 0x30013c18 : blt- cr1,0x30013c2c > 0x30013c1c : stw r4,-4(r8) > 0x30013c20 : stw r4,-8(r8) > 0x30013c24 : stw r4,-12(r8) > 0x30013c28 : stwu r4,-16(r8) > 0x30013c2c : ble- cr7,0x30013c34 > 0x30013c30 : stw r4,-4(r8) > 0x30013c34 : cmplwi cr1,r4,0 > 0x30013c38 : rlwinm. r7,r5,0,0,26 > 0x30013c3c : mtcrf 1,r5 > 0x30013c40 : beq- cr1,0x30013de0 > 0x30013c44 : rlwinm r0,r7,27,5,31 > 0x30013c48 : mtctr r0 > 0x30013c4c : beq- 0x30013d80 > 0x30013c50 : clrlwi. r5,r5,27 > 0x30013c54 : add r6,r6,r7 > 0x30013c58 : li r8,-64 > 0x30013c5c : bdz- 0x30013c90 > 0x30013c60 : dcbtst r8,r6 > 0x30013c64 : stw r4,-4(r6) > 0x30013c68 : stw r4,-8(r6) > 0x30013c6c : stw r4,-12(r6) > 0x30013c70 : stw r4,-16(r6) > 0x30013c74 : nop > 0x30013c78 : stw r4,-20(r6) > 0x30013c7c : stw r4,-24(r6) > 0x30013c80 : nop > 0x30013c84 : stw r4,-28(r6) > 0x30013c88 : stwu r4,-32(r6) > 0x30013c8c : bdnz+ 0x30013c60 > 0x30013c90 : stw r4,-4(r6) > 0x30013c94 : stw r4,-8(r6) > 0x30013c98 : stw r4,-12(r6) > 0x30013c9c : stw r4,-16(r6) > 0x30013ca0 : stw r4,-20(r6) > 0x30013ca4 : cmplwi cr1,r5,16 > 0x30013ca8 : stw r4,-24(r6) > 0x30013cac : stw r4,-28(r6) > 0x30013cb0 : stwu r4,-32(r6) > 0x30013cb4 : beqlr=20 > 0x30013cb8 : add r6,r6,r7 > 0x30013cbc : b 0x30013d84 > 0x30013cc0 : nop > 0x30013cc4 : clrlwi r5,r5,27 > 0x30013cc8 : mtcrf 2,r7 > 0x30013ccc : rlwinm. r0,r7,25,7,31 > ---Type to continue, or q to quit---=20 > 0x30013cd0 : mtctr r0 > 0x30013cd4 : li r7,32 > 0x30013cd8 : li r8,-64 > 0x30013cdc : cmplwi cr1,r5,16 > 0x30013ce0 : bne- cr6,0x30013cec > 0x30013ce4 : dcbz r0,r6 > 0x30013ce8 : addi r6,r6,32 > 0x30013cec : li r9,-32 > 0x30013cf0 : ble- cr6,0x30013d00 > 0x30013cf4 : dcbz r0,r6 > 0x30013cf8 : dcbz r7,r6 > 0x30013cfc : addi r6,r6,64 > 0x30013d00 : cmplwi cr5,r5,0 > 0x30013d04 : beq- 0x30013d80 > 0x30013d08 : dcbz r0,r6 > 0x30013d0c : dcbz r7,r6 > 0x30013d10 : addi r6,r6,128 > 0x30013d14 : dcbz r8,r6 > 0x30013d18 : dcbz r9,r6 > 0x30013d1c : bdnz+ 0x30013d08 > 0x30013d20 : beqlr cr5 > 0x30013d24 : b 0x30013d84 > 0x30013d28 : nop > 0x30013d2c : nop > 0x30013d30 : nop > 0x30013d34 : nop > 0x30013d38 : nop > 0x30013d3c : nop > 0x30013d40 : cmplwi cr5,r5,1 > 0x30013d44 : cmplwi cr1,r5,3 > 0x30013d48 : bltlr cr5 > 0x30013d4c : stb r4,0(r6) > 0x30013d50 : beqlr cr5 > 0x30013d54 : nop > 0x30013d58 : stb r4,1(r6) > 0x30013d5c : bltlr cr1 > 0x30013d60 : stb r4,2(r6) > 0x30013d64 : beqlr cr1 > 0x30013d68 : nop > 0x30013d6c : stb r4,3(r6) > 0x30013d70 : blr > 0x30013d74 : nop > 0x30013d78 : nop > 0x30013d7c : nop > 0x30013d80 : cmplwi cr1,r5,16 > 0x30013d84 : add r6,r6,r5 > 0x30013d88 : bso- cr7,0x30013da8 > 0x30013d8c : beq- cr7,0x30013db0 > 0x30013d90 : bgt- cr7,0x30013db8 > 0x30013d94 : bge- cr1,0x30013dc0 > 0x30013d98 : bgelr cr7 > 0x30013d9c : stw r4,-4(r6) > 0x30013da0 : stw r4,-8(r6) > 0x30013da4 : blr > 0x30013da8 : stbu r4,-1(r6) > 0x30013dac : bne- cr7,0x30013d90 > 0x30013db0 : sthu r4,-2(r6) > 0x30013db4 : ble- cr7,0x30013d94 > 0x30013db8 : stwu r4,-4(r6) > 0x30013dbc : blt- cr1,0x30013dd0 > 0x30013dc0 : stw r4,-4(r6) > 0x30013dc4 : stw r4,-8(r6) > 0x30013dc8 : stw r4,-12(r6) > 0x30013dcc : stwu r4,-16(r6) > 0x30013dd0 : bgelr cr7 > 0x30013dd4 : stw r4,-4(r6) > 0x30013dd8 : stw r4,-8(r6) > 0x30013ddc : blr > 0x30013de0 : mflr r0 > 0x30013de4 : beq+ 0x30013d80 > 0x30013de8 : bl 0x30029000 <_dl_auxv+180> > 0x30013dec : mflr r9 > 0x30013df0 : lwz r9,1832(r9) > 0x30013df4 : lwz r8,0(r9) > 0x30013df8 : mtlr r0 > 0x30013dfc : cmplwi cr1,r8,0 > ---Type to continue, or q to quit--- > 0x30013e00 : beq+ cr1,0x30013c44 > 0x30013e04 : cmplwi cr1,r8,32 > 0x30013e08 : beq+ cr1,0x30013cc4 > 0x30013e0c : dcbtst r0,r6 > 0x30013e10 : addi r9,r8,-1 > 0x30013e14 : cmplwi cr1,r5,32 > 0x30013e18 : and. r0,r9,r6 > 0x30013e1c : blt- cr1,0x30013e68 > 0x30013e20 : beq- 0x30013e50 > 0x30013e24 : addi r6,r6,32 > 0x30013e28 : addi r5,r5,-32 > 0x30013e2c : stw r4,-32(r6) > 0x30013e30 : stw r4,-28(r6) > 0x30013e34 : stw r4,-24(r6) > 0x30013e38 : stw r4,-20(r6) > 0x30013e3c : stw r4,-16(r6) > 0x30013e40 : stw r4,-12(r6) > 0x30013e44 : stw r4,-8(r6) > 0x30013e48 : stw r4,-4(r6) > 0x30013e4c : b 0x30013e14 > 0x30013e50 : cmplw cr1,r5,r8 > 0x30013e54 : blt- cr1,0x30013e68 >=20 >=20 > 0x30013e58 : dcbz r0,r6 #<--- the problem >=20 >=20 > 0x30013e5c : subf r5,r8,r5 > 0x30013e60 : add r6,r6,r8 > 0x30013e64 : b 0x30013e50 > 0x30013e68 : rlwinm. r7,r5,0,0,26 > 0x30013e6c : b 0x30013c44 > 0x30013e70 : nop > 0x30013e74 : nop > 0x30013e78 : nop > 0x30013e7c : nop Can you please examine in more detail what is going on here?=20 What are the contents of the r0 and r6 registers, where exactly is the task stopped. I _guess_ it might be some form of "dcbz" misbehaviour, in such case I=20 imagine that either the task would loop forever or execute an invalid exception/instruction.