Skip to content

Commit 49b38c3

Browse files
author
Russell King
committed
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>
1 parent bafeb7a commit 49b38c3

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

‎arch/arm/include/asm/bug.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int,
8585
extern asmlinkage void c_backtrace(unsigned long fp, int pmode);
8686

8787
struct mm_struct;
88-
extern void show_pte(struct mm_struct *mm, unsigned long addr);
88+
void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr);
8989
extern void __show_regs(struct pt_regs *);
9090

9191
#endif

‎arch/arm/kernel/traps.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs)
729729
pr_err("[%d] %s: bad data abort: code %d instr 0x%08lx\n",
730730
task_pid_nr(current), current->comm, code, instr);
731731
dump_instr(KERN_ERR, regs);
732-
show_pte(current->mm, addr);
732+
show_pte(KERN_ERR, current->mm, addr);
733733
}
734734
#endif
735735

‎arch/arm/mm/fault.c‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,16 @@ static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr)
5656
* This is useful to dump out the page tables associated with
5757
* 'addr' in mm 'mm'.
5858
*/
59-
void show_pte(struct mm_struct *mm, unsigned long addr)
59+
void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr)
6060
{
6161
pgd_t *pgd;
6262

6363
if (!mm)
6464
mm = &init_mm;
6565

66-
pr_alert("pgd = %p\n", mm->pgd);
66+
printk("%spgd = %p\n", lvl, mm->pgd);
6767
pgd = pgd_offset(mm, addr);
68-
pr_alert("[%08lx] *pgd=%08llx",
69-
addr, (long long)pgd_val(*pgd));
68+
printk("%s[%08lx] *pgd=%08llx", lvl, addr, (long long)pgd_val(*pgd));
7069

7170
do {
7271
pud_t *pud;
@@ -121,7 +120,7 @@ void show_pte(struct mm_struct *mm, unsigned long addr)
121120
pr_cont("\n");
122121
}
123122
#else /* CONFIG_MMU */
124-
void show_pte(struct mm_struct *mm, unsigned long addr)
123+
void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr)
125124
{ }
126125
#endif /* CONFIG_MMU */
127126

@@ -147,7 +146,7 @@ __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
147146
(addr < PAGE_SIZE) ? "NULL pointer dereference" :
148147
"paging request", addr);
149148

150-
show_pte(mm, addr);
149+
show_pte(KERN_ALERT, mm, addr);
151150
die("Oops", regs, fsr);
152151
bust_spinlocks(0);
153152
do_exit(SIGKILL);
@@ -169,9 +168,9 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr,
169168
if (((user_debug & UDBG_SEGV) && (sig == SIGSEGV)) ||
170169
((user_debug & UDBG_BUS) && (sig == SIGBUS))) {
171170
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",
173172
tsk->comm, sig, addr, fsr);
174-
show_pte(tsk->mm, addr);
173+
show_pte(KERN_ERR, tsk->mm, addr);
175174
show_regs(regs);
176175
}
177176
#endif
@@ -561,7 +560,7 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
561560
pr_alert("8<--- cut here ---\n");
562561
pr_alert("Unhandled fault: %s (0x%03x) at 0x%08lx\n",
563562
inf->name, fsr, addr);
564-
show_pte(current->mm, addr);
563+
show_pte(KERN_ALERT, current->mm, addr);
565564

566565
arm_notify_die("", regs, inf->sig, inf->code, (void __user *)addr,
567566
fsr, 0);

0 commit comments

Comments
 (0)