Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Jul 2018 12:28:22 -0700
From:      Matthew Macy <mmacy@freebsd.org>
To:        Mark Johnston <markj@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r335879 - in head/sys: conf kern sys
Message-ID:  <CAPrugNrAF_P%2B94KCXvRi6HR%2BVSCkQdgbyoNMUwytD5xPRc=_hg@mail.gmail.com>
In-Reply-To: <20180708142210.GA18193@pesky>
References:  <201807030155.w631tARo009470@repo.freebsd.org> <20180708142210.GA18193@pesky>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jul 8, 2018 at 7:22 AM, Mark Johnston <markj@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPrugNrAF_P%2B94KCXvRi6HR%2BVSCkQdgbyoNMUwytD5xPRc=_hg>