Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Oct 2002 16:00:46 +0200
From:      Poul-Henning Kamp <phk@critter.freebsd.dk>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org
Subject:   Re: cvs commit: src/sys/kern kern_mutex.c 
Message-ID:  <18323.1035554446@critter.freebsd.dk>
In-Reply-To: Your message of "Fri, 25 Oct 2002 09:50:53 EDT." <XFMail.20021025095053.jhb@FreeBSD.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <XFMail.20021025095053.jhb@FreeBSD.org>, 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 <pete@ns.altadena.net>
>
>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...

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

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




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