From: Paolo Bonzini Subject: Re: [PATCH V2 3/10] KVM/MMU: Add last_level in the struct mmu_spte_page Date: Fri, 15 Feb 2019 16:22:43 +0100 Message-ID: References: <20190202013825.51261-1-Tianyu.Lan@microsoft.com> <20190202013825.51261-4-Tianyu.Lan@microsoft.com> <572a6ce3-23f6-7b16-a070-4d4a81ee4335@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm , catalin.marinas@arm.com, will.deacon@arm.com, paulus@ozlabs.org, "H. Peter Anvin" , kys@microsoft.com, kvmarm@lists.cs.columbia.edu, mpe@ellerman.id.au, the arch/x86 maintainers , linux@armlinux.org.uk, michael.h.kelley@microsoft.com, Ingo Molnar , benh@kernel.crashing.org, jhogan@kernel.org, linux-mips@vger.kernel.org, Lan Tianyu , marc.zyngier@arm.com, kvm-ppc@vger.kernel.org, bp@alien8.de, Thomas Gleixner , linux-arm-kernel@lists.infradead.org, "linux-kernel@vger kernel org" , ralf@linux-mips.org, paul.burton@mips.com, Vitaly Kuznetsov , linuxppc-dev@lists.ozlabs.org To: Tianyu Lan Return-path: In-Reply-To: Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu List-Id: kvm.vger.kernel.org On 15/02/19 16:05, Tianyu Lan wrote: > Yes, you are right. Thanks to point out and will fix. The last_level > flag is to avoid adding middle page node(e.g, PGD, PMD) > into flush list. The address range will be duplicated if adding both > leaf, node and middle node into flush list. Hmm, that's not easy to track. One kvm_mmu_page could include both leaf and non-leaf page (for example a huge page for 0 to 2 MB and a page table for 2 MB to 4 MB). Is this really needed? First, your benchmarks so far have been done with sp->last_level always set to true. Second, you would only encounter this optimization in kvm_mmu_commit_zap_page when zapping a 1 GB region (which then would be invalidated twice, at both the PMD and PGD level) or bigger. Paolo