From owner-freebsd-hackers@FreeBSD.ORG Thu Feb 19 00:05:38 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C149516A4CE for ; Thu, 19 Feb 2004 00:05:38 -0800 (PST) Received: from relay1.ntu-kpi.kiev.ua (noc.ntu-kpi.kiev.ua [195.245.194.34]) by mx1.FreeBSD.org (Postfix) with ESMTP id 706FD43D1D for ; Thu, 19 Feb 2004 00:05:38 -0800 (PST) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from comsys.ntu-kpi.kiev.ua (unknown [10.0.1.184]) by relay1.ntu-kpi.kiev.ua (Postfix) with ESMTP id 95D4017BBC7; Thu, 19 Feb 2004 10:05:37 +0200 (EET) Received: from pm514-9.comsys.ntu-kpi.kiev.ua (pm514-9.comsys.ntu-kpi.kiev.ua [10.18.54.109]) (authenticated bits=0)i1JA7obA060553 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 19 Feb 2004 10:07:55 GMT Received: by pm514-9.comsys.ntu-kpi.kiev.ua (Postfix, from userid 1000) id 3DB62238; Thu, 19 Feb 2004 10:05:21 +0200 (EET) Date: Thu, 19 Feb 2004 10:05:21 +0200 From: Andrey Simonenko To: Jerry Toung Message-ID: <20040219080521.GA439@pm514-9.comsys.ntu-kpi.kiev.ua> References: <200402181152.26645.jtoung@arc.nasa.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200402181152.26645.jtoung@arc.nasa.gov> User-Agent: Mutt/1.4.1i cc: hackers Subject: Re: locking against myself X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2004 08:05:38 -0000 On Wed, Feb 18, 2004 at 11:52:26AM -0800, Jerry Toung wrote: > Hello hackers, > I am constantly getting the following message when I run my KLD: > > panic: lockmgr: locking against myself > Debugger("panic") > Stopped at Debugger+0x54: xchgl %ebx,in_Debugger.0 > db> > > What could possibly cause this? > It seem to say that I'm locking an already locked variable. > Hello Jerry, According to kern/kern_lock.c:lockmgr() your proc/thread already has an exclusive lock and it tries to obtain a recursive exclusive lock and lock doesn't have LK_CANRECURSE flag (also you allow to sleep in lockmng()). This is documented in lock(9) manual page: LK_EXCLUSIVE Acquire an exclusive lock. If an exclusive lock is already held, and LK_CANRECURSE is not set, the system will panic(9).