[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87o8bviosv.wl-maz@kernel.org>
Date: Thu, 24 Jun 2021 10:40:00 +0100
From: Marc Zyngier <maz@...nel.org>
To: David Stevens <stevensd@...omium.org>
Cc: Huacai Chen <chenhuacai@...nel.org>,
Aleksandar Markovic <aleksandar.qemu.devel@...il.com>,
Paul Mackerras <paulus@...abs.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Zhenyu Wang <zhenyuw@...ux.intel.com>,
Zhi Wang <zhi.a.wang@...el.com>,
James Morse <james.morse@....com>,
Alexandru Elisei <alexandru.elisei@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Will Deacon <will@...nel.org>,
Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.cs.columbia.edu,
linux-kernel@...r.kernel.org, linux-mips@...r.kernel.org,
kvm@...r.kernel.org, kvm-ppc@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, intel-gvt-dev@...ts.freedesktop.org,
intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH 2/6] KVM: mmu: also return page from gfn_to_pfn
Hi David,
On Thu, 24 Jun 2021 04:57:45 +0100,
David Stevens <stevensd@...omium.org> wrote:
>
> From: David Stevens <stevensd@...omium.org>
>
> Return a struct kvm_pfn_page containing both a pfn and an optional
> struct page from the gfn_to_pfn family of functions. This differentiates
> the gup and follow_fault_pfn cases, which allows callers that only need
> a pfn to avoid touching the page struct in the latter case. For callers
> that need a struct page, introduce a helper function that unwraps a
> struct kvm_pfn_page into a struct page. This helper makes the call to
> kvm_get_pfn which had previously been in hva_to_pfn_remapped.
>
> For now, wrap all calls to gfn_to_pfn functions in the new helper
> function. Callers which don't need the page struct will be updated in
> follow-up patches.
>
> Signed-off-by: David Stevens <stevensd@...omium.org>
> ---
> arch/arm64/kvm/mmu.c | 5 +-
> arch/mips/kvm/mmu.c | 3 +-
> arch/powerpc/kvm/book3s.c | 3 +-
> arch/powerpc/kvm/book3s_64_mmu_hv.c | 5 +-
> arch/powerpc/kvm/book3s_64_mmu_radix.c | 5 +-
> arch/powerpc/kvm/book3s_hv_uvmem.c | 4 +-
> arch/powerpc/kvm/e500_mmu_host.c | 2 +-
> arch/x86/kvm/mmu/mmu.c | 11 ++-
> arch/x86/kvm/mmu/mmu_audit.c | 2 +-
> arch/x86/kvm/x86.c | 2 +-
> drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
> include/linux/kvm_host.h | 27 ++++--
> include/linux/kvm_types.h | 5 +
> virt/kvm/kvm_main.c | 121 +++++++++++++------------
> 14 files changed, 109 insertions(+), 88 deletions(-)
>
[...]
> +kvm_pfn_t kvm_pfn_page_unwrap(struct kvm_pfn_page pfnpg)
> +{
> + if (pfnpg.page)
> + return pfnpg.pfn;
> +
> + kvm_get_pfn(pfnpg.pfn);
> + return pfnpg.pfn;
> +}
> +EXPORT_SYMBOL_GPL(kvm_pfn_page_unwrap);
I'd really like to see a tiny bit of documentation explaining that
calls to kvm_pfn_page_unwrap() are not idempotent.
Otherwise, looks good to me.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
Powered by blists - more mailing lists