unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Andreas Larsson <andreas@gaisler.com>, libc-alpha@sourceware.org
Cc: Romain Naour <romain.naour@smile.fr>
Subject: Re: [PATCH 2/2] sparc: Use atomic compiler builtins on sparc
Date: Thu, 21 Nov 2019 16:43:54 -0300	[thread overview]
Message-ID: <08a0fc90-81ac-d8f9-d3eb-8b89c8fcf6fd@linaro.org> (raw)
In-Reply-To: <bd5bc3bb-fbf2-398d-0485-21bba3c86798@gaisler.com>



On 19/11/2019 11:23, Andreas Larsson wrote:
> On 2019-11-13 20:28, Adhemerval Zanella wrote:
>> This patch removes the arch-specific atomic instruction, relying on
>> compiler builtins.  The __sparc32_atomic_locks support is removed
>> and a configure check is added to check if compiler uses libatomic
>> to implement CAS.
>>
>> It also removes the sparc specific sem_* and pthread_barrier_*
>> implementations.  It in turn allows buidling against a LEON3/LEON4
>> sparcv8 target, although it will still be incompatible with generic
>> sparcv9.
>>
>> Checked on sparcv9-linux-gnu and sparc64-linux-gnu.  I also checked
>> with build against sparcv8-linux-gnu with -mcpu=leon3.
> 
> I tested this on LEON vith the nptl-tests, and it works fine!

Thanks.

> 
> I still think that it would be useful to have kernel emulation for these
> atomics for sparc32 running on v8 or v9 in the future. If not in glibc,
> perhaps it could be solved by trapping to the kernel from the compiler
> builtins when compiling for Linux, via some option that GLIBC can enable
> when building for a new enough kernel.

Is there any real plan for a future sparc v8 without proper atomics?
Because afaik besides LEON, all current sparc releases from other 
vendors (including open-source implementation targeting FPGA) supports
v9.

For a libc standpoint that aims to support both recent C and POSIX
standard, an architecture without proper CAS is at least tricky to
support.  The sparc v7 cas emulation using lock it is not 
async-signal-safe and it leads to a set of internal possible 
inconsistencies (besides the scalability issue).

Also, the trick proposed by David [1], although clever, just adds
internal complexity with much direct gain.  It would require to
add some compiler switch along with a configure test to to disable
the usage of compiler builtins and fallback to the kernel trap. And
it would be another build permutation that would need some coverage
(at least from build-many-glibcs).  It is even messy because a glibc
built targetting a sparcv8 won't run on a sparcv9 without an updated
kernel.

I wouldn't block if such patch is proposed, but I think sparcv8 
without atomics is quite unusual that it does not worth the trouble.

> 
> Tested-by: Andreas Larsson <andreas@gaisler.com>

[1] https://sourceware.org/ml/libc-alpha/2016-11/msg00243.html

  reply	other threads:[~2019-11-21 19:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-11 17:43 [PATCH] Remove 32 bit sparc v8 support Adhemerval Zanella
2019-11-11 18:24 ` Joseph Myers
2019-11-11 19:14   ` Adhemerval Zanella
2019-11-11 22:27     ` Joseph Myers
2019-11-12 12:17 ` [PATCH v2] " Adhemerval Zanella
2019-11-12 13:35   ` Romain Naour
2019-11-12 15:39   ` Andreas Larsson
2019-11-12 20:43     ` Adhemerval Zanella
2019-11-13 19:28       ` [PATCH 1/2] Remove 32 bit sparc v7 support Adhemerval Zanella
2019-11-13 19:28         ` [PATCH 2/2] sparc: Use atomic compiler builtins on sparc Adhemerval Zanella
2019-11-19 14:23           ` Andreas Larsson
2019-11-21 19:43             ` Adhemerval Zanella [this message]
2019-11-26 18:16             ` Adhemerval Zanella
2019-11-13 20:32         ` [PATCH 1/2] Remove 32 bit sparc v7 support Joseph Myers
2019-11-13 20:34           ` Adhemerval Zanella
2019-11-26 18:16             ` Adhemerval Zanella
2019-11-28 17:23               ` Joseph Myers
2019-11-28 17:33                 ` Joseph Myers
2019-11-28 19:29                   ` Adhemerval Zanella
2019-11-28 20:10                     ` Joseph Myers

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

  List information: https://www.gnu.org/software/libc/involved.html

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

  git send-email \
    --in-reply-to=08a0fc90-81ac-d8f9-d3eb-8b89c8fcf6fd@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=andreas@gaisler.com \
    --cc=libc-alpha@sourceware.org \
    --cc=romain.naour@smile.fr \
    /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).