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, URIBL_BLOCKED,USER_AGENT_SANE_1 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 4DC36C7618B for ; Wed, 24 Jul 2019 13:04:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 318B322ADB for ; Wed, 24 Jul 2019 13:04:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728404AbfGXNEE (ORCPT ); Wed, 24 Jul 2019 09:04:04 -0400 Received: from foss.arm.com ([217.140.110.172]:40630 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbfGXNED (ORCPT ); Wed, 24 Jul 2019 09:04:03 -0400 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 29A9128; Wed, 24 Jul 2019 06:04:03 -0700 (PDT) Received: from [10.1.196.133] (e112269-lin.cambridge.arm.com [10.1.196.133]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1FC383F71A; Wed, 24 Jul 2019 06:04:00 -0700 (PDT) Subject: Re: [PATCH v9 04/21] mips: mm: Add p?d_leaf() definitions To: Paul Burton Cc: Mark Rutland , Peter Zijlstra , Catalin Marinas , Dave Hansen , "linux-mips@vger.kernel.org" , "linux-mm@kvack.org" , "H. Peter Anvin" , Will Deacon , "Liang, Kan" , "x86@kernel.org" , Ingo Molnar , James Hogan , Arnd Bergmann , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , "linux-arm-kernel@lists.infradead.org" , Ard Biesheuvel , "linux-kernel@vger.kernel.org" , Ralf Baechle , James Morse , Andrew Morton References: <20190722154210.42799-1-steven.price@arm.com> <20190722154210.42799-5-steven.price@arm.com> <20190722214722.wdlj6a3der3r2oro@pburton-laptop> From: Steven Price Message-ID: <85b20d93-bb60-b9e2-ea6a-92ca6f90abc6@arm.com> Date: Wed, 24 Jul 2019 14:03:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190722214722.wdlj6a3der3r2oro@pburton-laptop> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/07/2019 22:47, Paul Burton wrote: > Hi Steven, > > On Mon, Jul 22, 2019 at 04:41:53PM +0100, Steven Price wrote: >> 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 mips, we only support large pages on 64 bit. > > That ceases to be true with commit 35476311e529 ("MIPS: Add partial > 32-bit huge page support") in mips-next, so I think it may be best to > move the definition to asm/pgtable.h so that both 32b & 64b kernels can > pick it up. Thanks for pointing that out. I'll move the definitions as you suggest. Steve > Thanks, > Paul > >> For 64 bit if _PAGE_HUGE is defined we can simply look for it. When not >> defined we can be confident that there are no leaf pages in existence >> and fall back on the generic implementation (added in a later patch) >> which returns 0. >> >> CC: Ralf Baechle >> CC: Paul Burton >> CC: James Hogan >> CC: linux-mips@vger.kernel.org >> Signed-off-by: Steven Price >> --- >> arch/mips/include/asm/pgtable-64.h | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h >> index 93a9dce31f25..2bdbf8652b5f 100644 >> --- a/arch/mips/include/asm/pgtable-64.h >> +++ b/arch/mips/include/asm/pgtable-64.h >> @@ -273,6 +273,10 @@ static inline int pmd_present(pmd_t pmd) >> return pmd_val(pmd) != (unsigned long) invalid_pte_table; >> } >> >> +#ifdef _PAGE_HUGE >> +#define pmd_leaf(pmd) ((pmd_val(pmd) & _PAGE_HUGE) != 0) >> +#endif >> + >> static inline void pmd_clear(pmd_t *pmdp) >> { >> pmd_val(*pmdp) = ((unsigned long) invalid_pte_table); >> @@ -297,6 +301,10 @@ static inline int pud_present(pud_t pud) >> return pud_val(pud) != (unsigned long) invalid_pmd_table; >> } >> >> +#ifdef _PAGE_HUGE >> +#define pud_leaf(pud) ((pud_val(pud) & _PAGE_HUGE) != 0) >> +#endif >> + >> static inline void pud_clear(pud_t *pudp) >> { >> pud_val(*pudp) = ((unsigned long) invalid_pmd_table); >> -- >> 2.20.1 >> > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >