[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87k0ghlbsk.fsf@oldenburg.str.redhat.com>
Date: Mon, 06 Dec 2021 21:26:51 +0100
From: Florian Weimer <fweimer@...hat.com>
To: "Paul E. McKenney via Libc-alpha" <libc-alpha@...rceware.org>
Cc: paulmck@...nel.org, Peter Zijlstra <peterz@...radead.org>,
Boqun Feng <boqun.feng@...il.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/5] nptl: Add rseq registration
* Paul E. McKenney via Libc-alpha:
>> The C memory model is broken and does not prevent out-of-thin-air
>> values. As far as I know, this breaks single-copy atomicity. In
>> practice, compilers will not exercise the latitude offered by the memory
>> model. volatile does not ensure absence of data races.
>
> Within the confines of the standard, agreed, use of the volatile keyword
> does not explicitly prevent data races.
>
> However, volatile accesses are (informally) defined to suffice for
> device-driver memory accesses that communicate with devices, whether via
> MMIO or DMA-style shared memory. The device-driver firmware is often
> written in C or C++. So doesn't this informal device-driver guarantee
> need to also do what is needed for userspace code that is communicating
> with kernel code? If not, why not?
The informal guarantee is probably good enough here, too. However, the
actual accesses are behind macros, and those macros use either
non-volatile plain reads or inline assembler (which use
single-instruction naturally aligned reads).
THanks,
Florian
Powered by blists - more mailing lists