From: Roman Kagan <rkagan@virtuozzo.com>
To: Borislav Petkov <bp@suse.de>
Cc: Minfei Huang <mnghuan@gmail.com>, <linux-kernel@vger.kernel.org>,
"Denis V. Lunev" <den@openvz.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
<x86@kernel.org>, Andy Lutomirski <luto@kernel.org>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH] x86:pvclock: add missing barriers
Date: Thu, 9 Jun 2016 13:29:30 +0300 [thread overview]
Message-ID: <20160609102929.GA2570@rkaganb.sw.ru> (raw)
In-Reply-To: <20160608210112.GA6735@rkaganip>
On Thu, Jun 09, 2016 at 12:01:13AM +0300, Roman Kagan wrote:
> On Wed, Jun 08, 2016 at 09:45:09PM +0200, Borislav Petkov wrote:
> > On Wed, Jun 08, 2016 at 09:11:39PM +0300, Roman Kagan wrote:
> > > --- a/arch/x86/include/asm/pvclock.h
> > > +++ b/arch/x86/include/asm/pvclock.h
> > > @@ -80,18 +80,11 @@ static __always_inline
> > > unsigned __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src,
> > > cycle_t *cycles, u8 *flags)
> > > {
> > > - unsigned version;
> > > - cycle_t ret, offset;
> > > - u8 ret_flags;
> > > -
> > > - version = src->version;
> > > -
> > > - offset = pvclock_get_nsec_offset(src);
> > > - ret = src->system_time + offset;
> > > - ret_flags = src->flags;
> > > -
> > > - *cycles = ret;
> > > - *flags = ret_flags;
> > > + unsigned version = src->version;
> > > + barrier();
> > > + *cycles = src->system_time + pvclock_get_nsec_offset(src);
> > > + *flags = src->flags;
> > > + barrier();
> > > return version;
> >
> > I have a similar patchset in my mbox starting here:
> >
> > https://lkml.kernel.org/r/1464329832-4638-1-git-send-email-mnghuan@gmail.com
> >
> > Care to take a look?
>
> Just did, thanks for the link.
>
> The difference is whether you want the reader to see consistent view of
> the pvclock data (as in my patch) or also the most up to date one
> (as in Minfei Huang's patch) at the cost of extra lfence instructions
> (on my machine this is 30% slowdown).
Sorry, I should have looked better. Minfei's patch inserts smb_rmb()-s
which on x86 are just barrier()-s, so that patch results in the code
equivalent to mine. So I'll jump onto that thread instead of pursuing
this one.
Roman.
next prev parent reply other threads:[~2016-06-09 10:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-08 18:11 [PATCH] x86:pvclock: add missing barriers Roman Kagan
2016-06-08 19:45 ` Borislav Petkov
2016-06-08 21:01 ` Roman Kagan
2016-06-09 10:29 ` Roman Kagan [this message]
2016-06-12 10:02 ` 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=20160609102929.GA2570@rkaganb.sw.ru \
--to=rkagan@virtuozzo.com \
--cc=bp@suse.de \
--cc=den@openvz.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=mnghuan@gmail.com \
--cc=pbonzini@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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).