ARM: arrange show_pte() to issue severity-based messages
authorRussell King <rmk+kernel@armlinux.org.uk>
Tue, 29 Jan 2019 15:44:38 +0000 (15:44 +0000)
committerRussell King <rmk+kernel@armlinux.org.uk>
Thu, 20 Jun 2019 21:29:23 +0000 (22:29 +0100)
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>
arch/arm/include/asm/bug.h
arch/arm/kernel/traps.c
arch/arm/mm/fault.c

index 36c951d..deef4d0 100644 (file)
@@ -85,7 +85,7 @@ void hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int,
 extern asmlinkage void c_backtrace(unsigned long fp, int pmode);
 
 struct mm_struct;
-extern void show_pte(struct mm_struct *mm, unsigned long addr);
+void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr);
 extern void __show_regs(struct pt_regs *);
 
 #endif
index 30bffde..3d7b48d 100644 (file)
@@ -729,7 +729,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs)
                pr_err("[%d] %s: bad data abort: code %d instr 0x%08lx\n",
                       task_pid_nr(current), current->comm, code, instr);
                dump_instr(KERN_ERR, regs);
-               show_pte(current->mm, addr);
+               show_pte(KERN_ERR, current->mm, addr);
        }
 #endif
 
index 743a9e0..b4cade5 100644 (file)
@@ -56,17 +56,16 @@ static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr)
  * This is useful to dump out the page tables associated with
  * 'addr' in mm 'mm'.
  */
-void show_pte(struct mm_struct *mm, unsigned long addr)
+void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr)
 {
        pgd_t *pgd;
 
        if (!mm)
                mm = &init_mm;
 
-       pr_alert("pgd = %p\n", mm->pgd);
+       printk("%spgd = %p\n", lvl, mm->pgd);
        pgd = pgd_offset(mm, addr);
-       pr_alert("[%08lx] *pgd=%08llx",
-                       addr, (long long)pgd_val(*pgd));
+       printk("%s[%08lx] *pgd=%08llx", lvl, addr, (long long)pgd_val(*pgd));
 
        do {
                pud_t *pud;
@@ -121,7 +120,7 @@ void show_pte(struct mm_struct *mm, unsigned long addr)
        pr_cont("\n");
 }
 #else                                  /* CONFIG_MMU */
-void show_pte(struct mm_struct *mm, unsigned long addr)
+void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr)
 { }
 #endif                                 /* CONFIG_MMU */
 
@@ -147,7 +146,7 @@ __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
                 (addr < PAGE_SIZE) ? "NULL pointer dereference" :
                 "paging request", addr);
 
-       show_pte(mm, addr);
+       show_pte(KERN_ALERT, mm, addr);
        die("Oops", regs, fsr);
        bust_spinlocks(0);
        do_exit(SIGKILL);
@@ -169,9 +168,9 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr,
        if (((user_debug & UDBG_SEGV) && (sig == SIGSEGV)) ||
            ((user_debug & UDBG_BUS)  && (sig == SIGBUS))) {
                pr_err("8<--- cut here ---\n");
-               printk(KERN_DEBUG "%s: unhandled page fault (%d) at 0x%08lx, code 0x%03x\n",
+               pr_err("%s: unhandled page fault (%d) at 0x%08lx, code 0x%03x\n",
                       tsk->comm, sig, addr, fsr);
-               show_pte(tsk->mm, addr);
+               show_pte(KERN_ERR, tsk->mm, addr);
                show_regs(regs);
        }
 #endif
@@ -561,7 +560,7 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
        pr_alert("8<--- cut here ---\n");
        pr_alert("Unhandled fault: %s (0x%03x) at 0x%08lx\n",
                inf->name, fsr, addr);
-       show_pte(current->mm, addr);
+       show_pte(KERN_ALERT, current->mm, addr);
 
        arm_notify_die("", regs, inf->sig, inf->code, (void __user *)addr,
                       fsr, 0);