Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jul 2004 19:37:43 +0200
From:      Bernd Walter <ticso@cicely12.cicely.de>
To:        Scott Long <scottl@freebsd.org>
Cc:        current@freebsd.org
Subject:   Re: GIANT question
Message-ID:  <20040721173742.GG70663@cicely12.cicely.de>
In-Reply-To: <40FEA412.3050900@freebsd.org>
References:  <20040721170534.GF70663@cicely12.cicely.de> <40FEA412.3050900@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040721173742.GG70663>