From: Marc Zyngier <maz@kernel.org>
To: David Stevens <stevensd@chromium.org>
Cc: Wanpeng Li <wanpengli@tencent.com>,
kvm@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-mips@vger.kernel.org, Will Deacon <will@kernel.org>,
kvmarm@lists.cs.columbia.edu,
intel-gvt-dev@lists.freedesktop.org,
Joerg Roedel <joro@8bytes.org>,
Huacai Chen <chenhuacai@kernel.org>,
Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>,
Zhi Wang <zhi.a.wang@intel.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
intel-gfx@lists.freedesktop.org, kvm-ppc@vger.kernel.org,
Zhenyu Wang <zhenyuw@linux.intel.com>,
Alexandru Elisei <alexandru.elisei@arm.com>,
linux-arm-kernel@lists.infradead.org,
Jim Mattson <jmattson@google.com>,
Sean Christopherson <seanjc@google.com>,
linux-kernel@vger.kernel.org, James Morse <james.morse@arm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/6] KVM: mmu: also return page from gfn_to_pfn
Date: Thu, 24 Jun 2021 10:40:00 +0100 [thread overview]
Message-ID: <87o8bviosv.wl-maz@kernel.org> (raw)
In-Reply-To: <20210624035749.4054934-3-stevensd@google.com>
Hi David,
On Thu, 24 Jun 2021 04:57:45 +0100,
David Stevens <stevensd@chromium.org> wrote:
>
> From: David Stevens <stevensd@chromium.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@chromium.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.
next prev parent reply other threads:[~2021-06-24 9:40 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-24 3:57 [PATCH 0/6] KVM: Remove uses of struct page from x86 and arm64 MMU David Stevens
2021-06-24 3:57 ` [PATCH 1/6] KVM: x86/mmu: release audited pfns David Stevens
2021-06-24 8:43 ` Nicholas Piggin
2021-06-24 9:43 ` Paolo Bonzini
2021-06-24 15:36 ` Sean Christopherson
2021-06-24 3:57 ` [PATCH 2/6] KVM: mmu: also return page from gfn_to_pfn David Stevens
2021-06-24 8:52 ` Nicholas Piggin
2021-06-24 9:42 ` Paolo Bonzini
2021-06-24 9:57 ` Nicholas Piggin
2021-06-24 10:13 ` Paolo Bonzini
2021-06-24 10:17 ` Nicholas Piggin
2021-06-24 10:21 ` Paolo Bonzini
2021-06-24 10:42 ` Nicholas Piggin
2021-06-24 9:40 ` Marc Zyngier [this message]
2021-06-24 3:57 ` [PATCH 3/6] KVM: x86/mmu: avoid struct page in MMU David Stevens
2021-06-24 7:31 ` Paolo Bonzini
2021-06-24 8:58 ` Nicholas Piggin
2021-06-24 10:06 ` Marc Zyngier
2021-06-24 10:17 ` Paolo Bonzini
2021-06-24 10:43 ` Nicholas Piggin
2021-06-24 3:57 ` [PATCH 4/6] KVM: arm64/mmu: " David Stevens
2021-06-24 10:43 ` Marc Zyngier
2021-06-24 3:57 ` [PATCH 5/6] KVM: mmu: remove over-aggressive warnings David Stevens
2021-06-24 3:57 ` [PATCH 6/6] drm/i915/gvt: use gfn_to_pfn's page instead of pfn David Stevens
2021-06-24 4:28 ` David Stevens
2021-06-24 6:57 ` [PATCH 0/6] KVM: Remove uses of struct page from x86 and arm64 MMU Paolo Bonzini
2021-06-24 10:34 ` Nicholas Piggin
2021-06-24 11:42 ` Nicholas Piggin
2021-06-24 12:00 ` Paolo Bonzini
2021-06-24 12:41 ` Paolo Bonzini
2021-06-24 12:57 ` Nicholas Piggin
2021-06-24 15:35 ` Paolo Bonzini
2021-06-25 0:20 ` Nicholas Piggin
2021-06-25 7:44 ` Christian Borntraeger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o8bviosv.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=aleksandar.qemu.devel@gmail.com \
--cc=alexandru.elisei@arm.com \
--cc=chenhuacai@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-gvt-dev@lists.freedesktop.org \
--cc=james.morse@arm.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=stevensd@chromium.org \
--cc=suzuki.poulose@arm.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=will@kernel.org \
--cc=zhenyuw@linux.intel.com \
--cc=zhi.a.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).