linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Roman Kagan <rkagan@virtuozzo.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	kvm list <kvm@vger.kernel.org>, Minfei Huang <mnghuan@gmail.com>,
	Andrew Lutomirski <luto@kernel.org>
Subject: Re: [PATCH] pvclock: introduce seqcount-like API
Date: Wed, 15 Jun 2016 14:17:09 +0200	[thread overview]
Message-ID: <d212c92f-3742-de4e-132f-f2311a8ba0aa@redhat.com> (raw)
In-Reply-To: <CALCETrVnN25Oza+-UQouc_pXD-W+A=d7SNLwCpih8BJxe=GL8Q@mail.gmail.com>



On 09/06/2016 20:08, Andy Lutomirski wrote:
> > __pvclock_read_cycles is pretty much the same as the code that is being
> > inlined.  Thus the only change is that __pvclock_read_cycles is called
> > inside the loop rather than outside, but the loop really is expected to
> > never roll so why make a copy in the first place?
>
> I feel like I had a reason, but I don't remember what it was.

I cannot see any substantial difference in the generated code with
this patch.  On the other hand, if I add this:

diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
index 0ee92db1e9f3..d019f0cc80ec 100644
--- a/arch/x86/include/asm/pvclock.h
+++ b/arch/x86/include/asm/pvclock.h
@@ -40,7 +40,7 @@ bool pvclock_read_retry(const struct pvclock_vcpu_time_info *src,
 {
 	/* Make sure that the version is re-read after the data. */
 	virt_rmb();
-	return version != src->version;
+	return unlikely(version != src->version);
 }
 
 /*

then vread_pvclock is inlined everywhere, which bloats the code somewhat (+80
code bytes).  Do you want me to mark vread_pvclock as noinline too?

Paolo

  reply	other threads:[~2016-06-15 12:17 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 [this message]
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=d212c92f-3742-de4e-132f-f2311a8ba0aa@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --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).