>>> On 05.10.15 at 15:18, <george.dun...@citrix.com> wrote: > On 02/10/15 05:40, Juergen Gross wrote: >> Use a bit mask for testing of a set bit instead of test_bit in case no >> atomic operation is needed, as this will lead to smaller and more >> effective code. >> >> Signed-off-by: Juergen Gross <jgr...@suse.com> > > I'm a bit confused here -- exactly when is an atomic operation needed or > not needed? Isn't it the case that we always need to do an atomic read > if we ever do an atomic write without a lock held?
First of all - what is an atomic read from CPU perspective other than just a read? Since we talk about individual bits here, we don't care about the granularity the compiler may convert the read to, and even if the compiler chose to do multiple reads the result would still be correct, as only one of those reads can possibly have read the bit in question. And then, the old mechanism was in no way "atomic", all it added was a kind of compiler barrier (due to the cast to volatile). Yet in none of the cases changed I was able to spot a need for such a barrier. Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel