On 21 March 2014 14:51, Viresh Kumar viresh.kumar@linaro.org wrote:
@Catalin: We have a problem here and need your expert advice. After changing CPU frequency we need to call this code:
cpufreq_notify_post_transition(); policy->transition_ongoing = false;
And the sequence must be like this only. Is this guaranteed without any memory barriers? cpufreq_notify_post_transition() isn't touching transition_ongoing at all..
For others this is what we discussed on IRC (rmk: Russell King)
<rmk> I'm no barrier expert, but the compiler can't reorder that assignment across a function call which it knows nothing about (which it can't know anything about because it calls other functions through function pointers)
<rmk> however, the CPU could re-order the effects with respect to other agents (cpus/devices) when they look at the memory
<rmk> for the local CPU, the question is really: what does the C language virtual machine say about this - that's what really matters. If the CPU does speculative stuff, it still has to make the machine behaviour fit that model.