Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1420220

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

From Minfei Huang <mnghuan@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] pvclock: introduce seqcount-like API
Date 2016-06-12 12:30 +0200
Message-ID <rJaOu-7sW-13@gated-at.bofh.it> (permalink)
References <rI6jT-5Fr-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@redhat.com>
> ---
>  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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] pvclock: introduce seqcount-like API Paolo Bonzini <pbonzini@redhat.com> - 2016-06-09 13:30 +0200
  Re: [PATCH] pvclock: introduce seqcount-like API Paolo Bonzini <pbonzini@redhat.com> - 2016-06-09 14:50 +0200
    Re: [PATCH] pvclock: introduce seqcount-like API Roman Kagan <rkagan@virtuozzo.com> - 2016-06-09 15:40 +0200
      Re: [PATCH] pvclock: introduce seqcount-like API Paolo Bonzini <pbonzini@redhat.com> - 2016-06-09 15:50 +0200
        Re: [PATCH] pvclock: introduce seqcount-like API Andy Lutomirski <luto@amacapital.net> - 2016-06-09 19:20 +0200
          Re: [PATCH] pvclock: introduce seqcount-like API Paolo Bonzini <pbonzini@redhat.com> - 2016-06-09 20:10 +0200
            Re: [PATCH] pvclock: introduce seqcount-like API Andy Lutomirski <luto@amacapital.net> - 2016-06-09 20:10 +0200
              Re: [PATCH] pvclock: introduce seqcount-like API Paolo Bonzini <pbonzini@redhat.com> - 2016-06-15 14:20 +0200
  Re: [PATCH] pvclock: introduce seqcount-like API Minfei Huang <mnghuan@gmail.com> - 2016-06-12 12:30 +0200

csiph-web