From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7673 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Deduplicating atomics written in terms of CAS Date: Sun, 17 May 2015 18:33:27 -0400 Message-ID: <20150517223327.GR17573@brightrain.aerifal.cx> References: <20150517045536.GA25046@brightrain.aerifal.cx> <20150517061430.GL17573@brightrain.aerifal.cx> <1431848239.11628.3.camel@inria.fr> <20150517162854.GN17573@brightrain.aerifal.cx> <1431881993.4219.1.camel@inria.fr> <20150517175918.GQ17573@brightrain.aerifal.cx> <1431901387.4219.7.camel@inria.fr> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1431902022 8209 80.91.229.3 (17 May 2015 22:33:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 17 May 2015 22:33:42 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7685-gllmg-musl=m.gmane.org@lists.openwall.com Mon May 18 00:33:42 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Yu77t-00037D-B9 for gllmg-musl@m.gmane.org; Mon, 18 May 2015 00:33:41 +0200 Original-Received: (qmail 1978 invoked by uid 550); 17 May 2015 22:33:39 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 1960 invoked from network); 17 May 2015 22:33:39 -0000 Content-Disposition: inline In-Reply-To: <1431901387.4219.7.camel@inria.fr> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:7673 Archived-At: On Mon, May 18, 2015 at 12:23:07AM +0200, Jens Gustedt wrote: > Am Sonntag, den 17.05.2015, 13:59 -0400 schrieb Rich Felker: > > > Ah sorry, I probably went too fast. My last paragraph would be for all > > > atomic operations, so in particular 32 bit. A macro "a_load" would > > > make intentions clearer and would perhaps allow to implement an > > > optional compile time check to see if we use any object consistently > > > as atomic or not. > > > > The reason I'm mildly against this is that all current reads of > > atomics, except via the return value of a_cas or a_fetch_add, are > > relaxed-order. We don't care if we see a stale value; if staleness > > could be a problem, the caller takes care of that in an efficient way. > > Having a_load that's relaxed-order whereas all the existing atomics > > are seq_cst order would be an inconsistent API design. > > I still wasn't clear enough, sorry. My idea was not that such a > function or macro should change anything on the binary code that is > produced, at least for production builds. I just thought to > encapsulate all atomic accesses into a type and functions that allow > to have a compile check. I understand that. But if it were called a_load, its semantics (no synchronization/relaxed order) would be inconsistent with all other a_* atomics which are seq_cst. That's what I don't like. Rich