From owner-freebsd-threads@freebsd.org Mon Jan 11 19:11:45 2016 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DE71A6C722; Mon, 11 Jan 2016 19:11:45 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B3251FC5; Mon, 11 Jan 2016 19:11:45 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 02D1D5A9F13; Mon, 11 Jan 2016 19:06:25 +0000 (UTC) Date: Mon, 11 Jan 2016 19:06:25 +0000 From: Brooks Davis To: Konstantin Belousov Cc: Daniel Eischen , freebsd-threads@freebsd.org, freebsd-arch@freebsd.org Subject: Re: libthr shared locks Message-ID: <20160111190625.GB79262@spindle.one-eyed-alien.net> References: <20151224191408.GA3625@kib.kiev.ua> <20151226105409.GH3625@kib.kiev.ua> <20151226234424.GJ3625@kib.kiev.ua> <20151228105157.GQ3625@kib.kiev.ua> <20151229184405.GY3625@kib.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+QahgC5+KEYLbs62" Content-Disposition: inline In-Reply-To: <20151229184405.GY3625@kib.kiev.ua> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jan 2016 19:11:45 -0000 --+QahgC5+KEYLbs62 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: > >=20 > > > 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. > >=20 > > 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: > >=20 > > struct pthread_mutex_t { > > uint32_t __x[IMPL_REQ + IMPL_SPARE + pad_to_CACHE_LINE_SIZE]; > > }; > >=20 > > 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 --+QahgC5+KEYLbs62 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJWk/0wAAoJEKzQXbSebgfA7UUH/0KsCILGL3XgMqXJ5DHmQByO CzRjLHA18RgSO9jweHd24NhVW3veHuueThyoWzh/aHM3CoA/NuX51cnVuSjjZTXu 5tx6/hlnjg8i3KUrcpweL/5U6J4QBsk8YjlVt0qIWuoRRwQCYd7dJPC5LVGw6XD+ UogZtYItXFUEjMB+9dtyV6PITTb1guPwjqikDiW3VycQpqO4sbqLa0HuI62lgadJ XXRB0ttVCU9mUwz4U4DmqCKPo9pg+TEotLtETXOXPXlu3/7my/1sLuMAx8U0iZqE v07sXFtCOYXZogSpWoGgSmySxX68LiaGDpd3SsDnY/VkRYpjBFxAjcFNsNfmR5w= =4tyM -----END PGP SIGNATURE----- --+QahgC5+KEYLbs62--