From: "H.J. Lu" <hjl.tools@gmail.com>
To: Florian Weimer <fweimer@redhat.com>,
liuhongt <hongtao.liu@intel.com>,
Hongyu Wang <hongyu.wang@intel.com>
Cc: "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>
Subject: Re: [PATCH] x86: Optimize atomic_compare_and_exchange_[val|bool]_acq [BZ #28537]
Date: Thu, 4 Nov 2021 07:59:22 -0700 [thread overview]
Message-ID: <CAMe9rOpmux6+9ZQmnOQBbW9xaEeZ=ERnNFFo5=FvFfJ4r67o0Q@mail.gmail.com> (raw)
In-Reply-To: <CAMe9rOrW8AwqnNbNMp53BL3XsKfgaeYzivVTTH8FQbSavJGqgw@mail.gmail.com>
On Thu, Nov 4, 2021 at 7:31 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, Nov 4, 2021 at 3:15 AM Florian Weimer <fweimer@redhat.com> wrote:
> >
> > * H. J. Lu:
> >
> > >> Shouldn't GCC be fixed to generate the appropriate instruction sequence
> > >> for this architecture? Should we perhaps switch to compiler atomics for
> > >> x86 instead of defining our own?
> > >
> > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103065
> > >
> > > In the meantime, we should help older compilers.
> >
> > But wouldn't that extra read persist with fixed compilers, due to the
> > memory barrier? So that there are two reads?
>
> Yes, this could be a problem.
>
> > Maybe we need a hint flag for __atomic_compare_exchange_n, encoded in
> > the memory order?
>
> We need a way to identify the fixed compiler. We can add a predefined macro,
> something like __GCC_HAVE_SYNC_COMPARE_AND_SWAP_LOAD_CHECK.
>
Better to define __HAVE_SYNC_COMPARE_AND_SWAP_LOAD_CHECK for
other compilers.
--
H.J.
next prev parent reply other threads:[~2021-11-04 14:59 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 15:04 H.J. Lu
2021-11-03 15:14 ` Andreas Schwab
2021-11-03 15:50 ` Oleh Derevenko
2021-11-03 16:59 ` Arjan van de Ven
2021-11-03 17:17 ` Andreas Schwab
2021-11-03 19:21 ` Arjan van de Ven
2021-11-03 19:48 ` H.J. Lu
2021-11-03 20:38 ` Oleh Derevenko
2021-11-03 22:12 ` H.J. Lu
2021-11-04 8:58 ` Oleh Derevenko
2021-11-04 9:44 ` Oleh Derevenko
2021-11-03 17:26 ` Oleh Derevenko
2021-11-03 17:30 ` Arjan van de Ven
2021-11-03 17:55 ` Oleh Derevenko
2021-11-03 19:22 ` Arjan van de Ven
2021-11-04 11:42 ` Oleh Derevenko
2021-11-04 14:15 ` Arjan van de Ven
2021-11-03 16:35 ` Florian Weimer
2021-11-03 19:13 ` H.J. Lu
2021-11-04 10:15 ` Florian Weimer
2021-11-04 14:31 ` H.J. Lu
2021-11-04 14:59 ` H.J. Lu [this message]
2021-11-03 17:25 ` Noah Goldstein
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='CAMe9rOpmux6+9ZQmnOQBbW9xaEeZ=ERnNFFo5=FvFfJ4r67o0Q@mail.gmail.com' \
--to=hjl.tools@gmail.com \
--cc=fweimer@redhat.com \
--cc=hongtao.liu@intel.com \
--cc=hongyu.wang@intel.com \
--cc=libc-alpha@sourceware.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).