Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3716577imm; Mon, 4 Jun 2018 08:10:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLCZGQMl2sA5IM/xtR7OBrEeZPoWc+hX4evUNwLgVLpdMc7DGgqFYL1kiVw7Hf2SVzkrWjH X-Received: by 2002:a62:3f4f:: with SMTP id m76-v6mr21827114pfa.109.1528125012751; Mon, 04 Jun 2018 08:10:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528125012; cv=none; d=google.com; s=arc-20160816; b=AfDiYwfvxkUuTmg6guBXP4brA9BXKX3LOY2/YdBbVe15q/onmcsmYKGidujSeYdNrC hPrEBjVPrGr4C65N1kkkJhGaDGnTyEPQ3IXPcVET8SyQ2Jn2UqiYV/e/rp6tLbAOtCR4 nG3idB4jmeB0XwwIgBlHiN5OZ8ZGv6tIO0n2dLjBPzyJeD/3f6pYgusDGNHgWnHSlUB8 dIGIx2BSj9aWH1vdhSO3OPGPUfLUOlTFzNnCIfWvT7uUFvXDfVwWSLDVIZWuwfu4G8l3 qwhK+91yurDdmeij1Oq1FvkNg/JBTIDOyULOfdF/3Y8Ww80A57+56YTGfvxNpoZQKuaC 4UuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=PX+mkGHbRDWXta6F45/21EjnaZDIMb3/GOTKzDm3frA=; b=n62w2Bzv3V1Au6BavXPn0LlO46k8QtgfblTILHddJQCqw4MEap/qh9tyTN0+1z71t4 UEMIJzMecDnP2uK06XdjDDMQyiAFhMigIg6mUx+bhqf0Vga9j5KgE7WrjHWafJzPWbzU 5RqH3u2gYtFNhb5pTvBCFVZ6qFEBsHWmv6jFw7POwinpQOlb+uJH4BlSJa3ly6hnGIV7 hLtiK+53oQhIksOvr8eXTEWy7oblU1pAayep9tXb5xuH8ZtNq9H7LxsWztHOVWDUcl30 Q8eIiomXF+CPOpGJxMqBAFhxAhPVtRSA1qd8Ws3B0GOECvjTvklwmjZR0NdFk9ps68Hv p1Zw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h4-v6si6515982pgs.201.2018.06.04.08.09.57; Mon, 04 Jun 2018 08:10:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753764AbeFDPJa (ORCPT + 99 others); Mon, 4 Jun 2018 11:09:30 -0400 Received: from foss.arm.com ([217.140.101.70]:44686 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751784AbeFDPJa (ORCPT ); Mon, 4 Jun 2018 11:09:30 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B22091596; Mon, 4 Jun 2018 08:09:29 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8472B3F557; Mon, 4 Jun 2018 08:09:29 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id ED8E31AE53C1; Mon, 4 Jun 2018 16:10:00 +0100 (BST) Date: Mon, 4 Jun 2018 16:10:00 +0100 From: Will Deacon To: Chintan Pandya Cc: catalin.marinas@arm.com, mark.rutland@arm.com, akpm@linux-foundation.org, toshi.kani@hpe.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v12 3/5] arm64: pgtable: Add p*d_page_vaddr helper macros Message-ID: <20180604150959.GC8593@arm.com> References: <1527856758-27169-1-git-send-email-cpandya@codeaurora.org> <1527856758-27169-4-git-send-email-cpandya@codeaurora.org> <20180604121351.GJ9482@arm.com> <28cc339e-b184-5f15-eca3-cf54e9376e01@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <28cc339e-b184-5f15-eca3-cf54e9376e01@codeaurora.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 04, 2018 at 07:13:48PM +0530, Chintan Pandya wrote: > > > On 6/4/2018 5:43 PM, Will Deacon wrote: > >On Fri, Jun 01, 2018 at 06:09:16PM +0530, Chintan Pandya wrote: > >>Add helper macros to give virtual references to page > >>tables. These will be used while freeing dangling > >>page tables. > >> > >>Signed-off-by: Chintan Pandya > >>--- > >> arch/arm64/include/asm/pgtable.h | 3 +++ > >> 1 file changed, 3 insertions(+) > >> > >>diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h > >>index 7c4c8f3..ef4047f 100644 > >>--- a/arch/arm64/include/asm/pgtable.h > >>+++ b/arch/arm64/include/asm/pgtable.h > >>@@ -580,6 +580,9 @@ static inline phys_addr_t pgd_page_paddr(pgd_t pgd) > >> #endif /* CONFIG_PGTABLE_LEVELS > 3 */ > >>+#define pmd_page_vaddr(pmd) __va(pmd_page_paddr(pmd)) > >>+#define pud_page_vaddr(pud) __va(pud_page_paddr(pud)) > > > >Are these actually needed, or do pte_offset_kernel and pmd_offset do the > >job already? > > > > I introduced these macros for consistency across different arch. > > Looking at pte_offset_kernel, it seems to use READ_ONCE() which looks > little costly for its intended use (in next patch) where we already have > dereferenced value. Do you still suggest to remove this ? It's only an additional load instruction on the freeing path and it matches what we do in other page table code, so I'd rather use the existing API unless we have numbers to show otherwise. Will