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=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 4B08BC2D0C0 for ; Thu, 19 Dec 2019 11:49:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0D35F2467F for ; Thu, 19 Dec 2019 11:49:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="iVZiuTv8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D35F2467F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 99EDD8E0169; Thu, 19 Dec 2019 06:49:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 950448E00F5; Thu, 19 Dec 2019 06:49:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 865FE8E0169; Thu, 19 Dec 2019 06:49:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0047.hostedemail.com [216.40.44.47]) by kanga.kvack.org (Postfix) with ESMTP id 6EC3E8E00F5 for ; Thu, 19 Dec 2019 06:49:25 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id C318F181AEF09 for ; Thu, 19 Dec 2019 11:49:24 +0000 (UTC) X-FDA: 76281720648.03.rail43_17d88b199f04b X-HE-Tag: rail43_17d88b199f04b X-Filterd-Recvd-Size: 5040 Received: from ozlabs.org (ozlabs.org [203.11.71.1]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Thu, 19 Dec 2019 11:49:23 +0000 (UTC) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 47dqsn6T0bz9sPh; Thu, 19 Dec 2019 22:49:17 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1576756159; bh=m3hY81qHO7a2k47hLHQcsNjq4SjyZd/McTsEzivltVw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=iVZiuTv82Xx6PBD5+ZkMNAHxtQgm3Q8T7MvtNs5BQ/Le5rVoL5jtfTowsYTNg6zVk TQZdB+LeRGDQrwAbrTTCxlT5yq8GuZA/I4SebmZX3Bg8hOSBhFEd9ESk5kE7CQG6Ef e6EdNhWAzinbIMDQEnBy+i+JXbxM8SUzfIqLg7aN6HNm50Myep5JO24puwgEs1WWPZ beWQBPCIBFxfuPhkxyvdgQxbgUTdVp/+dbBMhA0uJICJaCHly3aGbeXexWvcQcSJR2 iCQIGMzx3cHbUs952puh+OX3lMc8+K44Q5rTMLMhn8ZR61R4Ri2WUTdlL0Y1fzqZpg g1ifRi2FGLkTA== From: Michael Ellerman To: Steven Price , Andrew Morton , linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?B?SsOpcsO0bWU=?= Glisse , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang\, Kan" , Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org Subject: Re: [PATCH v17 06/23] powerpc: mm: Add p?d_leaf() definitions In-Reply-To: <20191218162402.45610-7-steven.price@arm.com> References: <20191218162402.45610-1-steven.price@arm.com> <20191218162402.45610-7-steven.price@arm.com> Date: Thu, 19 Dec 2019 22:49:16 +1100 Message-ID: <877e2smt6r.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Steven Price writes: > walk_page_range() is going to be allowed to walk page tables other than > those of user space. For this it needs to know when it has reached a > 'leaf' entry in the page tables. This information is provided by the > p?d_leaf() functions/macros. > > For powerpc p?d_is_leaf() functions already exist. Export them using the > new p?d_leaf() name. > > CC: Benjamin Herrenschmidt > CC: Paul Mackerras > CC: Michael Ellerman > CC: linuxppc-dev@lists.ozlabs.org > CC: kvm-ppc@vger.kernel.org > Signed-off-by: Steven Price > --- > arch/powerpc/include/asm/book3s/64/pgtable.h | 3 +++ > 1 file changed, 3 insertions(+) We have fallback versions of our pmd_is_leaf() etc. in arch/powerpc/include/asm/pgtable.h, eg: #ifndef pmd_is_leaf #define pmd_is_leaf pmd_is_leaf static inline bool pmd_is_leaf(pmd_t pmd) { return false; } #endif Because we support several different MMUs and most of them don't need to do anything. So we could put the compatibility #defines to your names along with the fallback versions in asm/pgtable.h, rather than in asm/book3s/64/pgtable.h But I see you also have fallbacks for your versions, so it probably doesn't matter either way. So I'm OK with this version, unless you think there's a compelling reason to do the compatibility #defines in our asm/pgtable.h Acked-by: Michael Ellerman cheers > diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h > index b01624e5c467..201a69e6a355 100644 > --- a/arch/powerpc/include/asm/book3s/64/pgtable.h > +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h > @@ -1355,18 +1355,21 @@ static inline bool is_pte_rw_upgrade(unsigned long old_val, unsigned long new_va > * Like pmd_huge() and pmd_large(), but works regardless of config options > */ > #define pmd_is_leaf pmd_is_leaf > +#define pmd_leaf pmd_is_leaf > static inline bool pmd_is_leaf(pmd_t pmd) > { > return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE)); > } > > #define pud_is_leaf pud_is_leaf > +#define pud_leaf pud_is_leaf > static inline bool pud_is_leaf(pud_t pud) > { > return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PTE)); > } > > #define pgd_is_leaf pgd_is_leaf > +#define pgd_leaf pgd_is_leaf > static inline bool pgd_is_leaf(pgd_t pgd) > { > return !!(pgd_raw(pgd) & cpu_to_be64(_PAGE_PTE)); > -- > 2.20.1