From: Marc Glisse <marc.glisse@inria.fr>
To: Andrew MacLeod <amacleod@redhat.com>
Cc: gcc@gcc.gnu.org, Lawrence Crowl <crowl@google.com>,
Benjamin Kosnik <bkoz@redhat.com>,
Richard Henderson <rth@redhat.com>,
Aldy Hernandez <aldyh@redhat.com>
Subject: Re: C++11 atomic library notes
Date: Sun, 02 Oct 2011 08:40:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.02.1110021021570.4182@laptop-mg.saclay.inria.fr> (raw)
In-Reply-To: <4E879E4B.9030106@redhat.com>
On Sat, 1 Oct 2011, Andrew MacLeod wrote:
> On 10/01/2011 02:55 AM, Marc Glisse wrote:
>>
>> "The compiler must ensure that for any given object, it either ALWAYS
>> inlines lock free routines, OR calls the external routines. For any given
>> object, these cannot be intermixed."
>>
>> Why? You give an example explaining why it is fine to link 386 and 486
>> objects, and I cant see the difference. Not that I'm advocating mixing
>> them, just wondering whether it really matters if it happens (by accident).
>
> If we have an architecture which we cannot generate one of the functions for,
> say __atomic_load_16, then it will have to use whatever the library supplies.
> If you continues to generate all the rest of the __atomic builtins for 16
> bytes using lock free instructions, and the call to the library turns out to
> be a locked implementation at runtime, then atomic support for 16 byte
> objects is broken. The load thinks its getting a lock, but none of the other
> routines pay any attention to locks. So if one atomic operations requires
> then library, they all do in order to get consistent behaviour.
Ah ok, I had understood:
* if __atomic_store_8 is inlined on line 18, it should also be inlined on
line 42
when instead it is:
* we can't have a locked addition and a lock-free subtraction (hence the
__atomic_is_lock_free which only takes a size as argument)
Makes perfect sense, thank you for the precision.
By the way, does it make sense to work atomically on a 16 byte object, and
also work atomically on its first 8 bytes, thus potentially requiring
__atomic_is_lock_free not to depend on the size?
--
Marc Glisse
next prev parent reply other threads:[~2011-10-02 8:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4E862864.2010607@redhat.com>
2011-10-01 6:56 ` Marc Glisse
2011-10-01 23:12 ` Andrew MacLeod
2011-10-02 8:40 ` Marc Glisse [this message]
2011-10-02 13:56 ` Andrew MacLeod
2011-10-03 17:31 ` Richard Henderson
2011-10-03 17:54 ` Andrew MacLeod
2011-10-03 18:10 ` Richard Henderson
2011-10-03 19:52 ` Joseph S. Myers
2011-10-05 7:26 ` Jeffrey Yasskin
2011-10-05 18:58 ` Andrew MacLeod
2011-10-05 19:07 ` Jeffrey Yasskin
2011-10-05 20:12 ` Andrew MacLeod
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=alpine.DEB.2.02.1110021021570.4182@laptop-mg.saclay.inria.fr \
--to=marc.glisse@inria.fr \
--cc=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--cc=bkoz@redhat.com \
--cc=crowl@google.com \
--cc=gcc@gcc.gnu.org \
--cc=rth@redhat.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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).