lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221117192518.GL2350331@ls.amr.corp.intel.com>
Date:   Thu, 17 Nov 2022 11:25:18 -0800
From:   Isaku Yamahata <isaku.yamahata@...il.com>
To:     "Huang, Kai" <kai.huang@...el.com>
Cc:     "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Yamahata, Isaku" <isaku.yamahata@...el.com>,
        "pbonzini@...hat.com" <pbonzini@...hat.com>,
        "Shahar, Sagi" <sagis@...gle.com>,
        "Aktas, Erdem" <erdemaktas@...gle.com>,
        "isaku.yamahata@...il.com" <isaku.yamahata@...il.com>,
        "Christopherson,, Sean" <seanjc@...gle.com>,
        "dmatlack@...gle.com" <dmatlack@...gle.com>
Subject: Re: [PATCH v10 045/108] KVM: x86/mmu: Add a private pointer to
 struct kvm_mmu_page

On Wed, Nov 16, 2022 at 11:53:47AM +0000,
"Huang, Kai" <kai.huang@...el.com> wrote:

> On Wed, 2022-11-16 at 10:32 +0000, Huang, Kai wrote:
> > > +
> > > +static inline void kvm_mmu_alloc_private_spt(struct kvm_vcpu *vcpu,
> > > +					     struct kvm_mmu_memory_cache
> > > *private_spt_cache,
> > > +					     struct kvm_mmu_page *sp)
> > 
> > This function is very weird in the context of this patch.  _Only_ a new vcpu-
> > scope 'mmu_private_spte_cache' is added in this patch, but here you allow
> > caller
> > to pass an additional argument of private_spt_cache.  So there must be another
> > cache which is not introduced in this patch?
> > 
> > > +{
> > > +	/*
> > > +	 * vcpu == NULL means non-root SPT:
> > > +	 * vcpu == NULL is used to split a large SPT into smaller SPT. 
> > > Root SPT
> > > +	 * is not a large SPT.
> > 
> > I am guessing this "vcpu == NULL" case is for "Eager Splitting"?
> > 
> > If so, why not adding a global MMU cache for private_spt allocation, and make
> > vcpu->arch.mmu_private_spt_cache point to the global cache?  In this case, in
> > the context where you only have 'kvm', you can use the global cache directly. 
> > And in the context where you have a 'vcpu', you just use vcpu's cache.
> 
> So I went through all MMU related patches in this series, but I cannot find a
> place where this function is called with 'vcpu == NULL' and a valid cache is
> passed in, if I am reading correctly.
> 
> Also checked that "Eager Splitting" uses a kvm-scope cache for legacy MMU, but
> just uses __get_free_page() for TDP MMU.  And in later patch "KVM: x86/tdp_mmu:
> Support TDX private mapping for TDP MMU", __get_free_page() is also used to
> allocate the private_spt (which is consistent with existing eager splitting
> code).
> 
> So IIUC only legacy MMU code will call this function with 'vcpu == NULL' and a
> valid cache.  In this case, please remove the 'private_spt_cache' argument for
> now, and make the function always allocate from the vcpu-
> >arch.mmu_private_spt_cache.  
> 
> You can add the additional argument when TDX gets legacy MMU support.
> 
> Also, I think you need to move eager splitting support part (whether that
> handling is correct is another story) from the later patch to this patch. 
> Otherwise this patch is not complete.

Yes, you're right. Somehow legacy mmu part is crept in. I'll remove those from
this patch series.
-- 
Isaku Yamahata <isaku.yamahata@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ