diff options
author | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2015-11-20 16:02:44 +0100 |
---|---|---|
committer | David Vrabel <david.vrabel@citrix.com> | 2015-12-21 15:41:00 +0100 |
commit | 2dd887e32175b624375570a0361083eb2cd64a07 (patch) | |
tree | b411b03467af88a5ffa2ec147a70c80d6a97c3a7 /drivers/xen/time.c | |
parent | xen/x86: convert remaining timespec to timespec64 in xen_pvclock_gtod_notify (diff) | |
download | linux-2dd887e32175b624375570a0361083eb2cd64a07.tar.xz linux-2dd887e32175b624375570a0361083eb2cd64a07.zip |
xen/time: use READ_ONCE
Use READ_ONCE through the code, rather than explicit barriers.
Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'drivers/xen/time.c')
-rw-r--r-- | drivers/xen/time.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/xen/time.c b/drivers/xen/time.c index 433fe247c5ff..71078425c9ea 100644 --- a/drivers/xen/time.c +++ b/drivers/xen/time.c @@ -25,7 +25,7 @@ static u64 get64(const u64 *p) if (BITS_PER_LONG < 64) { u32 *p32 = (u32 *)p; - u32 h, l; + u32 h, l, h2; /* * Read high then low, and then make sure high is @@ -34,15 +34,14 @@ static u64 get64(const u64 *p) * XXX some clean way to make this endian-proof? */ do { - h = p32[1]; - barrier(); - l = p32[0]; - barrier(); - } while (p32[1] != h); + h = READ_ONCE(p32[1]); + l = READ_ONCE(p32[0]); + h2 = READ_ONCE(p32[1]); + } while(h2 != h); ret = (((u64)h) << 32) | l; } else - ret = *p; + ret = READ_ONCE(*p); return ret; } @@ -66,9 +65,7 @@ void xen_get_runstate_snapshot(struct vcpu_runstate_info *res) */ do { state_time = get64(&state->state_entry_time); - barrier(); - *res = *state; - barrier(); + *res = READ_ONCE(*state); } while (get64(&state->state_entry_time) != state_time); } |