public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: andreas@gaisler.com
Cc: libc-alpha@sourceware.org, adhemerval.zanella@linaro.org,
	carlos@redhat.com, triegel@redhat.com, software@gaisler.com
Subject: Re: [RFC][PATCH 2/2] sparc32: Use cas for atomic_* operations and use general pthread_barrier_wait
Date: Fri, 04 Nov 2016 18:44:00 -0000	[thread overview]
Message-ID: <20161104.144427.831418313476119230.davem@davemloft.net> (raw)
In-Reply-To: <20161104.143710.2239577261242146927.davem@davemloft.net>

From: David Miller <davem@davemloft.net>
Date: Fri, 04 Nov 2016 14:37:10 -0400 (EDT)

> From: Andreas Larsson <andreas@gaisler.com>
> Date: Tue,  1 Nov 2016 16:07:47 +0100
> 
>> This uses the CASA compare and swap with user space data access ASI 0xa
>> that is present on many LEON3 and LEON4 systems and that is implied by
>> gcc's -mcpu=leon3.
>> 
>> The CASA instruction is used not only for atomic compare and exchange
>> functions, but also atomic exchange functions and atomic write
>> functions. This is to allow the OS kernel to emulate that instruction on
>> systems where it is missing and to get atomicity between all atomic
>> writing functions without having to resort to stop all CPU:s in an SMP
>> system.
> 
> Ok, this is fine.  I'll work on the instruction emulation code for the
> kernel side.

Actually, this might cause some problems actually.

We don't always have access to a proper _dl_hwcap value.  Which means
that we will emit the LEON CAS sometimes when running on a v9 chip
which will not work properly.

I need to think about this a bit more.

Probably what we need to do is have three cases:

1) We explicitly know we are on a v9 chip via dl_hwcap, emit v9 CAS

2) We explicitly know we are on a v8 LEON chip via dl_hwcap, emit LEON CAS

3) Else, we emit a special trap instruction which the kernel fixes up

I think this is necessary because we cannot attempt to execute one of
the two CAS cases on the opposing CAS cpu type.

  reply	other threads:[~2016-11-04 18:44 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01 15:08 [RFC][PATCH 0/2] Make sparcv8 work again on cas enabled hardware Andreas Larsson
2016-11-01 15:08 ` [RFC][PATCH 2/2] sparc32: Use cas for atomic_* operations and use general pthread_barrier_wait Andreas Larsson
2016-11-04 18:37   ` David Miller
2016-11-04 18:44     ` David Miller [this message]
2016-11-01 15:08 ` [RFC][PATCH 1/2] sparc32: Mark sendmsg and recvmsg system calls as unsupported Andreas Larsson
2016-11-01 17:28   ` Adhemerval Zanella
2016-11-02 11:38     ` Andreas Larsson
2016-11-02 12:49       ` Adhemerval Zanella
2016-11-04 18:36   ` David Miller
2016-11-01 16:00 ` [RFC][PATCH 0/2] Make sparcv8 work again on cas enabled hardware Torvald Riegel
2016-11-01 16:09   ` David Miller
2016-11-01 16:46     ` Torvald Riegel
2016-11-01 16:51       ` David Miller
2016-11-02 10:05         ` Torvald Riegel
2016-11-02 11:29           ` Andreas Larsson
2016-11-02 15:32           ` David Miller
2016-11-02 22:33             ` Torvald Riegel
2016-11-03  2:52               ` David Miller
2016-11-03 15:39                 ` Torvald Riegel
2016-11-03 17:22                   ` David Miller
2016-11-03 18:41                     ` Adhemerval Zanella
2016-11-03 20:33                       ` David Miller
2016-11-03 21:29                         ` Adhemerval Zanella
2016-11-03 22:25                         ` Torvald Riegel
2016-11-04 10:28                     ` Andreas Larsson
2016-11-04 15:23                       ` David Miller
2016-11-04 13:55                     ` Richard Henderson
2016-11-04 15:31                       ` David Miller
2016-11-04 16:10                         ` Richard Henderson
2016-11-04 14:04                     ` Richard Henderson

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=20161104.144427.831418313476119230.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=adhemerval.zanella@linaro.org \
    --cc=andreas@gaisler.com \
    --cc=carlos@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=software@gaisler.com \
    --cc=triegel@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).