x86: pvclock: make sure rdtsc doesnt speculate out of region

Originally from Jeremy Fitzhardinge.

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

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
Marcelo Tosatti 2012-11-27 23:28:49 -02:00
parent 7069ed6763
commit b01578de45
1 changed files with 2 additions and 2 deletions

View File

@ -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) &&