Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Oct 2000 12:30:53 +0200
From:      Bernd Walter <ticso@cicely5.cicely.de>
To:        Terry Lambert <tlambert@primenet.com>
Cc:        John Baldwin <jhb@FreeBSD.ORG>, Jake Burkholder <jburkhol@home.com>, Boris Popov <bp@butya.kz>, freebsd-smp@FreeBSD.ORG, Mark Murray <mark@grondar.za>
Subject:   Re: Problems with kthread_exit() and SMPng
Message-ID:  <20001006123053.A42012@cicely5.cicely.de>
In-Reply-To: <200010060526.WAA22981@usr02.primenet.com>; from tlambert@primenet.com on Fri, Oct 06, 2000 at 05:26:09AM %2B0000
References:  <20001006002200.E40689@cicely5.cicely.de> <200010060526.WAA22981@usr02.primenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Oct 06, 2000 at 05:26:09AM +0000, Terry Lambert wrote:
> > The situation with such functions is not uncritical as you may need to
> > release other mutexes before you call printf();
> 
> Holding multiple mutexes should only  ever occur when doing
> list or other multiple pointer manipulation which needs to be
> done in such a way as to appear atomic, so this is pretty
> much a bogus argument.

Which I understand as:
Don't call another driver while owning a mutex because you never
know what it might be waiting for.
Giant is an exeption for this rule.

The ugly point here is that I never thought about printf to be a call
to another driver.

> > Say you have a driver which is called via another driver (upcall, ...).
> > The other driver is not updated and calls us while holding Giant and we
> > need to fetch one of our own mutexes for processing. That means we have to
> > own Giant before we fetch our own mutex if we want to make use of printf()
> > or we need to release our before entering Giant to do printf().
> > Otherwise we don't have a fixed mutex order :(
> 
> Grab the printf mutex, queue the request, release the printf
> mutex.  A mutex protexts data structure manipulations (in this
> example, the events queued for console display), _not_ code.

I agree but actually Giant is used to protect old code.

-- 
B.Walter              COSMO-Project         http://www.cosmo-project.de
ticso@cicely.de         Usergroup           info@cosmo-project.de



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




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