From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86/mmu: Avoid retpoline on ->page_fault() with TDP
Date: Wed, 12 Feb 2020 08:22:20 -0800 [thread overview]
Message-ID: <20200212162220.GA15617@linux.intel.com> (raw)
In-Reply-To: <408bfd4c-7407-48cd-95fb-db44a7c1c2bf@redhat.com>
On Wed, Feb 12, 2020 at 12:55:09PM +0100, Paolo Bonzini wrote:
> On 07/02/20 16:55, Sean Christopherson wrote:
> > It becomes a matter of weighing the maintenance cost and robustness against
> > the performance benefits. For the TDP case, amost no one (that cares about
> > performance) uses shadow paging, the change is very explicit, tiny and
> > isolated, and TDP page fault are a hot path, e.g. when booting the VM.
> > I.e. low maintenance overhead, still robust, and IMO worth the shenanigans.
>
> The "NULL" trick does not seem needed though. Any objections to this?
Nope, no objections.
> diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
> index 9277ee8a54a5..a647601c9e1c 100644
> --- a/arch/x86/kvm/mmu.h
> +++ b/arch/x86/kvm/mmu.h
> @@ -109,7 +109,7 @@ static inline int kvm_mmu_do_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
> u32 err, bool prefault)
> {
> #ifdef CONFIG_RETPOLINE
> - if (likely(!vcpu->arch.mmu->page_fault))
> + if (likely(vcpu->arch.mmu->page_fault == kvm_tdp_page_fault))
> return kvm_tdp_page_fault(vcpu, cr2_or_gpa, err, prefault);
> #endif
> return vcpu->arch.mmu->page_fault(vcpu, cr2_or_gpa, err, prefault);
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index 5267f1440677..87e9ba27ada1 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -4925,12 +4925,7 @@ static void init_kvm_tdp_mmu(struct kvm_vcpu *vcpu)
> return;
>
> context->mmu_role.as_u64 = new_role.as_u64;
> -#ifdef CONFIG_RETPOLINE
> - /* Nullify ->page_fault() to use direct kvm_tdp_page_fault() call. */
> - context->page_fault = NULL;
> -#else
> context->page_fault = kvm_tdp_page_fault;
> -#endif
> context->sync_page = nonpaging_sync_page;
> context->invlpg = nonpaging_invlpg;
> context->update_pte = nonpaging_update_pte;
>
> Paolo
>
prev parent reply other threads:[~2020-02-12 16:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-06 22:14 Sean Christopherson
2020-02-07 9:29 ` Vitaly Kuznetsov
2020-02-07 15:55 ` Sean Christopherson
2020-02-07 16:15 ` Vitaly Kuznetsov
2020-02-12 11:55 ` Paolo Bonzini
2020-02-12 16:22 ` Sean Christopherson [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=20200212162220.GA15617@linux.intel.com \
--to=sean.j.christopherson@intel.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.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
Powered by JetHome