From: Paolo Bonzini Date: Thu, 24 Jun 2021 10:17:31 +0000 Subject: Re: [PATCH 3/6] KVM: x86/mmu: avoid struct page in MMU Message-Id: <0b7f9c30-eb12-35c5-191f-0e8e469e1b88@redhat.com> List-Id: References: <20210624035749.4054934-1-stevensd@google.com> <20210624035749.4054934-4-stevensd@google.com> <1624524744.2sr7o7ix86.astroid@bobo.none> <87mtrfinks.wl-maz@kernel.org> In-Reply-To: <87mtrfinks.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Marc Zyngier , Nicholas Piggin Cc: Aleksandar Markovic , Huacai Chen , Paul Mackerras , David Stevens , Zhenyu Wang , Zhi Wang , Alexandru Elisei , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, James Morse , Jim Mattson , Joerg Roedel , kvmarm@lists.cs.columbia.edu, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Sean Christopherson , Suzuki K Poulose , Vitaly Kuznetsov , Wanpeng Li , Will Deacon On 24/06/21 12:06, Marc Zyngier wrote: > On Thu, 24 Jun 2021 09:58:00 +0100, > Nicholas Piggin wrote: >> >> Excerpts from David Stevens's message of June 24, 2021 1:57 pm: >>> From: David Stevens >>> out_unlock: >>> if (is_tdp_mmu_root(vcpu->kvm, vcpu->arch.mmu->root_hpa)) >>> read_unlock(&vcpu->kvm->mmu_lock); >>> else >>> write_unlock(&vcpu->kvm->mmu_lock); >>> - kvm_release_pfn_clean(pfn); >>> + if (pfnpg.page) >>> + put_page(pfnpg.page); >>> return r; >>> } >> >> How about >> >> kvm_release_pfn_page_clean(pfnpg); > > I'm not sure. I always found kvm_release_pfn_clean() ugly, because it > doesn't mark the page 'clean'. I find put_page() more correct. > > Something like 'kvm_put_pfn_page()' would make more sense, but I'm so > bad at naming things that I could just as well call it 'bob()'. The best way to go would be to get rid of kvm_release_pfn_clean() and always go through a pfn_page. Then we could or could not introduce wrappers kvm_put_pfn_page{,_dirty}. I think for now it's best to limit the churn since these patches will go in the stable releases too, and clean up the resulting API once we have a clear idea of how all architectures are using kvm_pfn_page. Paolo