summaryrefslogtreecommitdiffstats
path: root/arch/x86/entry
diff options
context:
space:
mode:
authorPaolo Bonzini2016-06-09 13:06:08 +0200
committerPaolo Bonzini2016-08-04 13:52:21 +0200
commit3aed64f6d341cdb62bb2d6232589fb13448ce063 (patch)
tree33c7906993c84a861d4575a19a667bb5d8749046 /arch/x86/entry
parentRevert "ACPI / hotplug / PCI: Runtime resume bridge before rescan" (diff)
downloadkernel-qcow2-linux-3aed64f6d341cdb62bb2d6232589fb13448ce063.tar.gz
kernel-qcow2-linux-3aed64f6d341cdb62bb2d6232589fb13448ce063.tar.xz
kernel-qcow2-linux-3aed64f6d341cdb62bb2d6232589fb13448ce063.zip
pvclock: introduce seqcount-like API
The version field in struct pvclock_vcpu_time_info basically implements a seqcount. Wrap it with the usual read_begin and read_retry functions, and use these APIs instead of peppering the code with smp_rmb()s. While at it, change it to the more pedantically correct virt_rmb(). With this change, __pvclock_read_cycles can be simplified noticeably. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/entry')
-rw-r--r--arch/x86/entry/vdso/vclock_gettime.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/arch/x86/entry/vdso/vclock_gettime.c b/arch/x86/entry/vdso/vclock_gettime.c
index 2f02d23a05ef..db1e3b4c3693 100644
--- a/arch/x86/entry/vdso/vclock_gettime.c
+++ b/arch/x86/entry/vdso/vclock_gettime.c
@@ -123,9 +123,7 @@ static notrace cycle_t vread_pvclock(int *mode)
*/
do {
- version = pvti->version;
-
- smp_rmb();
+ version = pvclock_read_begin(pvti);
if (unlikely(!(pvti->flags & PVCLOCK_TSC_STABLE_BIT))) {
*mode = VCLOCK_NONE;
@@ -137,10 +135,7 @@ static notrace cycle_t vread_pvclock(int *mode)
pvti_tsc_shift = pvti->tsc_shift;
pvti_system_time = pvti->system_time;
pvti_tsc = pvti->tsc_timestamp;
-
- /* Make sure that the version double-check is last. */
- smp_rmb();
- } while (unlikely((version & 1) || version != pvti->version));
+ } while (pvclock_read_retry(pvti, version));
delta = tsc - pvti_tsc;
ret = pvti_system_time +