]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.8.5/parisc-increase-kernel_initial_size-for-32-bit-smp-kernels.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.8.5 / parisc-increase-kernel_initial_size-for-32-bit-smp-kernels.patch
1 From 690d097c00c88fa9d93d198591e184164b1d8c20 Mon Sep 17 00:00:00 2001
2 From: Helge Deller <deller@gmx.de>
3 Date: Fri, 7 Oct 2016 18:19:55 +0200
4 Subject: parisc: Increase KERNEL_INITIAL_SIZE for 32-bit SMP kernels
5
6 From: Helge Deller <deller@gmx.de>
7
8 commit 690d097c00c88fa9d93d198591e184164b1d8c20 upstream.
9
10 Increase the initial kernel default page mapping size for SMP kernels to 32MB
11 and add a runtime check which panics early if the kernel is bigger than the
12 initial mapping size.
13
14 This fixes boot crashes of 32bit SMP kernels. Due to the introduction of huge
15 page support in kernel 4.4 and it's required initial kernel layout in memory, a
16 32bit SMP kernel usually got bigger (in layout, not size) than 16MB.
17
18 Signed-off-by: Helge Deller <deller@gmx.de>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21 ---
22 arch/parisc/include/asm/pgtable.h | 2 +-
23 arch/parisc/kernel/setup.c | 8 ++++++++
24 2 files changed, 9 insertions(+), 1 deletion(-)
25
26 --- a/arch/parisc/include/asm/pgtable.h
27 +++ b/arch/parisc/include/asm/pgtable.h
28 @@ -83,7 +83,7 @@ static inline void purge_tlb_entries(str
29 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, (unsigned long)pgd_val(e))
30
31 /* This is the size of the initially mapped kernel memory */
32 -#ifdef CONFIG_64BIT
33 +#if defined(CONFIG_64BIT) || defined(CONFIG_SMP)
34 #define KERNEL_INITIAL_ORDER 25 /* 1<<25 = 32MB */
35 #else
36 #define KERNEL_INITIAL_ORDER 24 /* 1<<24 = 16MB */
37 --- a/arch/parisc/kernel/setup.c
38 +++ b/arch/parisc/kernel/setup.c
39 @@ -38,6 +38,7 @@
40 #include <linux/export.h>
41
42 #include <asm/processor.h>
43 +#include <asm/sections.h>
44 #include <asm/pdc.h>
45 #include <asm/led.h>
46 #include <asm/machdep.h> /* for pa7300lc_init() proto */
47 @@ -140,6 +141,13 @@ void __init setup_arch(char **cmdline_p)
48 #endif
49 printk(KERN_CONT ".\n");
50
51 + /*
52 + * Check if initial kernel page mappings are sufficient.
53 + * panic early if not, else we may access kernel functions
54 + * and variables which can't be reached.
55 + */
56 + if (__pa((unsigned long) &_end) >= KERNEL_INITIAL_SIZE)
57 + panic("KERNEL_INITIAL_ORDER too small!");
58
59 pdc_console_init();
60