From owner-freebsd-current@FreeBSD.ORG Wed Jun 30 06:07:04 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 19FC216A4CE for ; Wed, 30 Jun 2004 06:07:04 +0000 (GMT) Received: from pd5mo2so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id A5F1543D49 for ; Wed, 30 Jun 2004 06:07:03 +0000 (GMT) (envelope-from colin.percival@wadham.ox.ac.uk) Received: from pd5mr6so.prod.shaw.ca (pd5mr6so-qfe3.prod.shaw.ca [10.0.141.182]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0I03006R5XZFB9@l-daemon> for freebsd-current@freebsd.org; Tue, 29 Jun 2004 23:59:39 -0600 (MDT) Received: from pn2ml5so.prod.shaw.ca ([10.0.121.149]) by pd5mr6so.prod.shaw.ca (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) with ESMTP id <0I0300GO4XZFYOK0@pd5mr6so.prod.shaw.ca> for freebsd-current@freebsd.org; Tue, 29 Jun 2004 23:59:39 -0600 (MDT) Received: from piii600.wadham.ox.ac.uk (S0106006067227a4a.vc.shawcable.net [24.87.233.42]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0I030030CXZDL8@l-daemon> for freebsd-current@freebsd.org; Tue, 29 Jun 2004 23:59:39 -0600 (MDT) Date: Tue, 29 Jun 2004 22:58:29 -0700 From: Colin Percival In-reply-to: <20040629153921.GE75577@atrbg11.informatik.tu-muenchen.de> X-Sender: cperciva@popserver.sfu.ca (Unverified) To: Daniel Lang Message-id: <6.1.0.6.1.20040629223609.03bdfce0@popserver.sfu.ca> MIME-version: 1.0 X-Mailer: QUALCOMM Windows Eudora Version 6.1.0.6 Content-type: text/plain; charset=us-ascii References: <20040628202434.GA73213@atrbg11.informatik.tu-muenchen.de> <20040629153921.GE75577@atrbg11.informatik.tu-muenchen.de> cc: freebsd-current@freebsd.org Subject: sio vs sched_lock LOR (was: Re: kern/68442: panic - acquiring duplicate lock of same type: "sleepq chain") X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 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: Wed, 30 Jun 2004 06:07:04 -0000 At 08:39 29/06/2004, Daniel Lang wrote: >login: lock order reversal > 1st 0xc070a0c0 sched lock (sched lock) @ /usr/src/sys/kern/kern_proc.c:672 > 2nd 0xc0745d40 sio (sio) @ /usr/src/sys/dev/sio/sio.c:3205 >Stack backtrace: >backtrace(ffffffff,c0712948,c0712b00,c06e25c4,c07358dc) at 0xc051e066 = backtra2 >witness_checkorder(c0745d40,9,c06b1e34,c85,3f8) at 0xc05393c4 = witness_checkor4 >_mtx_lock_spin_flags(c0745d40,0,c06b1e34,c85,c0712498) at 0xc0516e9e = _mtx_loce >siocnputc(c06f9c40,63) at 0xc064375f = siocnputc+0x6b >cnputc(63) at 0xc05483ed = cnputc+0x4d >putchar(63,e5bd87e0) at 0xc053387a = putchar+0x92 >kvprintf(c069d236,c05337e8,e5bd87e0,a,e5bd8800) at 0xc0533a87 = kvprintf+0x77 >printf(c069d236,32cf1,0,32ce6,0,dd8,c9115828) at 0xc0533763 = printf+0x43 >calcru(c91156e0,e5bd8ad0,e5bd8ad8,0,e5bd8a10) at 0xc051cb9e = calcru+0x1f2 >[...] Regardless of the questionable validity of the other problems this machine is encountering, this LOR is real (and ugly). calcru() asserts that it is holding sched_lock, but it can printf() about negative runtime or runtime going backwards. With a serial console attached, these messages end up at siocnputc(), which needs sio_lock. Now, I presume that there is some reason why the locking order hard-coded into witness makes it illegal to pick up sio_lock while holding sched_lock, but I can't see it. Maybe someone else can explain? In the mean time, a workaround for this LOR is to unplug the serial console. :-) Colin Percival