Re: [PATCH 3/3 V2] pvclock: Get rid of __pvclock_read_cycles in function pvclock_read_flags

From: Paolo Bonzini
Date: Thu Jun 09 2016 - 08:31:26 EST




On 09/06/2016 13:28, Borislav Petkov wrote:
>> > technically, they should be virt_rmb() -- it really doesn't matter of
>> > course because reads are never reordered on x86.
> You mean
>
> version = src->version;
> flags = src->flags;
>
> are not reordered?
>
> I don't think so.

The compiler can reorder them, so smp_rmb() and virt_rmb() have to be
barrier(), but the processor won't.

x86 will only move a store after a subsequent load, if you exclude
special cases such as write combining, non-temporal moves and the like.
LFENCE and SFENCE are only needed for those special cases.

Paolo