From owner-freebsd-arch@freebsd.org Mon Jan 11 19:11:45 2016 Return-Path: Delivered-To: freebsd-arch@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-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture 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-- From owner-freebsd-arch@freebsd.org Tue Jan 12 04:27:18 2016 Return-Path: Delivered-To: freebsd-arch@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 A73ACA6CBC0 for ; Tue, 12 Jan 2016 04:27:18 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 830631C2E for ; Tue, 12 Jan 2016 04:27:18 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: by mailman.ysv.freebsd.org (Postfix) id 80279A6CBBE; Tue, 12 Jan 2016 04:27:18 +0000 (UTC) Delivered-To: arch@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 65086A6CBBD for ; Tue, 12 Jan 2016 04:27:18 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-pf0-x22a.google.com (mail-pf0-x22a.google.com [IPv6:2607:f8b0:400e:c00::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 33A0F1C2C for ; Tue, 12 Jan 2016 04:27:18 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: by mail-pf0-x22a.google.com with SMTP id e65so56095119pfe.0 for ; Mon, 11 Jan 2016 20:27:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :message-id:references:to; bh=p4tqs84fP0zbs+RVV2wH+jIw8ybJdBOY6VgOY4fDdQQ=; b=xXQhf83/PblcPAZbVHaEk7QiSBf4wcueDcHH18wzsuZWIq0e/DN3BLoVQneDXET3Ko no6TMPeRK9Dvke+AjoGpsgpERPdhubsfawaLuch1ZuNeIgbgrum82a3Zp3JFjwwHKT07 Uai02qYhSYP2YMvQYU0nfTpEpkjuVtxsCWYOEldReXYFd4qCOoEhuUFR4Boe1err2MUG QyEPbnXimX5kg52nnZJ/JP93zWH5eqiRBArLcziwVIiQORAtNX3MpJOPWtGjxSyZcCdj 7VGBB5LzCiitE97r9AazyMGvIEDworja5wob0atrKQL1bjQH1/xdGIU9rHQDNnX6rkhT niwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=p4tqs84fP0zbs+RVV2wH+jIw8ybJdBOY6VgOY4fDdQQ=; b=Y3LwhJjEP9vLFnSFApqb+L+qup+241MWFaDHzTcezSlsw1UNhqtAn5Zy0MFm4iPhng OdKozufxzl5arxq97B3LRsWQqrcbyTs3RFNTYBVQG8vxbu4n1OmEJYgsJlyBeGozX9kd 5W+q0/cgfh9/ip5iOwmmbynDfh3sKmbJ/r4DN2dik7gb2hDhCUrvd5v8wgRYIixVSDvE LTYfO6DYfPPHKBdlSYOnMUZoGqJbx+h1QheYvqq4mobJ8JjYyxgGL3sjU6WOdz3gAba7 ct/jUe9HzuQyQ9WeXyLAAeIWZ9GHxJlhlP1AqaFE2Z5XBP0SDgx9xyKk54C3mSDDBx7u bQ+w== X-Gm-Message-State: ALoCoQnOwKJtREa1i11y582putq+N5cFxP8fWCGA+VegQzThb1/k93lah7xXmKEU0Y6QBQuBsA2GvgyazaLGUH9/DxIYdcT+gA== X-Received: by 10.98.65.148 with SMTP id g20mr31723696pfd.21.1452572837737; Mon, 11 Jan 2016 20:27:17 -0800 (PST) Received: from [100.127.145.144] ([69.53.245.34]) by smtp.gmail.com with ESMTPSA id dg12sm148030058pac.47.2016.01.11.20.27.16 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Jan 2016 20:27:17 -0800 (PST) Sender: Warner Losh Subject: Real multilib Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Content-Type: multipart/signed; boundary="Apple-Mail=_DFA0DD6B-8610-438A-8546-D1CE60B1F96B"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5.2 From: Warner Losh In-Reply-To: <56947DAD.80106@freebsd.org> Date: Mon, 11 Jan 2016 21:27:14 -0700 Cc: "freebsd-arch@freebsd.org" Message-Id: References: <201601030432.u034W6en043633@repo.freebsd.org> <20160111221614.GC79262@spindle.one-eyed-alien.net> <56947DAD.80106@freebsd.org> To: Nathan Whitehorn X-Mailer: Apple Mail (2.2104) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jan 2016 04:27:18 -0000 --Apple-Mail=_DFA0DD6B-8610-438A-8546-D1CE60B1F96B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 [[ Moved to arch@ ]] > On Jan 11, 2016, at 9:14 PM, Nathan Whitehorn = wrote: >=20 >=20 >=20 > On 01/11/16 19:11, Warner Losh wrote: >>> On Jan 11, 2016, at 3:16 PM, Brooks Davis = wrote: >>>=20 >>> On Sun, Jan 03, 2016 at 06:41:33PM +0100, Dimitry Andric wrote: >>>> On 03 Jan 2016, at 05:32, Warner Losh wrote: >>>>> Author: imp >>>>> Date: Sun Jan 3 04:32:05 2016 >>>>> New Revision: 293068 >>>>> URL: https://svnweb.freebsd.org/changeset/base/293068 >>>>>=20 >>>>> Log: >>>>> Add libsoft to the tree, just like lib32. >>>> Hmm, are there going to be more of these "multilib" things? :) >>> We'll want to do something about supporting hard float on MIPS. = Over >>> there it may be more of a TARGET_ARCH thing, but libsoft might be = useful. >> It isn=E2=80=99t quite a TARGET_ARCH on mips either. I=E2=80=99d love = to work with you >> to use this stuff MIPS turns out to be a harder nut to crack with = this stuff >> because it marks the different types of binaries differently and it = looks harder >> to parse. >>=20 >> For amv6 it is more of a transition thing, but I wanted to do it = something >> approaching =E2=80=9Ccorrect=E2=80=9D so that we could leverage it = for MIPS. >>=20 >>> We've also got a libcheri in CheriBSD and will eventually need to do = a >>> lib64 as we explore the switch from CHERI-when-requested to >>> CHERI-by-default. >> We should definitely chat about this. There=E2=80=99s some easy ways = to mark the CHERI >> binaries that are easier than others which would be quite helpful. >>=20 >> So we should chat about how this would be helpful on MIPS, and not = just >> CHERI-mips... >>=20 >> Warner >>=20 >=20 > For things that are a MACHINE_ARCH, do we want a convention of = lib/${MACHINE_ARCH}? That seems like it would make it easily scalable = and easier to predict than a lot of lib*. For things that aren't quite a = MACHINE_ARCH, it's more complicated of course. I=E2=80=99m not sure. If we were designing things from scratch, this = might make some sense. Though honestly, I=E2=80=99d make it be multilib/${MACHINE_ARCH} so that lib = could be a symlink there so that most config scripts that simply know where things live can find = them more easily. Since we have a big legacy issue to cope with, I=E2=80=99m having trouble = seeing a clear path here. There might be one, but I haven=E2=80=99t connected all the dots in my head=E2=80= =A6 Plus, MACHINE_ARCH likely isn=E2=80=99t expressive enough. The armv6 = kernels, for example, can run either soft-float ABI or hard-float ABI programs equally well (which = is why my hack works). It is my belief that, when booted on a hardware capable processor, a = mips kernel could do the same thing. There=E2=80=99s no floats passed into the kernel for system = calls, so the floating point part of the ABI in use is simply irrelevant. I wonder if someone has a good write-up on how this stuff is normally = done on, say, Linux. My google searches have found lots of entries about how to enable it, but = not what the underlying scheme really is or good docs on the architecture. This is one of the = things that stalled what I did for so long. But after seeing Brooks' talk on libcheri, I thought = I=E2=80=99d move forward with what I have. Warner --Apple-Mail=_DFA0DD6B-8610-438A-8546-D1CE60B1F96B Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJWlICiAAoJEGwc0Sh9sBEAXnwP/0Cnzc6m1X0TchlMDNN9fCv9 mk6Rs0z9IZdME76MLb/snqVDSLgPAOBPfblAPC180wJlj4bBvhtPWHv/2NEt+L5d PrhdIJP+MbJGqdJvh6HN34gwfUO9VAppXA48OOykvPVUAqRz+nBhhPhpfqWrbQhR fhQvcIY9+/z10urK7cSFODKuRxzfrSxKau+RYruT3lALkI+xGCd7Pc8wFd0g5Gb+ SS6KdKOjA3f8e5WpywJGYyNLEzofBYqhu8l6hUaTw+s1heV3aroq5TpZ213cKV2F iBmVYBnT72zmhovnoZVJCn+dJlNAahJ4p35yDuCKoxg37Jzxvb4bAbJOA+2fEvrv grkqwNZPvvNmiWdaNjiUP5TDg9WZ4WETDzvNrHQLq0e+w5esrJBC0gHUp3/IlnMC phwVH+xcVbZHRlYkzmMy+kv3ue3oRBP1za7pyDYHvpJf7IkNU1o0XkPYXOhbS8Fl Xk7H02TgGKXKr3SYSq0sxtCvtJLkvexAeO2Ocj7cBBZCV2j211R2gnCr8+IraE5v mqJzp7ZopqLaUnVjXNJlv5NN3c4cla00vXtO4ZHZdP5Tj2zCNtJmt9pudj9WAlxn adfKJJ7p24rMBQ26njB6O/+wBL6G87rjj/lJcRNU19pn5EEp/ybsK0aPTcqidF3f hUhHMDUxIp45sdt11Sff =Nm+j -----END PGP SIGNATURE----- --Apple-Mail=_DFA0DD6B-8610-438A-8546-D1CE60B1F96B--