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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham 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 2EC73C2D0C0 for ; Fri, 20 Dec 2019 11:53:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EB31E24684 for ; Fri, 20 Dec 2019 11:53:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB31E24684 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 84B018E0198; Fri, 20 Dec 2019 06:53:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D5B28E0184; Fri, 20 Dec 2019 06:53:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 69D508E0198; Fri, 20 Dec 2019 06:53:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0219.hostedemail.com [216.40.44.219]) by kanga.kvack.org (Postfix) with ESMTP id 4FA148E0184 for ; Fri, 20 Dec 2019 06:53:50 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 0D7148249980 for ; Fri, 20 Dec 2019 11:53:50 +0000 (UTC) X-FDA: 76285360620.17.band21_78b4cb687d60f X-HE-Tag: band21_78b4cb687d60f X-Filterd-Recvd-Size: 5326 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Fri, 20 Dec 2019 11:53:49 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 395A030E; Fri, 20 Dec 2019 03:53:48 -0800 (PST) Received: from [10.1.194.52] (e112269-lin.cambridge.arm.com [10.1.194.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 567D63F719; Fri, 20 Dec 2019 03:53:45 -0800 (PST) Subject: Re: [PATCH v17 06/23] powerpc: mm: Add p?d_leaf() definitions To: Michael Ellerman , Andrew Morton , linux-mm@kvack.org Cc: Mark Rutland , Peter Zijlstra , Benjamin Herrenschmidt , Dave Hansen , Paul Mackerras , "H. Peter Anvin" , Will Deacon , "Liang, Kan" , x86@kernel.org, Ingo Molnar , Catalin Marinas , Arnd Bergmann , kvm-ppc@vger.kernel.org, =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , linux-kernel@vger.kernel.org, James Morse , linuxppc-dev@lists.ozlabs.org References: <20191218162402.45610-1-steven.price@arm.com> <20191218162402.45610-7-steven.price@arm.com> <877e2smt6r.fsf@mpe.ellerman.id.au> From: Steven Price Message-ID: Date: Fri, 20 Dec 2019 11:53:44 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <877e2smt6r.fsf@mpe.ellerman.id.au> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: On 19/12/2019 11:49, Michael Ellerman wrote: > 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 I was thinking that (assuming this series actually gets merged this time), the p?d_is_leaf() versions could be removed and replaced by p?d_leaf() in the future. Since the fallbacks are in the asm-generic code it makes sense for the pmd_leaf() definitions to be next to the non-fallback versions. > Acked-by: Michael Ellerman Thanks! Steve > 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 > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >