Date: Fri, 25 Oct 2002 10:42:53 -0400 (EDT) From: John Baldwin <jhb@FreeBSD.org> To: Poul-Henning Kamp <phk@critter.freebsd.dk> Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern kern_mutex.c Message-ID: <XFMail.20021025104253.jhb@FreeBSD.org> In-Reply-To: <18323.1035554446@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
On 25-Oct-2002 Poul-Henning Kamp wrote:
> 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...
Hmm, that's pretty cool. That would be fairly low overhead
as well. Maybe stick it under INVARIANTS?
--
John Baldwin <jhb@FreeBSD.org> <>< 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20021025104253.jhb>
