From: Minfei Huang <mnghuan@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
luto@kernel.org, rkagan@virtuozzo.com
Subject: Re: [PATCH] pvclock: introduce seqcount-like API
Date: Sun, 12 Jun 2016 18:25:12 +0800 [thread overview]
Message-ID: <20160612102446.GB22854@localhost> (raw)
In-Reply-To: <1465471403-49372-1-git-send-email-pbonzini@redhat.com>
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
prev parent reply other threads:[~2016-06-12 10:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-09 11:23 [PATCH] pvclock: introduce seqcount-like API Paolo Bonzini
2016-06-09 12:43 ` Roman Kagan
2016-06-09 12:47 ` Paolo Bonzini
2016-06-09 13:35 ` Roman Kagan
2016-06-09 13:45 ` Paolo Bonzini
2016-06-09 17:12 ` Andy Lutomirski
2016-06-09 18:03 ` Paolo Bonzini
2016-06-09 18:08 ` Andy Lutomirski
2016-06-15 12:17 ` Paolo Bonzini
2016-06-12 10:25 ` Minfei Huang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160612102446.GB22854@localhost \
--to=mnghuan@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkagan@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).