Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp929983imj; Fri, 15 Feb 2019 09:08:09 -0800 (PST) X-Google-Smtp-Source: AHgI3IYMwFHj0a+YjQ59KoSNQfx+TbF1buu3gfu0OLKWhtMWJqa+D6FRjwGbdnfxTkZYxubSxo6L X-Received: by 2002:a62:12d5:: with SMTP id 82mr10859372pfs.255.1550250488971; Fri, 15 Feb 2019 09:08:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550250488; cv=none; d=google.com; s=arc-20160816; b=P//0mpPDTd7TCXmi9fsiy7W+9YNv6pnXU48YT+Sj+cuuYNuGgiTU9/DpOmvymY1q6r gawltX36KCTvIjU4Mdt0ETeFnpm6D5canshAeONOxPR9Y2Ab8KSSHwv4w00wz+HM6wze QFUMh6sU/qp/v6GGlEHIWRzJvTe2xRRpJ40IIyqwem1+2rgBEYceN69ywGyzcQZYYkc8 6cXwtaJ3oOthBCRf8uxmd3OWbJL3zu67MAEBippONZv5kYrptifwCGXxQLvaHp7VfJI9 63w/q1YCHGO09PjNBfCqTRByMWI0RVqoPfVxr0VxfD6UnWyu+9jzt4Swv4o/uZnq9b9k 3zig== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=fNP6+ygM8w6cTGyyHjAGfLv0kdsZRzrguRwibVqIzvI=; b=LA72S0kcP+bEozu2/F5QqgWjvVbSrnLMha3j7Ei9Xf0dIMnoEFyHa2S+YfBZAGPTr5 A7lPUfxlkYNla1dbrtGPJv9euZ1g1J2shO5f5Ni+9p9IoYnIoZ71c/togL9nH+qrwTqN bW1TWbred5jQgbTDKJ47NVeYLboQI7PAW6UT+i18YWjT0pKbbROMWi1BBFI/IqWWpElC weQl+NXXgT4ajUY5FMIRjWGObGx/AHVVVrPRujnlM6mX+SHJUw0bU76TVlcs3qY500e4 pPVow2tztPPJlehYktc3QjgKSZtnJyByt5RwtEHYm0ls1JcVny/uLUVCG4x0g1ln9AbO 4Qag== 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 d12si6067319pla.351.2019.02.15.09.07.46; Fri, 15 Feb 2019 09:08:08 -0800 (PST) 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 S1727658AbfBORDO (ORCPT + 99 others); Fri, 15 Feb 2019 12:03:14 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:35654 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726028AbfBORDM (ORCPT ); Fri, 15 Feb 2019 12:03:12 -0500 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 Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)))) -- 2.20.1