Skip to content

Commit eaabf98

Browse files
geertutorvalds
authored andcommitted
sh: fault: modernize printing of kernel messages
- Convert from printk() to pr_*(), - Add missing continuations, - Use "%llx" to format u64, - Join multiple prints in show_fault_oops() into a single print. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Brian Cain <bcain@codeaurora.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Christophe Leroy <christophe.leroy@c-s.fr> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Guan Xuetao <gxt@pku.edu.cn> Cc: James Morse <james.morse@arm.com> Cc: Jonas Bonn <jonas@southpole.se> Cc: Julien Thierry <julien.thierry.kdev@gmail.com> Cc: Ley Foon Tan <ley.foon.tan@intel.com> Cc: Marc Zyngier <maz@kernel.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Paul Mackerras <paulus@samba.org> Cc: Rich Felker <dalias@libc.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Stafford Horne <shorne@gmail.com> Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> Cc: Suzuki K Poulose <suzuki.poulose@arm.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Will Deacon <will@kernel.org> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Link: http://lkml.kernel.org/r/20200414153455.21744-10-rppt@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 2fb4706 commit eaabf98

1 file changed

Lines changed: 18 additions & 20 deletions

File tree

‎arch/sh/mm/fault.c‎

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ static void show_pte(struct mm_struct *mm, unsigned long addr)
4747
pgd = swapper_pg_dir;
4848
}
4949

50-
printk(KERN_ALERT "pgd = %p\n", pgd);
50+
pr_alert("pgd = %p\n", pgd);
5151
pgd += pgd_index(addr);
52-
printk(KERN_ALERT "[%08lx] *pgd=%0*Lx", addr,
53-
(u32)(sizeof(*pgd) * 2), (u64)pgd_val(*pgd));
52+
pr_alert("[%08lx] *pgd=%0*llx", addr, (u32)(sizeof(*pgd) * 2),
53+
(u64)pgd_val(*pgd));
5454

5555
do {
5656
pud_t *pud;
@@ -61,33 +61,33 @@ static void show_pte(struct mm_struct *mm, unsigned long addr)
6161
break;
6262

6363
if (pgd_bad(*pgd)) {
64-
printk("(bad)");
64+
pr_cont("(bad)");
6565
break;
6666
}
6767

6868
pud = pud_offset(pgd, addr);
6969
if (PTRS_PER_PUD != 1)
70-
printk(", *pud=%0*Lx", (u32)(sizeof(*pud) * 2),
71-
(u64)pud_val(*pud));
70+
pr_cont(", *pud=%0*llx", (u32)(sizeof(*pud) * 2),
71+
(u64)pud_val(*pud));
7272

7373
if (pud_none(*pud))
7474
break;
7575

7676
if (pud_bad(*pud)) {
77-
printk("(bad)");
77+
pr_cont("(bad)");
7878
break;
7979
}
8080

8181
pmd = pmd_offset(pud, addr);
8282
if (PTRS_PER_PMD != 1)
83-
printk(", *pmd=%0*Lx", (u32)(sizeof(*pmd) * 2),
84-
(u64)pmd_val(*pmd));
83+
pr_cont(", *pmd=%0*llx", (u32)(sizeof(*pmd) * 2),
84+
(u64)pmd_val(*pmd));
8585

8686
if (pmd_none(*pmd))
8787
break;
8888

8989
if (pmd_bad(*pmd)) {
90-
printk("(bad)");
90+
pr_cont("(bad)");
9191
break;
9292
}
9393

@@ -96,11 +96,11 @@ static void show_pte(struct mm_struct *mm, unsigned long addr)
9696
break;
9797

9898
pte = pte_offset_kernel(pmd, addr);
99-
printk(", *pte=%0*Lx", (u32)(sizeof(*pte) * 2),
100-
(u64)pte_val(*pte));
99+
pr_cont(", *pte=%0*llx", (u32)(sizeof(*pte) * 2),
100+
(u64)pte_val(*pte));
101101
} while (0);
102102

103-
printk("\n");
103+
pr_cont("\n");
104104
}
105105

106106
static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address)
@@ -188,14 +188,12 @@ show_fault_oops(struct pt_regs *regs, unsigned long address)
188188
if (!oops_may_print())
189189
return;
190190

191-
printk(KERN_ALERT "BUG: unable to handle kernel ");
192-
if (address < PAGE_SIZE)
193-
printk(KERN_CONT "NULL pointer dereference");
194-
else
195-
printk(KERN_CONT "paging request");
196-
197-
printk(KERN_CONT " at %08lx\n", address);
198191
printk(KERN_ALERT "PC:");
192+
pr_alert("BUG: unable to handle kernel %s at %08lx\n",
193+
address < PAGE_SIZE ? "NULL pointer dereference"
194+
: "paging request",
195+
address);
196+
pr_alert("PC:");
199197
printk_address(regs->pc, 1);
200198

201199
show_pte(NULL, address);

0 commit comments

Comments
 (0)