From owner-freebsd-current@FreeBSD.ORG Tue Jan 24 11:54:26 2012 Return-Path: Delivered-To: current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23842106564A; Tue, 24 Jan 2012 11:54:26 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id ABC578FC13; Tue, 24 Jan 2012 11:54:25 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q0OBsOXA047250; Tue, 24 Jan 2012 15:54:24 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q0OBsOYB047249; Tue, 24 Jan 2012 15:54:24 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 24 Jan 2012 15:54:24 +0400 From: Gleb Smirnoff To: Andriy Gapon Message-ID: <20120124115424.GX16676@glebius.int.ru> References: <4F1ABFF3.9090305@FreeBSD.org> <20120122163539.GF16676@glebius.int.ru> <4F1D18A5.8010006@FreeBSD.org> <20120123130743.GI16676@glebius.int.ru> <4F1D6830.60602@FreeBSD.org> <20120123162410.GN16676@glebius.int.ru> <20120123162606.GO16676@FreeBSD.org> <4F1D8E2B.30800@FreeBSD.org> <20120123164659.GQ16676@glebius.int.ru> <4F1D9128.3030501@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <4F1D9128.3030501@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: current@FreeBSD.org Subject: Re: new panic in cpu_reset() with WITNESS X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2012 11:54:26 -0000 On Mon, Jan 23, 2012 at 06:56:08PM +0200, Andriy Gapon wrote: A> on 23/01/2012 18:46 Gleb Smirnoff said the following: A> > On Mon, Jan 23, 2012 at 06:43:23PM +0200, Andriy Gapon wrote: A> > A> > db> bt A> > A> > Tracing pid 1 tid 100001 td 0xfffffe0001d5e000 A> > A> > kdb_enter() at kdb_enter+0x3b A> > A> > panic() at panic+0x1c7 A> > A> > _mtx_lock_spin_flags() at _mtx_lock_spin_flags+0x10f A> > A> > cnputs() at cnputs+0x7a A> > A> > vprintf() at vprintf+0xcb A> > A> > printf() at printf+0x67 A> > A> > db_putc() at db_putc+0x81 A> > A> A> > A> Ah, db_putc does something different from what I expected. A> > A> Can you hack it to never use printf? A> > A> > Just cut printfs from db_putc()? A> A> Make the following condition be always false: A> A> if (!kdb_active || ddb_use_printf) { A> A> E.g.: A> A> if (0) { With this change + s/printf/db_printf/ in subr_witness.c I've got the following during reboot: Rebooting... lllock order reversal: 1st 0xffffffff80937140 smp rendezvous (smp rendezvous) @ /usr/src/head/sys/kern/kern_shutdown.c:542 2nd 0xffffffff80b13280 syscons video lock (syscons video lock) @ /usr/src/head/sys/dev/syscons/syscons.c:1921 panic: mtx_lock_spin: recursed on non-recursive mutex cnputs_mtx @ /usr/src/head/sys/kern/kern_cons.c:500 cpuid = 0 KDB: enter: panic [ thread pid 1 tid 100001 ] Stopped at kdb_enter+0x3b: movq $0,0x5159f2(%rip) db> bt Tracing pid 1 tid 100001 td 0xfffffe0001d5e000 kdb_enter() at kdb_enter+0x3b panic() at panic+0x1c7 _mtx_lock_spin_flags() at _mtx_lock_spin_flags+0x10f cnputs() at cnputs+0x7a putchar() at putchar+0x11f kvprintf() at kvprintf+0x83 vprintf() at vprintf+0x85 printf() at printf+0x67 kdb_backtrace() at kdb_backtrace+0x2d _witness_debugger() at _witness_debugger+0x2c witness_checkorder() at witness_checkorder+0x854 _mtx_lock_spin_flags() at _mtx_lock_spin_flags+0x99 scrn_update() at scrn_update+0x41c sc_cnputc() at sc_cnputc+0x46 cnputc() at cnputc+0x4c db_putc() at db_putc+0x4d kvprintf() at kvprintf+0x83 db_printf() at db_printf+0x86 witness_checkorder() at witness_checkorder+0x773 _mtx_lock_spin_flags() at _mtx_lock_spin_flags+0x99 sc_puts() at sc_puts+0x97 sc_cnputc() at sc_cnputc+0x3e cnputc() at cnputc+0x4c db_putc() at db_putc+0x4d kvprintf() at kvprintf+0x83 db_printf() at db_printf+0x86 witness_checkorder() at witness_checkorder+0x773 _mtx_lock_spin_flags() at _mtx_lock_spin_flags+0x99 uart_cnputc() at uart_cnputc+0x3e cnputc() at cnputc+0x4c cnputs() at cnputs+0x26 putchar() at putchar+0x11f kvprintf() at kvprintf+0x83 vprintf() at vprintf+0x85 printf() at printf+0x67 cpu_reset() at cpu_reset+0x81 kern_reboot() at kern_reboot+0x3a5 sys_reboot() at sys_reboot+0x42 amd64_syscall() at amd64_syscall+0x39e Xfast_syscall() at Xfast_syscall+0xf7 --- syscall (55, FreeBSD ELF64, sys_reboot), rip = 0x40ea3c, rsp = 0x7fffffffd6d8, rbp = 0x49 --- db> -- Totus tuus, Glebius.