mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: Deduplicating atomics written in terms of CAS
Date: Sun, 17 May 2015 18:33:27 -0400	[thread overview]
Message-ID: <20150517223327.GR17573@brightrain.aerifal.cx> (raw)
In-Reply-To: <1431901387.4219.7.camel@inria.fr>

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


  reply	other threads:[~2015-05-17 22:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-17  4:55 Rich Felker
2015-05-17  6:00 ` Alexander Monakov
2015-05-17  6:14   ` Rich Felker
2015-05-17  7:37     ` Jens Gustedt
2015-05-17 16:28       ` Rich Felker
2015-05-17 16:59         ` Jens Gustedt
2015-05-17 17:59           ` Rich Felker
2015-05-17 22:23             ` Jens Gustedt
2015-05-17 22:33               ` Rich Felker [this message]
2015-05-17 23:22                 ` Jens Gustedt
2015-05-18 10:19               ` Szabolcs Nagy
2015-05-18 11:03                 ` Jens Gustedt
2015-05-17  6:49 ` Jens Gustedt
2015-05-17 16:22   ` Rich Felker
2015-05-17 17:19     ` Jens Gustedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150517223327.GR17573@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).