From owner-freebsd-current Sat Dec 7 15:33:36 2002 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 6350B37B40C for ; Sat, 7 Dec 2002 15:33:33 -0800 (PST) Received: from mail.speakeasy.net (mail16.speakeasy.net [216.254.0.216]) by mx1.FreeBSD.org (Postfix) with ESMTP id E300543ED1 for ; Sat, 7 Dec 2002 15:33:31 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (qmail 6576 invoked from network); 7 Dec 2002 23:33:36 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail16.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 7 Dec 2002 23:33:36 -0000 Received: from laptop.baldwin.cx (laptop.baldwin.cx [192.168.0.4]) by server.baldwin.cx (8.12.6/8.12.6) with ESMTP id gB7NWquH054753; Sat, 7 Dec 2002 18:32:52 -0500 (EST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Sat, 07 Dec 2002 18:32:59 -0500 (EST) From: John Baldwin To: Robert Watson Subject: Re: LOR: filedesc structure -> pipe mutex Cc: alfred@FreeBSD.ORG, current@FreeBSD.ORG, Lars Eggert , Kris Kennaway Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 07-Dec-2002 Robert Watson wrote: > BTW, one upshot of this whole event is that we should probably be > hard-coding the lock order of all important locks rather than allowing it > to be automatically determined. We'd uncover problems of this sort much > faster and much more easily, and it would provide better documentation of > the intended lock order. Also, the authors of the following locking bits > should document them in the SMPng architecture document: > > - File descriptor locking > - Pipe locking > - Select locking > - Process locking > > I've gone ahead and documented the SIGIO locking, and I might get to the > rest sometime also, but it would be a lot faster if the people who did the > work documented it rather than having to rely on a lot of code reading to > figure out the subtleties. > > Do we know if WITNESS supports the notion of a partial order, in which it > is simply asserted that there is no valid locking order between two locks? You mean that it is not ok to obtain lock A while holdig lock B and it is not ok to obtain lock B while holding lock A? It doesn't really support that right now, no. > Robert N M Watson FreeBSD Core Team, TrustedBSD Projects > robert@fledge.watson.org Network Associates Laboratories > > On Fri, 6 Dec 2002, Kris Kennaway wrote: > >> On Fri, Dec 06, 2002 at 07:18:03PM -0800, Lars Eggert wrote: >> >> > >I'm getting this too: >> >> After discussing this with various people on IRC, it was determined >> that this is not the place where the reversal is occurring, but since >> witness doesn't have the lock order defined it has to guess, and in >> this instance it is guessing the wrong way around. After adding the >> lock order to subr_witness.c I now get this: >> >> lock order reversal >> 1st 0xc41bc418 process lock (process lock) @ /local0/src-client/sys/kern/kern_descrip.c:2094 >> 2nd 0xc42de934 filedesc structure (filedesc structure) @ >> /local0/src-client/sys/kern/kern_descrip.c:2101 >> Debugger("witness_lock") >> Stopped at Debugger+0x45: xchgl %ebx,in_Debugger.0 >> db> trace >> Debugger(c037a085) at Debugger+0x45 >> witness_lock(c42de934,8,c039e3cc,835,c41bc418) at witness_lock+0x532 >> _mtx_lock_flags(c42de934,0,c039e3cc,835,0) at _mtx_lock_flags+0x7f >> sysctl_kern_file(c03d8a00,0,0,d7aaac08) at sysctl_kern_file+0x119 >> sysctl_root(0,d7aaacb4,2,d7aaac08,c0416240) at sysctl_root+0x116 >> userland_sysctl(c3f84a80,d7aaacb4,2,bfbfe588,bfbff3f8) at userland_sysctl+0xec >> __sysctl(c3f84a80,d7aaad14,6,1,297) at __sysctl+0x71 >> syscall(2f,2f,2f,2,bfbfe588) at syscall+0x211 >> Xint0x80_syscall() at Xint0x80_syscall+0x1d >> --- syscall (202, FreeBSD ELF32, __sysctl), eip = 0x805a717, esp = 0xbfbfe53c, ebp = 0xbfbfe568 >> --- >> db> >> >> Index: sys/kern/subr_witness.c >> =================================================================== >> RCS file: /home/ncvs/src/sys/kern/subr_witness.c,v >> retrieving revision 1.130 >> diff -u -r1.130 subr_witness.c >> --- sys/kern/subr_witness.c 11 Nov 2002 16:36:20 -0000 1.130 >> +++ sys/kern/subr_witness.c 7 Dec 2002 04:18:29 -0000 >> @@ -198,6 +198,8 @@ >> { "Giant", &lock_class_mtx_sleep }, >> { "proctree", &lock_class_sx }, >> { "allproc", &lock_class_sx }, >> + { "filedesc structure", &lock_class_mtx_sleep }, >> + { "pipe mutex", &lock_class_mtx_sleep }, >> { "sigio lock", &lock_class_mtx_sleep }, >> { "process group", &lock_class_mtx_sleep }, >> { "process lock", &lock_class_mtx_sleep }, >> > -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message