From: Davidlohr Bueso <dave@gnu.org>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
lkml <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: x86: add paging gcc optimization
Date: Thu, 08 Mar 2012 12:40:31 +0100 [thread overview]
Message-ID: <1331206831.28711.0.camel@offworld> (raw)
In-Reply-To: <4F587FB6.1070803@redhat.com>
On Thu, 2012-03-08 at 11:45 +0200, Avi Kivity wrote:
> On 03/07/2012 10:02 PM, Davidlohr Bueso wrote:
> > From: Davidlohr Bueso <dave@gnu.org>
> >
> > Since most guests will have paging enabled for memory management, add likely() and unlikely()
> > optimizations around is_paging() checks.
> >
> > Signed-off-by: Davidlohr Bueso <dave@gnu.org>
> > ---
> > arch/x86/kvm/mmu.c | 6 +++---
> > arch/x86/kvm/svm.c | 6 +++---
> > arch/x86/kvm/vmx.c | 16 ++++++++--------
> > arch/x86/kvm/x86.c | 8 ++++----
> > 4 files changed, 18 insertions(+), 18 deletions(-)
> >
> > diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> > index 4cb1642..84f1e95 100644
> > --- a/arch/x86/kvm/mmu.c
> > +++ b/arch/x86/kvm/mmu.c
> > @@ -3320,7 +3320,7 @@ static int init_kvm_tdp_mmu(struct kvm_vcpu *vcpu)
> > context->get_pdptr = kvm_pdptr_read;
> > context->inject_page_fault = kvm_inject_page_fault;
> >
> > - if (!is_paging(vcpu)) {
> > + if (unlikely(!is_paging(vcpu))) {
> >
>
> Just change is_paging itself():
Ok, yes, makes more sense. I'll resend the patch.
Thanks.
>
> static inline int is_paging(struct kvm_vcpu *vcpu)
> {
> - return kvm_read_cr0_bits(vcpu, X86_CR0_PG);
> + return likely(kvm_read_cr0_bits(vcpu, X86_CR0_PG));
> }
>
prev parent reply other threads:[~2012-03-08 10:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-07 20:02 [PATCH] KVM: x86: add paging gcc optimization Davidlohr Bueso
2012-03-08 9:45 ` Avi Kivity
2012-03-08 11:40 ` Davidlohr Bueso [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=1331206831.28711.0.camel@offworld \
--to=dave@gnu.org \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.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