From owner-cvs-all Fri Mar 9 14:25:26 2001 Delivered-To: cvs-all@freebsd.org Received: from cr66388-a.rchrd1.on.wave.home.com (cr66388-a.rchrd1.on.wave.home.com [24.114.165.24]) by hub.freebsd.org (Postfix) with ESMTP id 5AA9437B719; Fri, 9 Mar 2001 14:25:22 -0800 (PST) (envelope-from jburkholder0829@home.com) Received: from cr66388-a.rchrd1.on.wave.home.c (localhost [127.0.0.1]) by cr66388-a.rchrd1.on.wave.home.com (Postfix) with ESMTP id E3527BA69; Fri, 9 Mar 2001 17:25:21 -0500 (EST) X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 To: John Baldwin Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/alpha/include mutex.h src/sys/i386/include mutex.h src/sys/ia64/include mutex.h src/sys/kern kern_mutex.c kern_fork.c src/sys/sys proc.h In-Reply-To: Message from John Baldwin of "Thu, 08 Mar 2001 23:24:17 PST." <200103090724.f297OIk50706@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 09 Mar 2001 17:25:21 -0500 From: Jake Burkholder Message-Id: <20010309222521.E3527BA69@cr66388-a.rchrd1.on.wave.home.com> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > jhb 2001/03/08 23:24:17 PST > > Modified files: > sys/alpha/include mutex.h > sys/i386/include mutex.h > sys/ia64/include mutex.h > sys/kern kern_mutex.c kern_fork.c > sys/sys proc.h > Log: > Fix mtx_legal2block. The only time that it is bad to block on a mutex is > if we hold a spin mutex, since we can trivially get into deadlocks if we > start switching out of processes that hold spinlocks. Checking to see if > interrupts were disabled was a sort of cheap way of doing this since most > of the time interrupts were only disabled when holding a spin lock. At > least on the i386. To fix this properly, use a per-process counter > p_spinlocks that counts the number of spin locks currently held, and > instead of checking to see if interrupts are disabled in the witness code, > check to see if we hold any spin locks. Since child processes always > start up with the sched lock magically held in fork_exit(), we initialize > p_spinlocks to 1 for child processes. Note that proc0 doesn't go through > fork_exit(), so it starts with no spin locks held. > > Consulting from: cp > > Revision Changes Path > 1.21 +1 -3 src/sys/alpha/include/mutex.h > 1.30 +0 -1 src/sys/i386/include/mutex.h > 1.11 +1 -2 src/sys/ia64/include/mutex.h > 1.57 +9 -3 src/sys/kern/kern_mutex.c > 1.106 +5 -1 src/sys/kern/kern_fork.c > 1.154 +2 -1 src/sys/sys/proc.h > Cool! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message