[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200930232429.GA2988@linux.intel.com>
Date: Wed, 30 Sep 2020 16:24:29 -0700
From: Sean Christopherson <sean.j.christopherson@...el.com>
To: Ben Gardon <bgardon@...gle.com>
Cc: LKML <linux-kernel@...r.kernel.org>, kvm <kvm@...r.kernel.org>,
Cannon Matthews <cannonmatthews@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Peter Xu <peterx@...hat.com>, Peter Shier <pshier@...gle.com>,
Peter Feiner <pfeiner@...gle.com>,
Junaid Shahid <junaids@...gle.com>,
Jim Mattson <jmattson@...gle.com>,
Yulei Zhang <yulei.kernel@...il.com>,
Wanpeng Li <kernellwp@...il.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Xiao Guangrong <xiaoguangrong.eric@...il.com>
Subject: Re: [PATCH 13/22] kvm: mmu: Support invalidate range MMU notifier
for TDP MMU
On Wed, Sep 30, 2020 at 04:15:17PM -0700, Ben Gardon wrote:
> On Wed, Sep 30, 2020 at 10:04 AM Sean Christopherson
> <sean.j.christopherson@...el.com> wrote:
> > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> > > index 52d661a758585..0ddfdab942554 100644
> > > --- a/arch/x86/kvm/mmu/mmu.c
> > > +++ b/arch/x86/kvm/mmu/mmu.c
> > > @@ -1884,7 +1884,14 @@ static int kvm_handle_hva(struct kvm *kvm, unsigned long hva,
> > > int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end,
> > > unsigned flags)
> > > {
> > > - return kvm_handle_hva_range(kvm, start, end, 0, kvm_unmap_rmapp);
> > > + int r;
> > > +
> > > + r = kvm_handle_hva_range(kvm, start, end, 0, kvm_unmap_rmapp);
> > > +
> > > + if (kvm->arch.tdp_mmu_enabled)
> > > + r |= kvm_tdp_mmu_zap_hva_range(kvm, start, end);
> >
> > Similar to an earlier question, is this intentionally additive, or can this
> > instead by:
> >
> > if (kvm->arch.tdp_mmu_enabled)
> > r = kvm_tdp_mmu_zap_hva_range(kvm, start, end);
> > else
> > r = kvm_handle_hva_range(kvm, start, end, 0, kvm_unmap_rmapp);
> >
>
> It is intentionally additive so the legacy/shadow MMU can handle nested.
Duh. Now everything makes sense. I completely spaced on nested EPT.
I wonder if would be worth adding a per-VM sticky bit that is set when an
rmap is added so that all of these flows can skip the rmap walks when using
the TDP MMU without a nested guest.
Powered by blists - more mailing lists