[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aa6e44ab-e223-73aa-279e-8103732460ac@redhat.com>
Date: Sat, 17 Apr 2021 16:51:58 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>,
Wedson Almeida Filho <wedsonaf@...gle.com>
Cc: 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
Subject: Re: [PATCH 00/13] [RFC] Rust support
On 16/04/21 09:09, Peter Zijlstra wrote:
> Well, the obvious example would be seqlocks. C11 can't do them
Sure it can. C11 requires annotating with (the equivalent of) READ_ONCE
all reads of seqlock-protected fields, but the memory model supports
seqlocks just fine.
> Simlar thing for RCU; C11 can't optimally do that
Technically if you know what you're doing (i.e. that you're not on
Alpha) you can do RCU using a relaxed load followed by an
atomic_signal_fence(memory_order_consume). Which I agree is horrible
and not entirely within the standard, but it works in practice. The
Linux implementation of memory barriers, atomic RMW primitives,
load-acquire/store-release etc. is also completely outside the standard,
so it's not much different and more portable.
The only thing that I really, really miss when programming with C11
atomics is smp_mb__{before,after}_atomic().
Paolo
Powered by blists - more mailing lists