From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 6 07:00:08 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 3334016A41F for ; Sat, 6 Aug 2005 07:00:08 +0000 (GMT) (envelope-from julian@elischer.org) Received: from delight.idiom.com (delight.idiom.com [216.240.32.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id EBCE143D45 for ; Sat, 6 Aug 2005 07:00:07 +0000 (GMT) (envelope-from julian@elischer.org) Received: from idiom.com (idiom.com [216.240.32.1]) by delight.idiom.com (Postfix) with ESMTP id 7C9BB208DB4; Sat, 6 Aug 2005 00:00:07 -0700 (PDT) Received: from [192.168.2.3] (home.elischer.org [216.240.48.38]) by idiom.com (8.12.11/8.12.11) with ESMTP id j76706P3070849; Sat, 6 Aug 2005 00:00:07 -0700 (PDT) (envelope-from julian@elischer.org) Message-ID: <42F45FEE.6050601@elischer.org> Date: Fri, 05 Aug 2005 23:59:58 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.7) Gecko/20050424 X-Accept-Language: en, hu MIME-Version: 1.0 To: hselasky@c2i.net References: <200508030023.04748.hselasky@c2i.net> <200508042253.34165.hselasky@c2i.net> <200508051329.14767.jhb@FreeBSD.org> <200508060139.57143.hselasky@c2i.net> In-Reply-To: <200508060139.57143.hselasky@c2i.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: How to do proper locking X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2005 07:00:08 -0000 Hans Petter Selasky wrote: > On Friday 05 August 2005 19:29, John Baldwin wrote: > > > Yes, you are right, but the problem is, that for most callback systems in the > kernel, there is no mechanism that will pre-lock some custom mutex before > calling the callback. Not generally applicable to this case but for example the netgraph callout wrappers handlle netgraph node locking so that teh called function can assume the node it is working on has been locked. It's not applicable because netgraph locking is "different" to locking elsewhere in the kernel due to the nature of netgraph. But havinng a specific callout wrapper for a subsystem does give the ability to do such things.