x86-kmsan-pgtable-reduce-vmalloc-space.patch removed from -mm tree
The quilt patch titled
Subject: x86: kmsan: pgtable: reduce vmalloc space
has been removed from the -mm tree. Its filename was
x86-kmsan-pgtable-reduce-vmalloc-space.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Alexander Potapenko <[email protected]>
Subject: x86: kmsan: pgtable: reduce vmalloc space
Date: Thu, 15 Sep 2022 17:03:43 +0200
KMSAN is going to use 3/4 of existing vmalloc space to hold the metadata, therefore we lower VMALLOC_END to make sure vmalloc() doesn't allocate past the first 1/4.
Signed-off-by Alexander Potapenko <[email protected]>
Cc Alexander Viro <[email protected]>
Cc Alexei Starovoitov <[email protected]>
Cc Andrey Konovalov <[email protected]>
Cc Andrey Konovalov <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc David Rientjes <[email protected]>
Cc Dmitry Vyukov <[email protected]>
Cc Eric Biggers <[email protected]>
Cc Eric Biggers <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Herbert Xu <[email protected]>
Cc Ilya Leoshkevich <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jens Axboe <[email protected]>
Cc Joonsoo Kim <[email protected]>
Cc Kees Cook <[email protected]>
Cc Marco Elver <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Petr Mladek <[email protected]>
Cc Stephen Rothwell <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Vegard Nossum <[email protected]>
Cc Vlastimil Babka <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
arch/x86/include/asm/pgtable_64_types.h | 47 +++++++++++++++++++++- arch/x86/mm/init_64.c | 2 2 files changed, 47 insertions(+), 2 deletions(-)
arch/x86/include/asm/pgtable_64_types.h renamed from arch/x86/include/asm/pgtable_64_types.h~x86-kmsan-pgtable-reduce-vmalloc-space +46 -1
@@ -139,7 +139,52 @@ extern unsigned int ptrs_per_p4d;# define VMEMMAP_START __VMEMMAP_BASE_L4#endif /* CONFIG_DYNAMIC_MEMORY_LAYOUT */ -#define VMALLOC_END (VMALLOC_START + (VMALLOC_SIZE_TB << 40) - 1) +/* +* End of the region for which vmalloc page tables are pre-allocated. +* For non-KMSAN builds, this is the same as VMALLOC_END. +* For KMSAN builds, VMALLOC_START..VMEMORY_END is 4 times bigger than +* VMALLOC_START..VMALLOC_END (see below). +*/ +#define VMEMORY_END (VMALLOC_START + (VMALLOC_SIZE_TB << 40) - 1) + +#ifndef CONFIG_KMSAN +#define VMALLOC_END VMEMORY_END +#else +/* +* In KMSAN builds vmalloc area is four times smaller, and the remaining 3/4 +* are used to keep the metadata for virtual pages. The memory formerly +* belonging to vmalloc area is now laid out as follows: +* +* 1st quarter: VMALLOC_START to VMALLOC_END - new vmalloc area +* 2nd quarter: KMSAN_VMALLOC_SHADOW_START to +* VMALLOC_END+KMSAN_VMALLOC_SHADOW_OFFSET - vmalloc area shadow +* 3rd quarter: KMSAN_VMALLOC_ORIGIN_START to +* VMALLOC_END+KMSAN_VMALLOC_ORIGIN_OFFSET - vmalloc area origins +* 4th quarter: KMSAN_MODULES_SHADOW_START to KMSAN_MODULES_ORIGIN_START +* - shadow for modules, +* KMSAN_MODULES_ORIGIN_START to +* KMSAN_MODULES_ORIGIN_START + MODULES_LEN - origins for modules. +*/ +#define VMALLOC_QUARTER_SIZE ((VMALLOC_SIZE_TB << 40) >> 2) +#define VMALLOC_END (VMALLOC_START + VMALLOC_QUARTER_SIZE - 1) + +/* +* vmalloc metadata addresses are calculated by adding shadow/origin offsets +* to vmalloc address. +*/ +#define KMSAN_VMALLOC_SHADOW_OFFSET VMALLOC_QUARTER_SIZE +#define KMSAN_VMALLOC_ORIGIN_OFFSET (VMALLOC_QUARTER_SIZE << 1) + +#define KMSAN_VMALLOC_SHADOW_START (VMALLOC_START + KMSAN_VMALLOC_SHADOW_OFFSET) +#define KMSAN_VMALLOC_ORIGIN_START (VMALLOC_START + KMSAN_VMALLOC_ORIGIN_OFFSET) + +/* +* The shadow/origin for modules are placed one by one in the last 1/4 of +* vmalloc space. +*/ +#define KMSAN_MODULES_SHADOW_START (VMALLOC_END + KMSAN_VMALLOC_ORIGIN_OFFSET + 1) +#define KMSAN_MODULES_ORIGIN_START (KMSAN_MODULES_SHADOW_START + MODULES_LEN) +#endif /* CONFIG_KMSAN */ #define MODULES_VADDR (__START_KERNEL_map + KERNEL_IMAGE_SIZE)/* The module sections ends with the start of the fixmap */
arch/x86/mm/init_64.c renamed from arch/x86/mm/init_64.c~x86-kmsan-pgtable-reduce-vmalloc-space +1 -1
@@ -1287,7 +1287,7 @@ static void __init preallocate_vmalloc_punsigned long addr;const char *lvl; -for (addr =VMALLOC_START ; addr <=VMALLOC_END ; addr =ALIGN (addr +1 ,PGDIR_SIZE )) { +for (addr =VMALLOC_START ; addr <=VMEMORY_END ; addr =ALIGN (addr +1 ,PGDIR_SIZE )) {pgd_t *pgd =pgd_offset_k (addr);p4d_t *p4d;pud_t *pud;
_
Patches currently in -mm which might be from [email protected] are