From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 5 13:55:08 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FFC31065678 for ; Fri, 5 Jun 2009 13:55:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 1A0A68FC17 for ; Fri, 5 Jun 2009 13:55:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id C0FCA46B09; Fri, 5 Jun 2009 09:55:07 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id A2DB98A049; Fri, 5 Jun 2009 09:55:06 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Fri, 5 Jun 2009 09:38:25 -0400 User-Agent: KMail/1.9.7 References: <4A2792B7.5010006@peterhost.ru> <200906040749.17206.jhb@freebsd.org> <4A27C5E8.7020902@peterhost.ru> In-Reply-To: <4A27C5E8.7020902@peterhost.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200906050938.25706.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Fri, 05 Jun 2009 09:55:06 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Menshikov Konstantin Subject: Re: Inline function (difficult debug) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jun 2009 13:55:09 -0000 On Thursday 04 June 2009 9:02:32 am Menshikov Konstantin wrote: > John Baldwin wrote: > > On Thursday 04 June 2009 5:24:07 am Menshikov Konstantin wrote: > > =20 > >> Hi. > >> My system FreeBSD 7.1 RELEASE periodically freeze. > >> > >> I`m compiling kernel with WITNESS and get backtrace. > >> > >> #0 doadump () at pcpu.h:195 > >> #1 0xffffffff801a899c in db_fncall (dummy1=3DVariable "dummy1" is not= =20 > >> available. > >> ) at /usr/src/sys/ddb/db_command.c:516 > >> #2 0xffffffff801a8ecf in db_command (last_cmdp=3D0xffffffff80825688,=20 > >> cmd_table=3D0x0, dopager=3D1) > >> at /usr/src/sys/ddb/db_command.c:413 > >> #3 0xffffffff801a90e0 in db_command_loop () at=20 > >> /usr/src/sys/ddb/db_command.c:466 > >> #4 0xffffffff801aaa19 in db_trap (type=3DVariable "type" is not availa= ble. > >> ) at /usr/src/sys/ddb/db_main.c:228 > >> #5 0xffffffff803d5e55 in kdb_trap (type=3D3, code=3D0,=20 > >> tf=3D0xffffffffabf284c0) at /usr/src/sys/kern/subr_kdb.c:524 > >> #6 0xffffffff8059a0e5 in trap (frame=3D0xffffffffabf284c0) at=20 > >> /usr/src/sys/amd64/amd64/trap.c:538 > >> #7 0xffffffff8057f60e in calltrap () at=20 > >> /usr/src/sys/amd64/amd64/exception.S:209 > >> #8 0xffffffff803d602d in kdb_enter_why (why=3D0xffffffff80628137=20 > >> "witness", msg=3D0xa
) > >> at cpufunc.h:63 > >> #9 0xffffffff803e70c3 in witness_checkorder (lock=3DVariable "lock" is= not=20 > >> available. > >> ) at /usr/src/sys/kern/subr_witness.c:1126 > >> #10 0xffffffff8039e341 in _mtx_lock_spin_flags (m=3D0xffffffff8084fad0= ,=20 > >> opts=3D0, file=3Ddwarf2_read_address: Corrupted DWARF expression. > >> ) at /usr/src/sys/kern/kern_mutex.c:227 > >> #11 0xffffffff80319838 in sc_puts (scp=3D0xffffffff8084f980,=20 > >> buf=3D0xffffffffabf286a7 "a@\az\200=D0=AA=D0=AA=D0=AA=D0=AA", len=3D1) > >> at /usr/src/sys/dev/syscons/syscons.c:2519 > >> #12 0xffffffff8031b3da in sc_cnputc (cd=3DVariable "cd" is not availab= le. > >> ) at /usr/src/sys/dev/syscons/syscons.c:1561 > >> #13 0xffffffff803f9d89 in cnputc (c=3D97)=20 at /usr/src/sys/kern/tty_cons.c:632 > >> #14 0xffffffff803d993b in putchar (c=3D97, arg=3DVariable "arg" is not= =20 > >> available. > >> ) at /usr/src/sys/kern/subr_prf.c:421 > >> #15 0xffffffff803d7f22 in kvprintf (fmt=3D0xffffffff80628b89 "cquiring= =20 > >> duplicate lock of same type: \"%s\"\n", > >> func=3D0xffffffff803d98d0 , arg=3D0xffffffffabf28890, radix= =3D10,=20 > >> ap=3DVariable "ap" is not available. > >> ) at /usr/src/sys/kern/subr_prf.c:674 > >> #16 0xffffffff803d9384 in printf (fmt=3DVariable "fmt" is not availabl= e. > >> ) at /usr/src/sys/kern/subr_prf.c:314 > >> #17 0xffffffff803e705d in witness_checkorder (lock=3D0xffffffff808668f= 8,=20 > >> flags=3D0, > >> file=3D0xffffffff80626cf8 "/usr/src/sys/kern/subr_sleepqueue.c", line= =3D232)=20 > >> at /usr/src/sys/kern/subr_witness.c:948 > >> #18 0xffffffff8039e341 in _mtx_lock_spin_flags (m=3D0xffffffff808668f8= ,=20 > >> opts=3D0, file=3Ddwarf2_read_address: Corrupted DWARF expression. > >> ) at /usr/src/sys/kern/kern_mutex.c:227 > >> #19 0xffffffff803b2271 in wakeup (ident=3D0xffffffff80850ac0) at=20 > >> /usr/src/sys/kern/kern_synch.c:341 > >> #20 0xffffffff803aed95 in tdsignal (p=3D0xffffff00017978f0,=20 > >> td=3D0xffffff000146a6e0, sig=3D14, ksi=3DVariable "ksi" is not availab= le. > >> ) > >> at /usr/src/sys/kern/kern_sig.c:2292 > >> #21 0xffffffff803ba2de in realitexpire (arg=3DVariable "arg" is not=20 available. > >> ) at /usr/src/sys/kern/kern_time.c:669 > >> #22 0xffffffff803bbe1a in softclock (dummy=3DVariable "dummy" is not=20 > >> available. > >> ) at /usr/src/sys/kern/kern_timeout.c:274 > >> #23 0xffffffff8038c120 in ithread_loop (arg=3D0xffffff00010ebc00) at=20 > >> /usr/src/sys/kern/kern_intr.c:1088 > >> #24 0xffffffff8038978a in fork_exit (callout=3D0xffffffff8038c040=20 > >> , arg=3D0xffffff00010ebc00, > >> frame=3D0xffffffffabf28c80) at /usr/src/sys/kern/kern_fork.c:804 > >> #25 0xffffffff8057f9de in fork_trampoline () at=20 > >> /usr/src/sys/amd64/amd64/exception.S:455 > >> > >> But file /usr/src/sys/kern/kern_sig.c:2292 > >> hasn`t run function wake up on string 2292 > >> I`m think, what compiler use inline function, therefore code and trace= =20 > >> differ. > >> Tell me please, how compile kernel without any inline function. > >> =20 > > > > makeoptions DEBUG=3D"-g -fno-inline" > > > > However. I think you already have enough information to debug this. Ca= n=20 you=20 > > go to frame 17 and do an 'l'? I think the two things you want to print= =20 out=20 > > are "i", "*lock", "*lock1", and "*lock2". > > > > =20 > Unfortunately, the kernel is not compiled with an option-fno-inline. > cc -c -O2 -frename-registers -pipe -fno-strict-aliasing -std=3Dc99 -g=20 > -fno-inline -Wall -Wredundant-decls -Wnested-externs=20 > -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline=20 > -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -nostdinc =20 > -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -D_KERNEL=20 > -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common=20 > -finline-limit=3D8000 --param inline-unit-growth=3D100 --param=20 > large-function-growth=3D1000 -fno-omit-frame-pointer -mcmodel=3Dkernel=20 > -mno-red-zone -mfpmath=3D387 -mno-sse -mno-sse2 -mno-mmx -mno-3dnow =20 > -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -Werror =20 > /usr/src/sys/cam/cam_periph.c > cc1: warnings being treated as errors > /usr/src/sys/cam/cam_periph.c: In function 'scsi_extract_sense': > /usr/src/sys/cam/scsi/scsi_all.h:1215: warning: function=20 > 'scsi_extract_sense' can never be inlined because it is suppressed using= =20 > -fno-inline >=20 > I`m try build with -O0 options. >=20 > lock in frame 17 > (kgdb) print {struct mtx} 0xffffffff808668f8 > $4 =3D {lock_object =3D {lo_name =3D 0xffffffff806270eb "sleepq chain",=20 > lo_type =3D 0xffffffff806270eb "sleepq chain", > lo_flags =3D 720896, lo_witness_data =3D {lod_list =3D {stqe_next =3D= =20 > 0xffffffff808793e0}, lod_witness =3D 0xffffffff808793e0}}, > mtx_lock =3D 4, mtx_recurse =3D 0} > next in list > (kgdb) print {struct mtx} 0xffffffff808793e0 > $5 =3D {lock_object =3D {lo_name =3D 0xffffffff806270eb "sleepq chain",=20 > lo_type =3D 0xffffffff807e8860 "\031\006b\200=D0=AA=D0=AA=D0=AA=D0=AA\n", > lo_flags =3D 2156368928, lo_witness_data =3D {lod_list =3D {stqe_next= =3D=20 > 0xffffffff80879420}, > lod_witness =3D 0xffffffff80879420}}, mtx_lock =3D=20 > 18446744071571216096, mtx_recurse =3D 2153913763} > (kgdb) print {struct mtx} 0xffffffff80879420 > next > $6 =3D {lock_object =3D {lo_name =3D 0xffffffff806205df "process slock",= =20 > lo_type =3D 0xffffffff807e8860 "\031\006b\200=D0=AA=D0=AA=D0=AA=D0=AA\n", > lo_flags =3D 2156368992, lo_witness_data =3D {lod_list =3D {stqe_next= =3D=20 > 0xffffffff80879460}, > lod_witness =3D 0xffffffff80879460}}, mtx_lock =3D=20 > 18446744071571216160, mtx_recurse =3D 2153889520} Where did you get the pointer values from? I meant doing 'frame 17', 'p=20 i', 'p *lock', 'p *lock1', 'p *lock2' =2D-=20 John Baldwin