From owner-freebsd-current@FreeBSD.ORG Wed Jul 21 17:38:34 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 5DF5116A4CF; Wed, 21 Jul 2004 17:38:34 +0000 (GMT) Received: from srv1.cosmo-project.de (srv1.cosmo-project.de [213.83.6.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id C378943D5C; Wed, 21 Jul 2004 17:38:33 +0000 (GMT) (envelope-from ticso@cicely12.cicely.de) Received: from cicely5.cicely.de (cicely5.cicely.de [IPv6:3ffe:400:8d0:301:200:92ff:fe9b:20e7]) (authenticated bits=0) i6LHcTaI012875 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Wed, 21 Jul 2004 19:38:32 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (cicely12.cicely.de [IPv6:3ffe:400:8d0:301::12]) by cicely5.cicely.de (8.12.10/8.12.10) with ESMTP id i6LHbhUi058264 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 21 Jul 2004 19:37:44 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (localhost [127.0.0.1]) by cicely12.cicely.de (8.12.11/8.12.11) with ESMTP id i6LHbhJC072954; Wed, 21 Jul 2004 19:37:43 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: (from ticso@localhost) by cicely12.cicely.de (8.12.11/8.12.11/Submit) id i6LHbhmP072953; Wed, 21 Jul 2004 19:37:43 +0200 (CEST) (envelope-from ticso) Date: Wed, 21 Jul 2004 19:37:43 +0200 From: Bernd Walter To: Scott Long Message-ID: <20040721173742.GG70663@cicely12.cicely.de> References: <20040721170534.GF70663@cicely12.cicely.de> <40FEA412.3050900@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40FEA412.3050900@freebsd.org> X-Operating-System: FreeBSD cicely12.cicely.de 5.2-CURRENT alpha User-Agent: Mutt/1.5.6i X-Spam-Status: No, hits=-4.9 required=3.0 tests=BAYES_00 autolearn=ham version=2.61 X-Spam-Report: * -4.9 BAYES_00 BODY: Bayesian spam probability is 0 to 1% * [score: 0.0000] X-Spam-Checker-Version: SpamAssassin 2.61 (1.212.2.1-2003-12-09-exp) on cicely5.cicely.de cc: ticso@cicely.de cc: current@freebsd.org Subject: Re: GIANT question X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: ticso@cicely.de 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:38:34 -0000 On Wed, Jul 21, 2004 at 11:12:50AM -0600, Scott Long wrote: > 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); Ah - now I got it - the DROP/PICKUP are just macros to handle recurision level. > Note that you must not be holding any locks when you go to aquire Giant. That's clear. -- B.Walter BWCT http://www.bwct.de bernd@bwct.de info@bwct.de