From owner-freebsd-current@FreeBSD.ORG Sun Jan 25 08:54:05 2009 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 CAEF61065670; Sun, 25 Jan 2009 08:54:05 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id B468B8FC0A; Sun, 25 Jan 2009 08:54:05 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id 5AC911A3C39; Sun, 25 Jan 2009 00:54:05 -0800 (PST) Date: Sun, 25 Jan 2009 00:54:05 -0800 From: Alfred Perlstein To: Maksim Yevmenkin Message-ID: <20090125085405.GA87077@elvis.mu.org> References: <20090123154336.GJ60948@e.0x20.net> <200901232337.05627.hselasky@c2i.net> <200901240952.21670.hselasky@c2i.net> <20090125003010.GY87077@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-current@freebsd.org, current@freebsd.org, Hans Petter Selasky Subject: Re: panic: mutex Giant not owned at /usr/src/sys/kern/tty_ttydisc.c:1127 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: Sun, 25 Jan 2009 08:54:06 -0000 * Maksim Yevmenkin [090124 17:33] wrote: > On Sat, Jan 24, 2009 at 4:30 PM, Alfred Perlstein wrote: > > > > From a purely academic standpoint... why can't netgraph use > > standard mutexes? > > > > Is there a pointer you can give me? > > well, its not that netgraph can not use mutexes at all. its just that > there has to be an understanding between all subsystems that interact > with netgraph. its just like Julian said, everybody has to play nice > and ensure that control is given back to netgraph as soon as possible. > netgraph thread can not be de-scheduled for too long because the same > thread services other nodes. in fact, there are other netgraph nodes > that use mutexes, there is no way around it. the only rule is that > mutexes have to be used prudently. if there is a guarantee that every > single code path that is called from netgraph context is "safe" (i.e. > any mutexes that are touched in the code path are guaranteed to not > cause de-scheduling of netgraph thread for any significant amount of > time) then everything is fine. > > in any case, i really do hope that the patch that i send to Hans > Petter today (you were cc'd) is something that we all can agree on. FWIW, with the exception of Giant, all normal mutexes have this guarantee. Giant actually sort of has this guarantee, however it may be held for long periods of _activity_. You can't "block" with a mutex, hence you'll never be behind a sleeping process, only a running process or tandem of running processes. -- - Alfred Perlstein