From patchwork Fri Feb 15 17:02:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10815483 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0871C1390 for ; Fri, 15 Feb 2019 17:03:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB4822FC1C for ; Fri, 15 Feb 2019 17:03:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFDDA2FC35; Fri, 15 Feb 2019 17:03:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C0C12FC1C for ; Fri, 15 Feb 2019 17:03:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=McyjxMmpe5pI0tQ4YB2qhT1mQ9WrDHJCYYFpkn2R7+o=; b=VTQPO6EsZmValJ Fsokh2xjg9O2gU5fE3va7LIaogv5uPoXWoh3Z1LsPb6SUgX3n0BmUCGmB8bF+rMAQmA8p5lE6vTcb FGzY5ilMQ9K6RrFMgVvX7YsgQpaHEriNo6t9GcBOO1xR3PPG+JfQ0pMR6+W6cNbM9tYf+pPkIKrzJ 3ZLgI//cVh+GFMqXdM0nFb8L/+/FhhxBDyEzut/pPnDgQVcOp5wGJGYf0ahNjT/jVxrsFeevx3hXq EX694LTX+CxOTHuP/Pp2px2mHNK5fyLVtqXfDJB5w1dh024b4UFgqyMn71B1VflWmDX8yOMxWqDds 8BxhPdwAjB/43GKuHRBA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gugtt-0004bS-9q; Fri, 15 Feb 2019 17:03:45 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gugtM-0003z5-H7 for linux-arm-kernel@lists.infradead.org; Fri, 15 Feb 2019 17:03:15 +0000 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 3E46015BF; Fri, 15 Feb 2019 09:03:12 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4A48D3F557; Fri, 15 Feb 2019 09:03:09 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Subject: [PATCH 02/13] x86/mm: Add p?d_large() definitions Date: Fri, 15 Feb 2019 17:02:23 +0000 Message-Id: <20190215170235.23360-3-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190215170235.23360-1-steven.price@arm.com> References: <20190215170235.23360-1-steven.price@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190215_090312_804686_29798418 X-CRM114-Status: GOOD ( 13.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: x86@kernel.org, Arnd Bergmann , Ard Biesheuvel , Peter Zijlstra , Catalin Marinas , Dave Hansen , Will Deacon , linux-kernel@vger.kernel.org, Steven Price , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Ingo Molnar , Borislav Petkov , Andy Lutomirski , "H. Peter Anvin" , James Morse , Thomas Gleixner , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Exposing the pud/pgd levels of the page tables to walk_page_range() means we may come across the exotic large mappings that come with large areas of contiguous memory (such as the kernel's linear map). Expose p?d_large() from each architecture to detect these large mappings. x86 already has these defined as inline functions, add a macro of the same name so we don't end up with the generic version too. Signed-off-by: James Morse Signed-off-by: Steven Price --- arch/x86/include/asm/pgtable.h | 3 +++ arch/x86/mm/dump_pagetables.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 2779ace16d23..3695f6acb6af 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -234,6 +234,7 @@ static inline int pmd_large(pmd_t pte) { return pmd_flags(pte) & _PAGE_PSE; } +#define pmd_large(x) pmd_large(x) #ifdef CONFIG_TRANSPARENT_HUGEPAGE static inline int pmd_trans_huge(pmd_t pmd) @@ -873,6 +874,7 @@ static inline int pud_large(pud_t pud) return 0; } #endif /* CONFIG_PGTABLE_LEVELS > 2 */ +#define pud_large(x) pud_large(x) static inline unsigned long pud_index(unsigned long address) { @@ -1214,6 +1216,7 @@ static inline bool pgdp_maps_userspace(void *__ptr) } static inline int pgd_large(pgd_t pgd) { return 0; } +#define pgd_large(x) pgd_large(x) #ifdef CONFIG_PAGE_TABLE_ISOLATION /* diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index e3cdc85ce5b6..695647dc9cb9 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c @@ -432,6 +432,7 @@ static void walk_pmd_level(struct seq_file *m, struct pg_state *st, pud_t addr, #else #define walk_pmd_level(m,s,a,e,p) walk_pte_level(m,s,__pmd(pud_val(a)),e,p) +#undef pud_large #define pud_large(a) pmd_large(__pmd(pud_val(a))) #define pud_none(a) pmd_none(__pmd(pud_val(a))) #endif @@ -503,6 +504,7 @@ static void walk_p4d_level(struct seq_file *m, struct pg_state *st, pgd_t addr, } } +#undef pgd_large #define pgd_large(a) (pgtable_l5_enabled() ? pgd_large(a) : p4d_large(__p4d(pgd_val(a)))) #define pgd_none(a) (pgtable_l5_enabled() ? pgd_none(a) : p4d_none(__p4d(pgd_val(a))))