Re: [PATCH 1/1] Fix: trace sched switch start/stop racy updates

From: Valentin Schneider
Date: Mon Aug 19 2019 - 06:34:52 EST




On 18/08/2019 00:00, Paul E. McKenney wrote:
[...]
> Linus noted that he believes that compilers for architectures supporting
> Linux can be trusted to avoid store-to-load transformations, invented
> stores, and unnecessary store tearing. Should these appear, Linus would
> report a bug against the compiler and expect it to be fixed.
>
>> I'll be honest, it's not 100% clear to me when those optimizations can
>> actually be done (maybe the branch thingy but the others are dubious), and
>> it's even less clear when compilers *actually* do it - only that they have
>> been reported to do it (so it's not made up).
>
> There is significant unclarity inherent in the situation. The standard
> says one thing, different compilers do other things, and developers
> often expect yet a third thing. And sometimes things change over time,
> for example, the ca. 2011 dictim against compilers inventing data races.
>
> Hey, they didn't teach me this aspect of software development in school,
> either. ;-)
>

Gotta keeps things "interesting" somehow, eh...

Thanks for the clarifications.

> Thanx, Paul
>