Messages in this thread | | | From | Florian Weimer <> | Subject | Re: [PATCH 2/5] nptl: Add rseq registration | Date | Mon, 06 Dec 2021 21:26:51 +0100 |
| |
* 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
| |