From a38671d65dce25d2390338fe9d272de6302334db Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Mon, 19 Sep 2016 18:04:51 -0400 Subject: parisc: Migrate exception table users off module.h and onto extable.h This file was only including module.h for exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and avoid all the extra header content in module.h that we don't really need to compile this file. Cc: "James E.J. Bottomley" Cc: Helge Deller Cc: linux-parisc@vger.kernel.org Signed-off-by: Paul Gortmaker Signed-off-by: Helge Deller diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index 47a6ca4..d64f1c8 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include -- cgit v0.10.2 From 65bf34f59594c11f13d371c5334a6a0a385cd7ae Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Sun, 9 Oct 2016 09:57:54 +0200 Subject: parisc: Increase initial kernel mapping size Increase the initial kernel default page mapping size for 64-bit kernels to 64 MB and for 32-bit kernels to 32 MB. Due to the additional support of ftrace, tracepoint and huge pages the kernel size can exceed the sizes we used up to now. Cc: stable@vger.kernel.org # 4.4+ Signed-off-by: Helge Deller diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h index e44bdb9..c2c43f7 100644 --- a/arch/parisc/include/asm/pgtable.h +++ b/arch/parisc/include/asm/pgtable.h @@ -83,10 +83,10 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr) printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, (unsigned long)pgd_val(e)) /* This is the size of the initially mapped kernel memory */ -#if defined(CONFIG_64BIT) || defined(CONFIG_SMP) -#define KERNEL_INITIAL_ORDER 25 /* 1<<25 = 32MB */ +#if defined(CONFIG_64BIT) +#define KERNEL_INITIAL_ORDER 26 /* 1<<26 = 64MB */ #else -#define KERNEL_INITIAL_ORDER 24 /* 1<<24 = 16MB */ +#define KERNEL_INITIAL_ORDER 25 /* 1<<25 = 32MB */ #endif #define KERNEL_INITIAL_SIZE (1 << KERNEL_INITIAL_ORDER) -- cgit v0.10.2 From f8850abb7ba68229838014b3409460e576751c6d Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Sun, 9 Oct 2016 11:12:34 +0200 Subject: parisc: Fix kernel memory layout regarding position of __gp Architecturally we need to keep __gp below 0x1000000. But because of ftrace and tracepoint support, the RO_DATA_SECTION now gets much bigger than it was before. By moving the linkage tables before RO_DATA_SECTION we can avoid that __gp gets positioned at a too high address. Cc: stable@vger.kernel.org # 4.4+ Signed-off-by: Helge Deller diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S index b37787d..9a44e92 100644 --- a/arch/parisc/kernel/vmlinux.lds.S +++ b/arch/parisc/kernel/vmlinux.lds.S @@ -90,8 +90,9 @@ SECTIONS /* Start of data section */ _sdata = .; - RO_DATA_SECTION(8) - + /* Architecturally we need to keep __gp below 0x1000000 and thus + * in front of RO_DATA_SECTION() which stores lots of tracepoint + * and ftrace symbols. */ #ifdef CONFIG_64BIT . = ALIGN(16); /* Linkage tables */ @@ -106,6 +107,8 @@ SECTIONS } #endif + RO_DATA_SECTION(8) + /* unwind info */ .PARISC.unwind : { __start___unwind = .; -- cgit v0.10.2 From f79b076eb3a8fa70662584f3ac63ab16787a79a0 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Sun, 9 Oct 2016 11:20:44 +0200 Subject: parisc: Move exception table into read-only section Since BUILDTIME_EXTABLE_SORT is enabled, the exception table can move into the read-only section. Signed-off-by: Helge Deller diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S index 9a44e92..3d6ef1b 100644 --- a/arch/parisc/kernel/vmlinux.lds.S +++ b/arch/parisc/kernel/vmlinux.lds.S @@ -109,6 +109,10 @@ SECTIONS RO_DATA_SECTION(8) + /* RO because of BUILDTIME_EXTABLE_SORT */ + EXCEPTION_TABLE(8) + NOTES + /* unwind info */ .PARISC.unwind : { __start___unwind = .; @@ -124,9 +128,6 @@ SECTIONS . = ALIGN(HUGEPAGE_SIZE); data_start = .; - EXCEPTION_TABLE(8) - NOTES - /* Data */ RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, PAGE_SIZE) -- cgit v0.10.2 From e3b6a02816ebbda3acfde2f079446ba92c97e70b Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Tue, 11 Oct 2016 20:40:02 +0200 Subject: parisc: Zero-initialize newly alloced memblock Commit 4fe9e1d957e4 ("parisc: Drop bootmem and switch to memblock") switched to the memblock allocator, but missed to zero-initialize the newly allocated memblocks. This lead to crashes on some machines like the rp3410. Fixes: 4fe9e1d957e4 ("parisc: Drop bootmem and switch to memblock") Signed-off-by: Helge Deller diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index 356f384..e02ada3 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c @@ -105,6 +105,8 @@ static void * __init get_memblock(unsigned long size) else panic("get_memblock() failed.\n"); + memset(__va(phys), 0, size); + return __va(phys); } -- cgit v0.10.2 From 0a862485f42af7df530b0b5f0e5ba8ffbb3a4a12 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Tue, 11 Oct 2016 20:49:42 +0200 Subject: parisc: Show trap name in kernel crash Show the real trap name when the kernel crashes. Signed-off-by: Helge Deller diff --git a/arch/parisc/include/asm/traps.h b/arch/parisc/include/asm/traps.h index 5e953ab..6367023 100644 --- a/arch/parisc/include/asm/traps.h +++ b/arch/parisc/include/asm/traps.h @@ -11,6 +11,7 @@ void parisc_terminate(char *msg, struct pt_regs *regs, void die_if_kernel(char *str, struct pt_regs *regs, long err); /* mm/fault.c */ +const char *trap_name(unsigned long code); void do_page_fault(struct pt_regs *regs, unsigned long code, unsigned long address); #endif diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c index 97d6b20..378df92 100644 --- a/arch/parisc/kernel/traps.c +++ b/arch/parisc/kernel/traps.c @@ -458,8 +458,8 @@ void parisc_terminate(char *msg, struct pt_regs *regs, int code, unsigned long o } printk("\n"); - printk(KERN_CRIT "%s: Code=%d regs=%p (Addr=" RFMT ")\n", - msg, code, regs, offset); + pr_crit("%s: Code=%d (%s) regs=%p (Addr=" RFMT ")\n", + msg, code, trap_name(code), regs, offset); show_regs(regs); spin_unlock(&terminate_lock); diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index d64f1c8..8ff9253 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c @@ -204,6 +204,16 @@ static const char * const trap_description[] = { [28] "Unaligned data reference trap", }; +const char *trap_name(unsigned long code) +{ + const char *t = NULL; + + if (code < ARRAY_SIZE(trap_description)) + t = trap_description[code]; + + return t ? t : "Unknown trap"; +} + /* * Print out info about fatal segfaults, if the show_unhandled_signals * sysctl is set: @@ -213,8 +223,6 @@ show_signal_msg(struct pt_regs *regs, unsigned long code, unsigned long address, struct task_struct *tsk, struct vm_area_struct *vma) { - const char *trap_name = NULL; - if (!unhandled_signal(tsk, SIGSEGV)) return; @@ -226,10 +234,7 @@ show_signal_msg(struct pt_regs *regs, unsigned long code, tsk->comm, code, address); print_vma_addr(KERN_CONT " in ", regs->iaoq[0]); - if (code < ARRAY_SIZE(trap_description)) - trap_name = trap_description[code]; - pr_warn(KERN_CONT " trap #%lu: %s%c", code, - trap_name ? trap_name : "unknown", + pr_cont(" trap #%lu: %s%c", code, trap_name(code), vma ? ',':'\n'); if (vma) -- cgit v0.10.2