Re: [PATCH] pvclock: introduce seqcount-like API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/09/16 at 01:23P, Paolo Bonzini wrote:
> 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.

Hi, Paolo.

Thanks for accepting my patches in your repo.

> 
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> ---
>  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(-)
> 
> diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
> index 7c1c89598688..0ee92db1e9f3 100644
> --- a/arch/x86/include/asm/pvclock.h
> +++ b/arch/x86/include/asm/pvclock.h
> @@ -25,6 +25,24 @@ void pvclock_resume(void);
>  
>  void pvclock_touch_watchdogs(void);
>  
> +static __always_inline
> +unsigned pvclock_read_begin(const struct pvclock_vcpu_time_info *src)

It's better to use type unsigned int, instead of unsigned which is
complained by script checkpatch.

Thanks
Minfei

> +{
> +	unsigned version = src->version & ~1;

Ditto.

> +	/* Make sure that the version is read before the data. */
> +	virt_rmb();
> +	return version;
> +}
> +
> +static __always_inline
> +bool pvclock_read_retry(const struct pvclock_vcpu_time_info *src,
> +			unsigned version)

Ditto.

Thanks
Minfei
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux