All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Paul E. McKenney" <paulmck@kernel.org>,
	"John Paul Adrian Glaubitz" <glaubitz@physik.fu-berlin.de>
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Linux-Arch <linux-arch@vger.kernel.org>,
	linux-alpha@vger.kernel.org,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Ivan Kokshaysky" <ink@jurassic.park.msu.ru>,
	"Matt Turner" <mattst88@gmail.com>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>
Subject: Re: [GIT PULL] alpha: cleanups and build fixes for 6.10
Date: Sat, 11 May 2024 22:08:50 +0200	[thread overview]
Message-ID: <8dd1c466-54e3-45c1-a19f-f81dd9dbf243@app.fastmail.com> (raw)
In-Reply-To: <a1331c86-dc07-4635-b169-623fcdd11824@paulmck-laptop>

On Sat, May 11, 2024, at 21:37, Paul E. McKenney wrote:
> On Sat, May 11, 2024 at 08:49:08PM +0200, John Paul Adrian Glaubitz wrote:
>
> The pre-EV56 Alphas have no byte store instruction, correct?
>
> If that is in fact correct, what code is generated for a volatile store
> to a single byte for those CPUs?  For example, for this example?
>
> 	char c;
>
> 	...
>
> 	WRITE_ONCE(c, 3);
>
> The rumor I heard is that the compilers will generate a non-atomic
> read-modify-write instruction sequence in this case, first reading the
> 32-bit word containing that byte into a register, then substituting the
> value to be stored into corresponding byte of that register, and finally
> doing a 32-bit store from that register.
>
> Is that the case, or am I confused?

I think it's slightly worse: gcc will actually do a 64-bit
read-modify-write rather than a 32-bit one, and it doesn't
use atomic ll/sc when storing into an _Atomic struct member:

echo '#include <stdatomic.h>^M struct s { _Atomic char c; _Atomic char s[7]; long l; }; void f(struct s *s) { atomic_store(&s->c, 3); }' | alpha-linux-gcc-14  -xc - -S -o- -O2 -mcpu=ev5

f:
	.frame $30,0,$26,0
$LFB0:
	.cfi_startproc
	.prologue 0
	mb
	lda $1,3($31)
	insbl $1,$16,$1
	ldq_u $2,0($16)
	mskbl $2,$16,$2
	bis $1,$2,$1
	stq_u $1,0($16)
	bis $31,$31,$31
	mb
	ret $31,($26),1
	.cfi_endproc
$LFE0:
	.end f

compared to -mcpu=ev56:

f:
	.frame $30,0,$26,0
$LFB0:
	.cfi_startproc
	.prologue 0
	mb
	lda $1,3($31)
	stb $1,0($16)
	bis $31,$31,$31
	mb
	ret $31,($26),1
	.cfi_endproc
$LFE0:
	.end f

      Arnd

  reply	other threads:[~2024-05-11 20:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10 21:17 [GIT PULL] asm-generic cleanups for 6.10 Arnd Bergmann
2024-05-10 21:19 ` [GIT PULL] alpha: cleanups and build fixes " Arnd Bergmann
2024-05-10 21:40   ` John Paul Adrian Glaubitz
2024-05-10 22:28     ` Paul E. McKenney
2024-05-11 18:49       ` John Paul Adrian Glaubitz
2024-05-11 19:37         ` Paul E. McKenney
2024-05-11 20:08           ` Arnd Bergmann [this message]
2024-05-12  1:26             ` Paul E. McKenney
2024-05-12  6:02               ` John Paul Adrian Glaubitz
2024-05-12 14:44                 ` Paul E. McKenney
2024-05-13  3:50                   ` Akira Yokosawa
2024-05-13  4:03                     ` Paul E. McKenney
2024-05-13  6:28                       ` Arnd Bergmann
2024-05-13  9:26                     ` John Paul Adrian Glaubitz
2024-05-13 16:52                     ` Ulrich Teichert
2024-05-13 21:44                       ` John Paul Adrian Glaubitz
2024-05-13  7:10                   ` John Paul Adrian Glaubitz
2024-05-12  6:17   ` John Paul Adrian Glaubitz
2024-05-13 16:27   ` Linus Torvalds
2024-05-13 21:42     ` John Paul Adrian Glaubitz
2024-05-13 17:05   ` pr-tracker-bot
2024-05-13 16:11 ` [GIT PULL] asm-generic cleanups " Linus Torvalds
2024-05-13 16:36   ` Arnd Bergmann
2024-05-20 22:35 ` pr-tracker-bot

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=8dd1c466-54e3-45c1-a19f-f81dd9dbf243@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=ink@jurassic.park.msu.ru \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mattst88@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=richard.henderson@linaro.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.