From owner-freebsd-current@FreeBSD.ORG Wed Jul 21 17:14:02 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7745016A4CE for ; Wed, 21 Jul 2004 17:14:02 +0000 (GMT) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id 27A6143D2F for ; Wed, 21 Jul 2004 17:14:02 +0000 (GMT) (envelope-from scottl@freebsd.org) Received: from [192.168.0.12] (g4.samsco.home [192.168.0.12]) (authenticated bits=0) by pooker.samsco.org (8.12.11/8.12.10) with ESMTP id i6LHKAd6063883; Wed, 21 Jul 2004 11:20:11 -0600 (MDT) (envelope-from scottl@freebsd.org) Message-ID: <40FEA412.3050900@freebsd.org> Date: Wed, 21 Jul 2004 11:12:50 -0600 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7) Gecko/20040514 X-Accept-Language: en-us, en MIME-Version: 1.0 To: ticso@cicely.de References: <20040721170534.GF70663@cicely12.cicely.de> In-Reply-To: <20040721170534.GF70663@cicely12.cicely.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=0.0 required=3.8 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on pooker.samsco.org cc: current@freebsd.org Subject: Re: GIANT question X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 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: Wed, 21 Jul 2004 17:14:02 -0000 Bernd Walter wrote: > Say I have a driver that could run without needing GIANT, but > makes use of a subsystem that requires GIANT. > Removing D_NEEDGIANT in cdevsw seems to be enough to get called > from userland without GIANT held. > Now I need to aquire GIANT bevor calling the subsystem and release > it on return. > What I've found so far is DROP_GIANT/PICKUP_GIANT, which has to be > paired the other way. > What is the prefered way to get/release GIANT in that case? > mtx_lock(&Giant); call_code_needing_giant(); mtx_unlock(&Giant); Note that you must not be holding any locks when you go to aquire Giant. Scott