From owner-cvs-all Fri Oct 25 7:42:56 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 473D537B407 for ; Fri, 25 Oct 2002 07:42:52 -0700 (PDT) Received: from mail.speakeasy.net (mail14.speakeasy.net [216.254.0.214]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7533943E4A for ; Fri, 25 Oct 2002 07:42:51 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 29109 invoked from network); 25 Oct 2002 14:42:54 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail14.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 25 Oct 2002 14:42:54 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.6/8.12.6) with ESMTP id g9PEgnn5075149; Fri, 25 Oct 2002 10:42:49 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <18323.1035554446@critter.freebsd.dk> Date: Fri, 25 Oct 2002 10:42:53 -0400 (EDT) From: John Baldwin To: Poul-Henning Kamp Subject: Re: cvs commit: src/sys/kern kern_mutex.c Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 25-Oct-2002 Poul-Henning Kamp wrote: > In message , John Baldwin writes: >> >>On 25-Oct-2002 Poul-Henning Kamp wrote: >>> phk 2002/10/25 01:40:20 PDT >>> >>> Modified files: >>> sys/kern kern_mutex.c >>> Log: >>> Disable the kernacc() check in mtx_validate() until such time that kernacc >>> does not require Giant. >>> >>> This means that we may miss panics on a class of mutex programming bugs, >>> but only if running with a Chernobyl setting of debug-flags. >>> >>> Spotted by: Pete Carah >> >>People probably should not be using MUTEX_DEBUG unless they are actually >>working on the mutex implementation anyways. We might even should just >>shoot that code in the head and put it out of its misery. > > Maybe replace it by: > > { > struct mtx tmp; > > [...] > /* See if we can read/write the mutex */ > bcopy(mp, &tmp, sizeof tmp); > bcopy(&tmp, mp, sizeof tmp); > > If we want to retain some amount of checking. > > Poul-Henning > > PS: That reminds me, I've sometimes wondered if we should have a > global string pointer where one could leave a panic hint, > that could make the above code look something like: > > { > struct mtx tmp; > > [...] > /* See if we can read/write the mutex */ > panic_hint("Mutex in wrong kind of RAM"); > bcopy(mp, &tmp, sizeof tmp); > bcopy(&tmp, mp, sizeof tmp); > panic_hint(NULL); > > And if explode on one of the bcopy() panic would leave a hint > about what the problem is: > > panic(blablabla) > This may be why: Mutex in wrong kind of RAM. > Hint from: mtx_validate() line 886 in ../../../kern/kern_mutex.c > > Just an idea... Hmm, that's pretty cool. That would be fairly low overhead as well. Maybe stick it under INVARIANTS? -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message