linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Roman Kagan <rkagan@virtuozzo.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	mnghuan@gmail.com, luto@kernel.org
Subject: Re: [PATCH] pvclock: introduce seqcount-like API
Date: Thu, 9 Jun 2016 15:45:37 +0200	[thread overview]
Message-ID: <8c422861-ab1e-ccdc-70e4-8517416e93f4@redhat.com> (raw)
In-Reply-To: <20160609133529.GA5400@rkaganb.sw.ru>



On 09/06/2016 15:35, Roman Kagan wrote:
> On Thu, Jun 09, 2016 at 02:47:54PM +0200, Paolo Bonzini wrote:
>> On 09/06/2016 14:43, Roman Kagan wrote:
>>> On Thu, Jun 09, 2016 at 01:23:23PM +0200, 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.
>>>>
>>>> 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(-)
>>> [...]
>>>> --- a/arch/x86/include/asm/pvclock.h
>>>> +++ b/arch/x86/include/asm/pvclock.h
>>> [...]
>>>> @@ -69,23 +87,12 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift)
>>>>  }
>>>>  
>>>>  static __always_inline
>>>> -unsigned __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src,
>>>> -			       cycle_t *cycles, u8 *flags)
>>>> +cycle_t __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src)
>>>>  {
>>>> -	unsigned version;
>>>> -	cycle_t offset;
>>>> -	u64 delta;
>>>> -
>>>> -	version = src->version;
>>>> -	/* Make the latest version visible */
>>>> -	smp_rmb();
>>>
>>> This is on top of Minfei's patch, right?  It isn't in Linus' tree yet so
>>> I wonder if it makes sense to merge the two patches into one.
>>>
>>> Will you post it to stable, too?
>>
>> Not this one, because Minfei's patch is enough to fix the bug, but I do
> 
> Has it landed in any public tree?  I'm unable to find any.  There
> appears to be another version of the patch on the list, so I'm confused.

I'm about to push it to kvm/master.

Paolo

  reply	other threads:[~2016-06-09 13:45 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 [this message]
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

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=8c422861-ab1e-ccdc-70e4-8517416e93f4@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mnghuan@gmail.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).