Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9593086ybi; Wed, 24 Jul 2019 06:47:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGWPxMOmraO9Kjr29AS6RNpMIz9GodxI9EPDftf8JP1P/vhy0h9YNE0lBp60mtFsxmKQR7 X-Received: by 2002:a17:902:28c9:: with SMTP id f67mr46738537plb.19.1563976019937; Wed, 24 Jul 2019 06:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563976019; cv=none; d=google.com; s=arc-20160816; b=dherfu0U8JqLpT3WZEsBEZvrtcu3Q2sRexikLUW6ns+kKqJMzi8NH1COQIH3nnOPFQ 8QsQgybhyiWIF/UJwh7u12KEul/2PupZC+Qrs8/cDEqArd1fB/y2aR194jlIVb8/H70B 2zbyggiP0Fa7O387ZzgaaWtHR0YdGMo7OBS6BR5n1S0HzPMzEGpF2Y7m08iJWmp258Vy xlwyXsW2V3uoscqKwHaPfQIY/LgcliJvYVxlYBFN3HG5nUMFJjx6kUGpOtl+CIbkwSCS JUd/BEwkiUHF3urnVEiKx6/a9wDyOf9rtsKMFXEsXkR++18aU1FVM2uRoX6TEUX39vcX 1G0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=U5uKFvCvqdS6xb4mC84vOGAE2zJGUM2OcXjCkR+r6dM=; b=iQimNQ4rF3ai9wzW2AFdUy3pY4ZR7xHGdClWyfxRubN8kpBI0RfVM0lY6Oy2mYRKzz LuggKOke5sHLfk+U+SaTY9xOJoiEZHkvMiAscozeNS6eyiBUNCSZZ/MBH9rwXdr2zvTq 6Kn49EPX5HrfVQ8zalSS4sBSdEbJr9+I0vdA14o2aJcL2ETGDQZVaRscGeo7mB4wLW/O SuJdfHLraE52BAt+wJNKFXKStzr2AgQxeJd0H4f3UfoEq6wgbG876qodoREzhthcO93w Fl7nRtSRqki6GNgeD0OjAvuIAiqzKrglMnyu93KV7YQ7bkRLgCMCRQAwm20A7aclsvaE itJw== 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 q67si27930601pgq.83.2019.07.24.06.46.44; Wed, 24 Jul 2019 06:46:59 -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 S1728388AbfGXNEE (ORCPT + 99 others); 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 >