svn commit: r335879 - in head/sys: conf kern sys

Matthew Macy mmacy at freebsd.org
Sun Jul 8 19:28:25 UTC 2018


On Sun, Jul 8, 2018 at 7:22 AM, Mark Johnston <markj at freebsd.org> wrote:
> On Tue, Jul 03, 2018 at 01:55:10AM +0000, Matt Macy wrote:
>> Author: mmacy
>> Date: Tue Jul  3 01:55:09 2018
>> New Revision: 335879
>> URL: https://svnweb.freebsd.org/changeset/base/335879
>>
>> Log:
>>   make critical_{enter, exit} inline
>>
>>   Avoid pulling in all of the <sys/proc.h> dependencies by
>>   automatically generating a stripped down thread_lite exporting
>>   only the fields of interest. The field declarations are type checked
>>   against the original and the offsets of the generated result is
>>   automatically checked.
>>
>>   kib has expressed disagreement and would have preferred to simply
>>   use genassym style offsets (which loses type check enforcement).
>>   jhb has expressed dislike of it due to header pollution and a
>>   duplicate structure. He would have preferred to just have defined
>>   thread in _thread.h. Nonetheless, he admits that this is the only
>>   viable solution at the moment.
>>
>>   The impetus for this came from mjg's D15331:
>>   "Inline critical_enter/exit for amd64"
>>
>>   Reviewed by: jeff
>>   Differential Revision: https://reviews.freebsd.org/D16078
>>
>> [...]
>> +#if defined(KLD_MODULE) || defined(KTR_CRITICAL) || !defined(_KERNEL) || defined(GENOFFSET)
>> +#define critical_enter() critical_enter_KBI()
>> +#define critical_exit() critical_exit_KBI()
>> +#else
>> +static __inline void
>> +critical_enter(void)
>> +{
>> +     struct thread_lite *td;
>> +
>> +     td = (struct thread_lite *)curthread;
>> +     td->td_critnest++;
>
> Don't we need a compiler barrier here?
>

We definitely do. Not sure how that got lost :( Will fix.
-M


More information about the svn-src-head mailing list