[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-f06bdd4001c257792c54dce9427399f2896470af@git.kernel.org>
Date: Thu, 16 Mar 2017 04:10:22 -0700
From: tip-bot for Thomas Garnier <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: thgarnie@...gle.com, sgruszka@...hat.com, rusty@...tcorp.com.au,
tim.c.chen@...ux.intel.com, mcgrof@...nel.org, tglx@...utronix.de,
hpa@...or.com, pavel@....cz, peterz@...radead.org, jgross@...e.com,
vkuznets@...hat.com, boris.ostrovsky@...cle.com,
paul.gortmaker@...driver.com, mhocko@...e.com,
borntraeger@...ibm.com, matt@...eblueprint.co.uk, joro@...tes.org,
linux-kernel@...r.kernel.org, corbet@....net,
akpm@...ux-foundation.org, chris@...is-wilson.co.uk, bp@...e.de,
luto@...nel.org, rjw@...ysocki.net, aryabinin@...tuozzo.com,
keescook@...omium.org, jpoimboe@...hat.com, glider@...gle.com,
mingo@...nel.org, dvyukov@...gle.com, zijun_hu@....com,
rkrcmar@...hat.com, ard.biesheuvel@...aro.org, lstoakes@...il.com,
fweisbec@...il.com, pbonzini@...hat.com,
torvalds@...ux-foundation.org, jikos@...nel.org,
len.brown@...el.com
Subject: [tip:x86/mm] x86/mm: Adapt MODULES_END based on fixmap section size
Commit-ID: f06bdd4001c257792c54dce9427399f2896470af
Gitweb: http://git.kernel.org/tip/f06bdd4001c257792c54dce9427399f2896470af
Author: Thomas Garnier <thgarnie@...gle.com>
AuthorDate: Tue, 14 Mar 2017 10:05:06 -0700
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Thu, 16 Mar 2017 09:06:24 +0100
x86/mm: Adapt MODULES_END based on fixmap section size
This patch aligns MODULES_END to the beginning of the fixmap section.
It optimizes the space available for both sections. The address is
pre-computed based on the number of pages required by the fixmap
section.
It will allow GDT remapping in the fixmap section. The current
MODULES_END static address does not provide enough space for the kernel
to support a large number of processors.
Signed-off-by: Thomas Garnier <thgarnie@...gle.com>
Cc: Alexander Potapenko <glider@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andrey Ryabinin <aryabinin@...tuozzo.com>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Ard Biesheuvel <ard.biesheuvel@...aro.org>
Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>
Cc: Borislav Petkov <bp@...e.de>
Cc: Chris Wilson <chris@...is-wilson.co.uk>
Cc: Christian Borntraeger <borntraeger@...ibm.com>
Cc: Dmitry Vyukov <dvyukov@...gle.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Jiri Kosina <jikos@...nel.org>
Cc: Joerg Roedel <joro@...tes.org>
Cc: Jonathan Corbet <corbet@....net>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Juergen Gross <jgross@...e.com>
Cc: Kees Cook <keescook@...omium.org>
Cc: Len Brown <len.brown@...el.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Lorenzo Stoakes <lstoakes@...il.com>
Cc: Luis R . Rodriguez <mcgrof@...nel.org>
Cc: Matt Fleming <matt@...eblueprint.co.uk>
Cc: Michal Hocko <mhocko@...e.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>
Cc: Paul Gortmaker <paul.gortmaker@...driver.com>
Cc: Pavel Machek <pavel@....cz>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Radim Krčmář <rkrcmar@...hat.com>
Cc: Rafael J . Wysocki <rjw@...ysocki.net>
Cc: Rusty Russell <rusty@...tcorp.com.au>
Cc: Stanislaw Gruszka <sgruszka@...hat.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Tim Chen <tim.c.chen@...ux.intel.com>
Cc: Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: kasan-dev@...glegroups.com
Cc: kernel-hardening@...ts.openwall.com
Cc: kvm@...r.kernel.org
Cc: lguest@...ts.ozlabs.org
Cc: linux-doc@...r.kernel.org
Cc: linux-efi@...r.kernel.org
Cc: linux-mm@...ck.org
Cc: linux-pm@...r.kernel.org
Cc: xen-devel@...ts.xenproject.org
Cc: zijun_hu <zijun_hu@....com>
Link: http://lkml.kernel.org/r/20170314170508.100882-1-thgarnie@google.com
[ Small build fix. ]
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
Documentation/x86/x86_64/mm.txt | 5 ++++-
arch/x86/include/asm/pgtable_64_types.h | 3 ++-
arch/x86/kernel/module.c | 1 +
arch/x86/mm/dump_pagetables.c | 1 +
arch/x86/mm/kasan_init_64.c | 1 +
mm/vmalloc.c | 4 ++++
6 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/Documentation/x86/x86_64/mm.txt b/Documentation/x86/x86_64/mm.txt
index 5724092..ee3f9c3 100644
--- a/Documentation/x86/x86_64/mm.txt
+++ b/Documentation/x86/x86_64/mm.txt
@@ -19,7 +19,7 @@ ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks
ffffffef00000000 - fffffffeffffffff (=64 GB) EFI region mapping space
... unused hole ...
ffffffff80000000 - ffffffff9fffffff (=512 MB) kernel text mapping, from phys 0
-ffffffffa0000000 - ffffffffff5fffff (=1526 MB) module mapping space
+ffffffffa0000000 - ffffffffff5fffff (=1526 MB) module mapping space (variable)
ffffffffff600000 - ffffffffffdfffff (=8 MB) vsyscalls
ffffffffffe00000 - ffffffffffffffff (=2 MB) unused hole
@@ -39,6 +39,9 @@ memory window (this size is arbitrary, it can be raised later if needed).
The mappings are not part of any other kernel PGD and are only available
during EFI runtime calls.
+The module mapping space size changes based on the CONFIG requirements for the
+following fixmap section.
+
Note that if CONFIG_RANDOMIZE_MEMORY is enabled, the direct mapping of all
physical memory, vmalloc/ioremap space and virtual memory map are randomized.
Their order is preserved but their base will be offset early at boot time.
diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h
index 0b2797e..516593e6 100644
--- a/arch/x86/include/asm/pgtable_64_types.h
+++ b/arch/x86/include/asm/pgtable_64_types.h
@@ -68,7 +68,8 @@ typedef struct { pteval_t pte; } pte_t;
#endif /* CONFIG_RANDOMIZE_MEMORY */
#define VMALLOC_END (VMALLOC_START + _AC((VMALLOC_SIZE_TB << 40) - 1, UL))
#define MODULES_VADDR (__START_KERNEL_map + KERNEL_IMAGE_SIZE)
-#define MODULES_END _AC(0xffffffffff000000, UL)
+/* The module sections ends with the start of the fixmap */
+#define MODULES_END __fix_to_virt(__end_of_fixed_addresses + 1)
#define MODULES_LEN (MODULES_END - MODULES_VADDR)
#define ESPFIX_PGD_ENTRY _AC(-2, UL)
#define ESPFIX_BASE_ADDR (ESPFIX_PGD_ENTRY << PGDIR_SHIFT)
diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c
index 477ae80..fad61ca 100644
--- a/arch/x86/kernel/module.c
+++ b/arch/x86/kernel/module.c
@@ -35,6 +35,7 @@
#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/setup.h>
+#include <asm/fixmap.h>
#if 0
#define DEBUGP(fmt, ...) \
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index 58b5bee..75efeec 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -20,6 +20,7 @@
#include <asm/kasan.h>
#include <asm/pgtable.h>
+#include <asm/fixmap.h>
/*
* The dumper groups pagetable entries of the same type into one, and for
diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c
index 8d63d7a..1bde19e 100644
--- a/arch/x86/mm/kasan_init_64.c
+++ b/arch/x86/mm/kasan_init_64.c
@@ -9,6 +9,7 @@
#include <asm/tlbflush.h>
#include <asm/sections.h>
+#include <asm/fixmap.h>
extern pgd_t early_level4_pgt[PTRS_PER_PGD];
extern struct range pfn_mapped[E820_X_MAX];
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 0dd8022..b7d2a23 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -36,6 +36,10 @@
#include <asm/tlbflush.h>
#include <asm/shmparam.h>
+#ifdef CONFIG_X86
+# include <asm/fixmap.h>
+#endif
+
#include "internal.h"
struct vfree_deferred {
Powered by blists - more mailing lists