From: Paolo Bonzini Subject: Re: [PATCH 11/11] KVM/MMU: Flush tlb in the kvm_age_rmapp() Date: Mon, 7 Jan 2019 17:31:26 +0100 Message-ID: References: <20190104085405.40356-1-Tianyu.Lan@microsoft.com> <20190104085405.40356-12-Tianyu.Lan@microsoft.com> <20190104161235.GB11288@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Lan Tianyu , Radim Krcmar , Thomas Gleixner , Ingo Molnar , bp@alien8.de, "H. Peter Anvin" , the arch/x86 maintainers , kvm , "linux-kernel@vger kernel org" , michael.h.kelley@microsoft.com, kys@microsoft.com, vkuznets@redhat.com, linux@armlinux.org.uk To: Tianyu Lan , Sean Christopherson Return-path: In-Reply-To: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 07/01/19 04:42, Tianyu Lan wrote: >> I'm assuming you're >> clearing young to avoid the flush in kvm_mmu_notifier_clear_flush_young(), >> but keeping that flush is silly since it will never be invoked. Just >> squash this patch with patch 10/11 so that you can remove the unnecessary >> flush in kvm_mmu_notifier_clear_flush_young() and preserve young. >> > The platform may provide tlb flush with address range as granularity. My changes > are to use range flush when it's available. kvm_mmu_notifier_clear_flush_young() > is common function for all platforms and most platforms still need the > flush in the > kvm_mmu_notifier_clear_flush_young(). I think it's better to separate > flush request and > "young" from return value of kvm_age_hva(). New flush parameter I > added in the patch 10 > can be changed to a pointer and kvm_age_hva() can use it to return > flush request. There are two possibilities: - pass a "bool *flush". If NULL, kvm_age_hva should not flush. If not NULL, kvm_age_hva should receive a true *flush, and should change it to false if kvm_age_hva takes care of the flush - pass a "bool flush". In patch 10, change all kvm_age_hva implementation to do the flush if they return 1. I think I prefer the latter, in this case the small code duplication is offset by a simpler API. Paolo