[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d325e811-c80d-49ba-85cf-06893cec659a@intel.com>
Date: Thu, 7 Mar 2024 13:48:55 +1300
From: "Huang, Kai" <kai.huang@...el.com>
To: Sean Christopherson <seanjc@...gle.com>, Paolo Bonzini
<pbonzini@...hat.com>
CC: <kvm@...r.kernel.org>, <linux-kernel@...r.kernel.org>, Yan Zhao
<yan.y.zhao@...el.com>, Isaku Yamahata <isaku.yamahata@...el.com>, "Michael
Roth" <michael.roth@....com>, Yu Zhang <yu.c.zhang@...ux.intel.com>, "Chao
Peng" <chao.p.peng@...ux.intel.com>, Fuad Tabba <tabba@...gle.com>, "David
Matlack" <dmatlack@...gle.com>
Subject: Re: [PATCH 13/16] KVM: x86/mmu: Handle no-slot faults at the
beginning of kvm_faultin_pfn()
On 28/02/2024 3:41 pm, Sean Christopherson wrote:
> Handle the "no memslot" case at the beginning of kvm_faultin_pfn(), just
> after the private versus shared check, so that there's no need to
> repeatedly query whether or not a slot exists. This also makes it more
> obvious that, except for private vs. shared attributes, the process of
> faulting in a pfn simply doesn't apply to gfns without a slot.
>
> Opportunistically stuff @fault's metadata in kvm_handle_noslot_fault() so
> that it doesn't need to be duplicated in all paths that invoke
> kvm_handle_noslot_fault(), and to minimize the probability of not stuffing
> the right fields.
>
> Leave the existing handle behind, but convert it to a WARN, to guard
> against __kvm_faultin_pfn() unexpectedly nullifying fault->slot.
>
> Cc: David Matlack <dmatlack@...gle.com>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
Reviewed-by: Kai Huang <kai.huang@...el.com>
One nit ...
> --- a/arch/x86/kvm/mmu/mmu_internal.h
> +++ b/arch/x86/kvm/mmu/mmu_internal.h
> @@ -235,7 +235,7 @@ struct kvm_page_fault {
> /* The memslot containing gfn. May be NULL. */
> struct kvm_memory_slot *slot;
>
> - /* Outputs of kvm_faultin_pfn. */
> + /* Outputs of kvm_faultin_pfn. */
> unsigned long mmu_seq;
> kvm_pfn_t pfn;
> hva_t hva;
.. how about get rid of this non-related fix?
Yeah it's annoying but do in a separate patch?
Powered by blists - more mailing lists