summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-01-29 10:44:38 -0500
committerRussell King <rmk+kernel@armlinux.org.uk>2019-06-20 17:29:23 -0400
commit49b38c345baa1bfdb79ff7f546755c29ea59e028 (patch)
treeb3b966c69f1d5a8cc9e26b5b880cf9c103f2e73c
parentbafeb7a0d9213e64a0e09d149b52abeb0c8798b5 (diff)
ARM: arrange show_pte() to issue severity-based messages
show_pte() is used to print information after various other kernel messages, which themselves are printed at different severities. Include the severity in the show_pte() information so that associated messages are printed with the same severity. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r--arch/arm/include/asm/bug.h2
-rw-r--r--arch/arm/kernel/traps.c2
-rw-r--r--arch/arm/mm/fault.c17
3 files changed, 10 insertions, 11 deletions
diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
index 36c951dd23b8..deef4d0cb3b5 100644
--- a/arch/arm/include/asm/bug.h
+++ b/arch/arm/include/asm/bug.h
@@ -85,7 +85,7 @@ void hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int,
85extern asmlinkage void c_backtrace(unsigned long fp, int pmode); 85extern asmlinkage void c_backtrace(unsigned long fp, int pmode);
86 86
87struct mm_struct; 87struct mm_struct;
88extern void show_pte(struct mm_struct *mm, unsigned long addr); 88void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr);
89extern void __show_regs(struct pt_regs *); 89extern void __show_regs(struct pt_regs *);
90 90
91#endif 91#endif
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 30bffdeac3ac..3d7b48de2aea 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -729,7 +729,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs)
729 pr_err("[%d] %s: bad data abort: code %d instr 0x%08lx\n", 729 pr_err("[%d] %s: bad data abort: code %d instr 0x%08lx\n",
730 task_pid_nr(current), current->comm, code, instr); 730 task_pid_nr(current), current->comm, code, instr);
731 dump_instr(KERN_ERR, regs); 731 dump_instr(KERN_ERR, regs);
732 show_pte(current->mm, addr); 732 show_pte(KERN_ERR, current->mm, addr);
733 } 733 }
734#endif 734#endif
735 735
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 743a9e0a1fda..b4cade58ed7b 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -56,17 +56,16 @@ static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr)
56 * This is useful to dump out the page tables associated with 56 * This is useful to dump out the page tables associated with
57 * 'addr' in mm 'mm'. 57 * 'addr' in mm 'mm'.
58 */ 58 */
59void show_pte(struct mm_struct *mm, unsigned long addr) 59void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr)
60{ 60{
61 pgd_t *pgd; 61 pgd_t *pgd;
62 62
63 if (!mm) 63 if (!mm)
64 mm = &init_mm; 64 mm = &init_mm;
65 65
66 pr_alert("pgd = %p\n", mm->pgd); 66 printk("%spgd = %p\n", lvl, mm->pgd);
67 pgd = pgd_offset(mm, addr); 67 pgd = pgd_offset(mm, addr);
68 pr_alert("[%08lx] *pgd=%08llx", 68 printk("%s[%08lx] *pgd=%08llx", lvl, addr, (long long)pgd_val(*pgd));
69 addr, (long long)pgd_val(*pgd));
70 69
71 do { 70 do {
72 pud_t *pud; 71 pud_t *pud;
@@ -121,7 +120,7 @@ void show_pte(struct mm_struct *mm, unsigned long addr)
121 pr_cont("\n"); 120 pr_cont("\n");
122} 121}
123#else /* CONFIG_MMU */ 122#else /* CONFIG_MMU */
124void show_pte(struct mm_struct *mm, unsigned long addr) 123void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr)
125{ } 124{ }
126#endif /* CONFIG_MMU */ 125#endif /* CONFIG_MMU */
127 126
@@ -147,7 +146,7 @@ __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
147 (addr < PAGE_SIZE) ? "NULL pointer dereference" : 146 (addr < PAGE_SIZE) ? "NULL pointer dereference" :
148 "paging request", addr); 147 "paging request", addr);
149 148
150 show_pte(mm, addr); 149 show_pte(KERN_ALERT, mm, addr);
151 die("Oops", regs, fsr); 150 die("Oops", regs, fsr);
152 bust_spinlocks(0); 151 bust_spinlocks(0);
153 do_exit(SIGKILL); 152 do_exit(SIGKILL);
@@ -169,9 +168,9 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr,
169 if (((user_debug & UDBG_SEGV) && (sig == SIGSEGV)) || 168 if (((user_debug & UDBG_SEGV) && (sig == SIGSEGV)) ||
170 ((user_debug & UDBG_BUS) && (sig == SIGBUS))) { 169 ((user_debug & UDBG_BUS) && (sig == SIGBUS))) {
171 pr_err("8<--- cut here ---\n"); 170 pr_err("8<--- cut here ---\n");
172 printk(KERN_DEBUG "%s: unhandled page fault (%d) at 0x%08lx, code 0x%03x\n", 171 pr_err("%s: unhandled page fault (%d) at 0x%08lx, code 0x%03x\n",
173 tsk->comm, sig, addr, fsr); 172 tsk->comm, sig, addr, fsr);
174 show_pte(tsk->mm, addr); 173 show_pte(KERN_ERR, tsk->mm, addr);
175 show_regs(regs); 174 show_regs(regs);
176 } 175 }
177#endif 176#endif
@@ -561,7 +560,7 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
561 pr_alert("8<--- cut here ---\n"); 560 pr_alert("8<--- cut here ---\n");
562 pr_alert("Unhandled fault: %s (0x%03x) at 0x%08lx\n", 561 pr_alert("Unhandled fault: %s (0x%03x) at 0x%08lx\n",
563 inf->name, fsr, addr); 562 inf->name, fsr, addr);
564 show_pte(current->mm, addr); 563 show_pte(KERN_ALERT, current->mm, addr);
565 564
566 arm_notify_die("", regs, inf->sig, inf->code, (void __user *)addr, 565 arm_notify_die("", regs, inf->sig, inf->code, (void __user *)addr,
567 fsr, 0); 566 fsr, 0);