lkml.org 
[lkml]   [2021]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 2/5] nptl: Add rseq registration
Date
* 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

\
 
 \ /
  Last update: 2021-12-06 21:27    [W:0.045 / U:1.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site