libthr shared locks

Brooks Davis brooks at freebsd.org
Mon Jan 11 19:11:45 UTC 2016


On Tue, Dec 29, 2015 at 08:44:05PM +0200, Konstantin Belousov wrote:
> On Mon, Dec 28, 2015 at 11:59:02AM -0500, Daniel Eischen wrote:
> > On Mon, 28 Dec 2015, Konstantin Belousov wrote:
> > 
> > > Taking out the inlining bits from the David patch, or (which would I do,
> > > if doing this) just reimplementing it from scratch is easy enough and
> > > just require some time.  I estimated this job to take between one and
> > > two weeks.
> > 
> > I think a lot of David's patch is the renaming of all the
> > elements of the public structs to prepend '__'.  I was thinking
> > it would be nice to have the public structs be something like
> > this:
> > 
> >    struct pthread_mutex_t {
> >        uint32_t __x[IMPL_REQ + IMPL_SPARE + pad_to_CACHE_LINE_SIZE];
> >    };
> > 
> > and then have libthr override the definition.  That would
> > make declaring PTHREAD_MUTEX_INITIALIZER, etc, a little
> > magical, but avoid a lot of needless churn in libthr.
> This is very good suggestion, I fully agree.  There are some more details,
> e.g. it would be better to use uint64_t or explicit align attribute, to
> get proper alignment, but overall idea is sound, of course.

Based on our experiences with CHERI I'd suggest that the alignment of
opaque types be at least 128-bit to provide some future proofing.  Even
with plenty of spare space (i.e. the giant jmpbuf on MIPS) incresing
alignemnt later adds complexity and opportunities for subtle breakage.

-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-threads/attachments/20160111/70ef78fc/attachment.sig>


More information about the freebsd-threads mailing list