[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240307013450.GE368614@ls.amr.corp.intel.com>
Date: Wed, 6 Mar 2024 17:34:50 -0800
From: Isaku Yamahata <isaku.yamahata@...ux.intel.com>
To: David Matlack <dmatlack@...gle.com>
Cc: isaku.yamahata@...el.com, kvm@...r.kernel.org, isaku.yamahata@...il.com,
linux-kernel@...r.kernel.org,
Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Michael Roth <michael.roth@....com>,
Federico Parola <federico.parola@...ito.it>,
isaku.yamahata@...ux.intel.com
Subject: Re: [RFC PATCH 6/8] KVM: x86: Implement kvm_arch_{,
pre_}vcpu_map_memory()
On Wed, Mar 06, 2024 at 04:30:58PM -0800,
David Matlack <dmatlack@...gle.com> wrote:
> On 2024-03-01 09:28 AM, isaku.yamahata@...el.com wrote:
> > From: Isaku Yamahata <isaku.yamahata@...el.com>
> >
> > Wire KVM_MAP_MEMORY ioctl to kvm_mmu_map_tdp_page() to populate guest
> > memory.
> >
> > Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>
> > ---
> > arch/x86/kvm/x86.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 49 insertions(+)
> >
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > index 3b8cb69b04fa..6025c0e12d89 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> > @@ -4660,6 +4660,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> > case KVM_CAP_VM_DISABLE_NX_HUGE_PAGES:
> > case KVM_CAP_IRQFD_RESAMPLE:
> > case KVM_CAP_MEMORY_FAULT_INFO:
> > + case KVM_CAP_MAP_MEMORY:
> > r = 1;
> > break;
> > case KVM_CAP_EXIT_HYPERCALL:
> > @@ -5805,6 +5806,54 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
> > }
> > }
> >
> > +int kvm_arch_vcpu_pre_map_memory(struct kvm_vcpu *vcpu)
> > +{
> > + return kvm_mmu_reload(vcpu);
> > +}
>
> Why is the here and not kvm_arch_vcpu_map_memory()?
We can push down kvm_mmu_relaod into kvm_arch_vcpu_map_memory() under gpa loop.
Probably the inefficiency won't matter.
kvm_mmu_realod()
loop on gpa
kvm_arch_vcpu_map_memory()
=>
loop on gpa
kvm_arch_vcpu_map_memory()
kvm_mmu_reload()
--
Isaku Yamahata <isaku.yamahata@...ux.intel.com>
Powered by blists - more mailing lists