[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YH1Ayc6UncJ32uQZ@hirez.programming.kicks-ass.net>
Date: Mon, 19 Apr 2021 10:35:21 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: Wedson Almeida Filho <wedsonaf@...gle.com>, ojeda@...nel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
rust-for-linux@...r.kernel.org, linux-kbuild@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
Will Deacon <will@...nel.org>
Subject: Re: [PATCH 00/13] [RFC] Rust support
On Mon, Apr 19, 2021 at 10:26:57AM +0200, Peter Zijlstra wrote:
> https://godbolt.org/z/85xoPxeE5
That wants _Atomic on the seq definition for clang.
> void writer(void)
> {
> atomic_store_explicit(&seq, seq+1, memory_order_relaxed);
> atomic_thread_fence(memory_order_acquire);
>
> X = 1;
> Y = 2;
>
> atomic_store_explicit(&seq, seq+1, memory_order_release);
> }
>
> gives:
>
> writer:
> adrp x1, .LANCHOR0
> add x0, x1, :lo12:.LANCHOR0
> ldr w2, [x1, #:lo12:.LANCHOR0]
> add w2, w2, 1
> str w2, [x0]
> dmb ishld
> ldr w1, [x1, #:lo12:.LANCHOR0]
> mov w3, 1
> mov w2, 2
> stp w3, w2, [x0, 4]
> add w1, w1, w3
> stlr w1, [x0]
> ret
>
> Which, afaict, is completely buggered. What it seems to be doing is
> turning the seq load into a load-acquire, but what we really need is to
> make sure the seq store (increment) is ordered before the other stores.
Put differently, what you seem to want is store-acquire, but there ain't
no such thing.
Powered by blists - more mailing lists