Kernel quote of the week
Kernel quote of the week
Posted Jun 11, 2021 0:22 UTC (Fri) by ncm (guest, #165)Parent article: Kernel quote of the week
It was not long ago that Gcc obeyed the Standard requirements on volatile by issuing a load instruction immediately after each assignment to a volatile lvalue, because the assignment operation yields an rvalue that (they interpreted) requires an explicit load even if the result is immediately discarded. Writers of drivers for devices that would not tolerate an extra register read had to use an asm block. I don't doubt that Linus objected to that behavior, but I do doubt that the Standard was changed; rather, Gcc simply fell into line ignoring the requirement, like other compilers. Volatile has always had its own difficulties, and very rarely means what most using it hope.
I knew a core FreeBSD maintainer who insisted (and might still, if you asked) that a volatile flag was entirely sufficient to coordinate between threads on different cores, and firmly convinced our mutual employer. Good times.
Posted Jun 11, 2021 4:55 UTC (Fri)
by vtjnash (subscriber, #141755)
[Link] (1 responses)
I feel like I have clearly spent too much time attempting to learn about memory model details. And now on top of it, need to see if I can grok volatile_if someday.
Posted Jun 11, 2021 7:43 UTC (Fri)
by ncm (guest, #165)
[Link]
Kernel quote of the week
Kernel quote of the week
