From owner-freebsd-smp Thu Oct 5 22:28:30 2000 Delivered-To: freebsd-smp@freebsd.org Received: from smtp02.primenet.com (smtp02.primenet.com [206.165.6.132]) by hub.freebsd.org (Postfix) with ESMTP id 8650837B502; Thu, 5 Oct 2000 22:28:28 -0700 (PDT) Received: (from daemon@localhost) by smtp02.primenet.com (8.9.3/8.9.3) id WAA24886; Thu, 5 Oct 2000 22:25:12 -0700 (MST) Received: from usr02.primenet.com(206.165.6.202) via SMTP by smtp02.primenet.com, id smtpdAAAR1a4.U; Thu Oct 5 22:23:05 2000 Received: (from tlambert@localhost) by usr02.primenet.com (8.8.5/8.8.5) id WAA22981; Thu, 5 Oct 2000 22:26:09 -0700 (MST) From: Terry Lambert Message-Id: <200010060526.WAA22981@usr02.primenet.com> Subject: Re: Problems with kthread_exit() and SMPng To: ticso@cicely5.cicely.de (Bernd Walter) Date: Fri, 6 Oct 2000 05:26:09 +0000 (GMT) Cc: jhb@FreeBSD.ORG (John Baldwin), jburkhol@home.com (Jake Burkholder), bp@butya.kz (Boris Popov), freebsd-smp@FreeBSD.ORG, mark@grondar.za (Mark Murray) In-Reply-To: <20001006002200.E40689@cicely5.cicely.de> from "Bernd Walter" at Oct 06, 2000 12:22:01 AM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > 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. > 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. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message