Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 02 Jan 2003 12:42:40 -0500 (EST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Poul-Henning Kamp <phk@FreeBSD.org>
Subject:   Re: cvs commit: src/sys/sys _mutex.h
Message-ID:  <XFMail.20030102124240.jhb@FreeBSD.org>
In-Reply-To: <20021230142740.R44529-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 30-Dec-2002 Bruce Evans wrote:
> On Sun, 29 Dec 2002, Poul-Henning Kamp wrote:
> 
>> phk         2002/12/29 03:14:41 PST
>>
>>   Modified files:
>>     sys/sys              _mutex.h
>>   Log:
>>   Save 16 bytes per mutex if MUTEX_PROFILING is not defined.
>>
>>   MUTEX_PROFILING is in opt_global.h, so this does not introduce a risk of
>>   variant structure sizes unless foreign kernel modules are used.
> 
> Not so.  This breaks all modules, not just foreign ones, since
> opt_global.h is not included in any module, and even if it were then
> its setting for some modules might differ from the setting in the
> kernel.
> 
> Please have future changes to headers reviewed by people familiar with
> the headers.
> 
> Rev.1.7 intentionally removed a commented-out MUTEX_PROFILING ifdef
> which erroneously suggested that such an ifdef might work.  In a review
> of rev.1.7, it claimed out that there is no problem for modules since
> modules use only extern functions to access mutexes.  This is wrong
> because a kernel compiled with MUTEX_PROFILING will blindly access
> struct members that don't exist in mutexes that are allocated in modules
> compiled without MUTEX_PROFILING (i.e., in all modules) if the mutex
> profiling struct members are ifdefed.  In any case, variant structs are
> fragile and give undefined behaviour.

My personal opinion is that MUTEX_PROFILING should be a kind of
'for experts only' thing and if one wants to use modules with it,
one should have to make their own special precautions.  Pessimizing
just modules probably wouldn't work since mutexes are embedded in
structures like struct proc, etc. and modules would have the wrong
offsets for members of struct proc after p_mtx.

-- 

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.20030102124240.jhb>