Skip to content

Commit

Permalink
x86: pvclock: make sure rdtsc doesnt speculate out of region
Browse files Browse the repository at this point in the history
Originally from Jeremy Fitzhardinge.

pvclock_get_time_values, which contains the memory barriers
will be removed by next patch.

Signed-off-by: Marcelo Tosatti <[email protected]>
  • Loading branch information
matosatti committed Nov 28, 2012
1 parent 7069ed6 commit b01578d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/x86/kernel/pvclock.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src)

do {
version = pvclock_get_time_values(&shadow, src);
barrier();
rdtsc_barrier();
offset = pvclock_get_nsec_offset(&shadow);
ret = shadow.system_timestamp + offset;
barrier();
rdtsc_barrier();
} while (version != src->version);

if ((valid_flags & PVCLOCK_TSC_STABLE_BIT) &&
Expand Down

0 comments on commit b01578d

Please sign in to comment.