From owner-p4-projects@FreeBSD.ORG Mon Sep 17 19:21:02 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3585D16A420; Mon, 17 Sep 2007 19:21:02 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0F5916A418 for ; Mon, 17 Sep 2007 19:21:01 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outE.internet-mail-service.net (outE.internet-mail-service.net [216.240.47.228]) by mx1.freebsd.org (Postfix) with ESMTP id BD6B713C4CE for ; Mon, 17 Sep 2007 19:21:01 +0000 (UTC) (envelope-from julian@elischer.org) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.40) with ESMTP; Mon, 17 Sep 2007 12:20:59 -0700 X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (nat.ironport.com [63.251.108.100]) by idiom.com (Postfix) with ESMTP id ED84C126400; Mon, 17 Sep 2007 12:20:58 -0700 (PDT) Message-ID: <46EED397.3040700@elischer.org> Date: Mon, 17 Sep 2007 12:20:55 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: Marko Zec References: <200708212351.l7LNpi6Q006480@repoman.freebsd.org> <46EEC18F.6000809@elischer.org> <200709172048.29253.zec@icir.org> In-Reply-To: <200709172048.29253.zec@icir.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Perforce Change Reviews Subject: Re: PERFORCE change 125520 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Sep 2007 19:21:02 -0000 Marko Zec wrote: > On Monday 17 September 2007 20:03:59 Julian Elischer wrote: >> Marko Zec wrote: >>> http://perforce.freebsd.org/chv.cgi?CH=125520 >>> >>> Change 125520 by zec@zec_tpx32 on 2007/08/21 23:51:39 >>> >>> Given that ng_pipe nodes can be connected into arbitrary >>> topologies, and therefore it is possible for ngp_rcvdata() >>> to be recursively called from a single thread, it is >>> necessary to explicitly allow for the ng_pipe_giant mutex >>> to be recursively acquireable. >> OR use a different locking scheme. > > That's right, but I'm just wondering is there anything fundamentally > wrong with lock recursing (both in general as well as in this > particular case)? we are trying as a general rule trying to keep lock recursion to an absolute minimum. It can make debugging other things very hard. and can introduce bugs that are hard to find.. Generally a bad idea. If you don't know you are recursing, how can you avoid the problems you don't know about? (sounds silly but..) > > Marko > >> i.e. reference counts or something. >> >>> Affected files ... >>> >>> .. //depot/projects/vimage/src/sys/netgraph/ng_pipe.c#2 edit >>> >>> Differences ... >>> >>> ==== //depot/projects/vimage/src/sys/netgraph/ng_pipe.c#2 (text+ko) >>> ==== >>> >>> @@ -1028,7 +1028,7 @@ >>> error = EEXIST; >>> else { >>> mtx_init(&ng_pipe_giant, "ng_pipe_giant", NULL, >>> - MTX_DEF); >>> + MTX_DEF | MTX_RECURSE); >>> LIST_INIT(&node_head); >>> LIST_INIT(&hook_head); >>> ds_handle = timeout((timeout_t *) &pipe_scheduler, >