Re: [PATCH v2 0/2] pvclock: more code cleanup

From: Paolo Bonzini
Date: Mon Jun 27 2016 - 10:16:47 EST




On 15/06/2016 14:46, Paolo Bonzini wrote:
> Patch 1 simplifies the pvclock.h API by moving seqcount logic into
> two new functions pvclock_read_begin and pvclock_read_retry.
> Patch 2 uses the new simplified API in the vDSO.

Andy, I've now benchmarked the patches.

Patch 2 introduces no meaningful difference, however patch 1 makes
clock_gettime slower by about 3%. I can get this back with:

diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
index 0ee92db1e9f3..d019f0cc80ec 100644
--- a/arch/x86/include/asm/pvclock.h
+++ b/arch/x86/include/asm/pvclock.h
@@ -40,7 +40,7 @@ bool pvclock_read_retry(const struct pvclock_vcpu_time_info *src,
{
/* Make sure that the version is re-read after the data. */
virt_rmb();
- return version != src->version;
+ return unlikely(version != src->version);
}

/*


... which for whatever reason makes GCC inline more aggressively.
I'm going to send v3.

Paolo

> Paolo
>
> Paolo Bonzini (2):
> pvclock: introduce seqcount-like API
> x86: vdso: use __pvclock_read_cycles
>
> arch/x86/entry/vdso/vclock_gettime.c | 25 +++++------------------
> arch/x86/include/asm/pvclock.h | 39 +++++++++++++++++++++---------------
> arch/x86/kernel/pvclock.c | 17 ++++++----------
> 3 files changed, 34 insertions(+), 47 deletions(-)
>