public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/102218] 128-bit atomic compare and exchange does not honor memory model on AArch64 and Arm
Date: Mon, 08 Aug 2022 13:38:29 +0000	[thread overview]
Message-ID: <bug-102218-4-cs02GKFtWg@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102218-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102218

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tamar Christina <tnfchris@gcc.gnu.org>:

https://gcc.gnu.org/g:e6a8ae900b4141bbce1451da8f173d441662782d

commit r13-1988-ge6a8ae900b4141bbce1451da8f173d441662782d
Author: Tamar Christina <tamar.christina@arm.com>
Date:   Mon Aug 8 14:37:00 2022 +0100

    AArch64: Fix 128-bit sequential consistency atomic operations.

    The AArch64 implementation of 128-bit atomics is broken.

    For 128-bit atomics we rely on pthread barriers to correct guard the
address
    in the pointer to get correct memory ordering.  However for 128-bit atomics
the
    address under the lock is different from the original pointer.

    This means that one of the values under the atomic operation is not
protected
    properly and so we fail during when the user has requested sequential
    consistency as there's no barrier to enforce this requirement.

    As such users have resorted to adding an

    #ifdef GCC
    <emit barrier>
    #endif

    around the use of these atomics.

    This corrects the issue by issuing a barrier only when __ATOMIC_SEQ_CST was
    requested.  To remedy this performance hit I think we should revisit using
a
    similar approach to out-line-atomics for the 128-bit atomics.

    Note that I believe I need the empty file due to the include_next chain but
    I am not entirely sure.  I have hand verified that the barriers are
inserted
    for atomic seq cst.

    libatomic/ChangeLog:

            PR target/102218
            * config/aarch64/aarch64-config.h: New file.
            * config/aarch64/host-config.h: New file.

  parent reply	other threads:[~2022-08-08 13:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-06 14:29 [Bug target/102218] New: " tnfchris at gcc dot gnu.org
2022-05-26 11:01 ` [Bug target/102218] " tnfchris at gcc dot gnu.org
2022-08-08 13:38 ` cvs-commit at gcc dot gnu.org [this message]
2022-08-08 13:38 ` cvs-commit at gcc dot gnu.org
2022-12-20 10:45 ` ktkachov at gcc dot gnu.org
2022-12-21  9:51 ` tnfchris at gcc dot gnu.org

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=bug-102218-4-cs02GKFtWg@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).