From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75F3AC49EA5 for ; Thu, 24 Jun 2021 09:40:13 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id E5A6E613F9 for ; Thu, 24 Jun 2021 09:40:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5A6E613F9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 717FB4B1E6; Thu, 24 Jun 2021 05:40:12 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kkpHeLPonSBk; Thu, 24 Jun 2021 05:40:11 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 4C29C4B21B; Thu, 24 Jun 2021 05:40:11 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id E6FCC4B1F0 for ; Thu, 24 Jun 2021 05:40:09 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NKec7t+5HIQj for ; Thu, 24 Jun 2021 05:40:08 -0400 (EDT) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 8CED84B1E6 for ; Thu, 24 Jun 2021 05:40:08 -0400 (EDT) Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 83160613C3; Thu, 24 Jun 2021 09:40:07 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lwLq9-009Yqj-H3; Thu, 24 Jun 2021 10:40:05 +0100 Date: Thu, 24 Jun 2021 10:40:00 +0100 Message-ID: <87o8bviosv.wl-maz@kernel.org> From: Marc Zyngier To: David Stevens Subject: Re: [PATCH 2/6] KVM: mmu: also return page from gfn_to_pfn In-Reply-To: <20210624035749.4054934-3-stevensd@google.com> References: <20210624035749.4054934-1-stevensd@google.com> <20210624035749.4054934-3-stevensd@google.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: stevensd@chromium.org, chenhuacai@kernel.org, aleksandar.qemu.devel@gmail.com, paulus@ozlabs.org, pbonzini@redhat.com, zhenyuw@linux.intel.com, zhi.a.wang@intel.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, will@kernel.org, seanjc@google.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: Wanpeng Li , kvm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mips@vger.kernel.org, Paul Mackerras , Will Deacon , kvmarm@lists.cs.columbia.edu, intel-gvt-dev@lists.freedesktop.org, Joerg Roedel , Huacai Chen , Aleksandar Markovic , Zhi Wang , intel-gfx@lists.freedesktop.org, kvm-ppc@vger.kernel.org, Zhenyu Wang , linux-arm-kernel@lists.infradead.org, Jim Mattson , Sean Christopherson , linux-kernel@vger.kernel.org, Paolo Bonzini , Vitaly Kuznetsov , linuxppc-dev@lists.ozlabs.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi David, On Thu, 24 Jun 2021 04:57:45 +0100, David Stevens wrote: > > From: David Stevens > > 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 > --- > 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. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm