kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Matlack <dmatlack@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>,
	Borislav Petkov <bp@suse.de>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	kvm list <kvm@vger.kernel.org>
Subject: Re: [PATCH 9/9] KVM: x86/mmu: Try to handle no-slot faults during kvm_faultin_pfn()
Date: Mon, 15 Aug 2022 16:09:08 -0700	[thread overview]
Message-ID: <CALzav=eaH_5QnUhhRq17yP-E2DAKxtMgtv7pAgCy5qDL-7xxDw@mail.gmail.com> (raw)
In-Reply-To: <20220815230110.2266741-10-dmatlack@google.com>

On Mon, Aug 15, 2022 at 4:01 PM David Matlack <dmatlack@google.com> wrote:
>
> Try to handle faults on GFNs that do not have a backing memslot during
> kvm_faultin_pfn(), rather than relying on the caller to call
> handle_abnormal_pfn() right after kvm_faultin_pfn(). This reduces all of
> the page fault paths by eliminating duplicate code.
>
> Opportunistically tweak the comment about handling gfn > host.MAXPHYADDR
> to reflect that the effect of returning RET_PF_EMULATE at that point is
> to avoid creating an MMIO SPTE for such GFNs.
>
> No functional change intended.
>
> Signed-off-by: David Matlack <dmatlack@google.com>
> ---
>  arch/x86/kvm/mmu/mmu.c         | 55 +++++++++++++++++-----------------
>  arch/x86/kvm/mmu/paging_tmpl.h |  4 ---
>  2 files changed, 27 insertions(+), 32 deletions(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
[...]
> @@ -4181,6 +4185,9 @@ static int kvm_faultin_pfn(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)
>         if (unlikely(is_error_pfn(fault->pfn)))
>                 return kvm_handle_error_pfn(fault);
>
> +       if (unlikely(!fault->slot))
> +               return kvm_handle_noslot_fault(vcpu, fault, ACC_ALL);

This is broken. This needs to be pte_access for the shadow paging
case, not ACC_ALL. I remember now I had that in an earlier version but
it got lost at some point when I was rebasing locally.

  reply	other threads:[~2022-08-16  2:45 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15 23:01 [PATCH 0/9] KVM: x86/mmu: Always enable the TDP MMU when TDP is enabled David Matlack
2022-08-15 23:01 ` [PATCH 1/9] " David Matlack
2022-08-17 10:05   ` Paolo Bonzini
2022-08-17 16:49     ` David Matlack
2022-08-17 16:53       ` Paolo Bonzini
2022-08-17 17:46         ` David Matlack
2022-08-15 23:01 ` [PATCH 2/9] KVM: x86/mmu: Drop kvm->arch.tdp_mmu_enabled David Matlack
2022-08-24 14:21   ` kernel test robot
2022-08-15 23:01 ` [PATCH 3/9] KVM: x86/mmu: Consolidate mmu_seq calculations in kvm_faultin_pfn() David Matlack
2022-08-15 23:01 ` [PATCH 4/9] KVM: x86/mmu: Rename __direct_map() to nonpaging_map() David Matlack
2022-08-15 23:01 ` [PATCH 5/9] KVM: x86/mmu: Separate TDP and non-paging fault handling David Matlack
2022-08-24 17:06   ` kernel test robot
2022-08-15 23:01 ` [PATCH 6/9] KVM: x86/mmu: Stop needlessly making MMU pages available for TDP MMU faults David Matlack
2022-08-15 23:01 ` [PATCH 7/9] KVM: x86/mmu: Handle "error PFNs" in kvm_faultin_pfn() David Matlack
2022-08-15 23:01 ` [PATCH 8/9] KVM: x86/mmu: Avoid memslot lookup during KVM_PFN_ERR_HWPOISON handling David Matlack
2022-08-15 23:01 ` [PATCH 9/9] KVM: x86/mmu: Try to handle no-slot faults during kvm_faultin_pfn() David Matlack
2022-08-15 23:09   ` David Matlack [this message]
2022-08-16  8:16 ` [PATCH 0/9] KVM: x86/mmu: Always enable the TDP MMU when TDP is enabled Peter Zijlstra
2022-08-16 16:30   ` David Matlack
2022-08-17  8:53     ` Peter Zijlstra
2022-08-17 10:01     ` Huang, Kai
2022-08-17 16:42       ` David Matlack
2022-08-17 23:36         ` Huang, Kai
2022-08-16 22:54 ` David Matlack

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='CALzav=eaH_5QnUhhRq17yP-E2DAKxtMgtv7pAgCy5qDL-7xxDw@mail.gmail.com' \
    --to=dmatlack@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@suse.de \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=keescook@chromium.org \
    --cc=kvm@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=seanjc@google.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).