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.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 CBF87C48BDF for ; Thu, 24 Jun 2021 09:41:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 993E6613F7 for ; Thu, 24 Jun 2021 09:41:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 993E6613F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oT59GstXopqxSWmjjR5vY8Vw1GCP+X41lYM3e3yOt/M=; b=aGQpIq+oPO2x11 dupCnqbnJU77E2OubcJVm3//PjLopFG9BsmWOdK/BC90JjGqAVtqLJyyOKZnn3GsfRZZ3gRZN/UYQ 1P8Yvs7v8dnNvWdSQeQk3lUowLKgqlCkfGlshMbizAaZ0tanN/C1h/DHfdv7IXHf5nE3NSdtTCuNv k/k3YkzCed5D57aysIjAgZTHlUfknIwZrnCWuKsKxGNODwSgBpMPVDiIhfEnGAkMunmcKxFWvKSA9 9VHAD91gOh4Q+r82kXbpBDPjjjK5SRoqXYQulZdn7auGWR4+27zujU6XEwPUKKm4b7myK+BVE1vQE NQ0fyU9Y18IpPWHht3iA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwLqF-00DkOY-OX; Thu, 24 Jun 2021 09:40:11 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwLqC-00DkNv-5J for linux-arm-kernel@lists.infradead.org; Thu, 24 Jun 2021 09:40:09 +0000 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 Cc: Huacai Chen , Aleksandar Markovic , Paul Mackerras , Paolo Bonzini , Zhenyu Wang , Zhi Wang , James Morse , Alexandru Elisei , Suzuki K Poulose , Will Deacon , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210624_024008_277909_FDA7DA4C X-CRM114-Status: GOOD ( 24.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel