[PATCH] x86: mm: fault: Use appropriate printk KERN_<level> output

From: Joe Perches
Date: Thu Aug 31 2017 - 14:48:02 EST


printks without KERN_CONT are emitted on separate lines.

Emit the first line at KERN_ALERT and the continuations
at KERN_CONT as necessary.

Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
---
 arch/x86/mm/fault.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 2a1fa10c6a98..4b6125ed216e 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -396,14 +396,18 @@ static void dump_pagetable(unsigned long address)
  pte_t *pte;
 
 #ifdef CONFIG_X86_PAE
- printk("*pdpt = %016Lx ", pgd_val(*pgd));
+ printk(KERN_ALERT "*pdpt = %016Lx ", pgd_val(*pgd));
  if (!low_pfn(pgd_val(*pgd) >> PAGE_SHIFT) || !pgd_present(*pgd))
  goto out;
 #endif
  p4d = p4d_offset(pgd, address);
  pud = pud_offset(p4d, address);
  pmd = pmd_offset(pud, address);
+#ifdef CONFIG_X86_PAE
  printk(KERN_CONT "*pde = %0*Lx ", sizeof(*pmd) * 2, (u64)pmd_val(*pmd));
+#else
+ printk(KERN_ALERT "*pde = %0*Lx ", sizeof(*pmd) * 2, (u64)pmd_val(*pmd));
+#endif
 
  /*
   * We must not directly access the pte in the highpte
@@ -415,9 +419,9 @@ static void dump_pagetable(unsigned long address)
  goto out;
 
  pte = pte_offset_kernel(pmd, address);
- printk("*pte = %0*Lx ", sizeof(*pte) * 2, (u64)pte_val(*pte));
+ printk(KERN_CONT "*pte = %0*Lx ", sizeof(*pte) * 2, (u64)pte_val(*pte));
 out:
- printk("\n");
+ printk(KERN_CONT "\n");
 }
 
 #else /* CONFIG_X86_64: */
@@ -565,7 +569,7 @@ static void dump_pagetable(unsigned long address)
  if (bad_address(pgd))
  goto bad;
 
- printk("PGD %lx ", pgd_val(*pgd));
+ printk(KERN_ALERT "PGD %lx ", pgd_val(*pgd));
 
  if (!pgd_present(*pgd))
  goto out;
@@ -574,7 +578,7 @@ static void dump_pagetable(unsigned long address)
  if (bad_address(p4d))
  goto bad;
 
- printk("P4D %lx ", p4d_val(*p4d));
+ printk(KERN_CONT "P4D %lx ", p4d_val(*p4d));
  if (!p4d_present(*p4d) || p4d_large(*p4d))
  goto out;
 
@@ -582,7 +586,7 @@ static void dump_pagetable(unsigned long address)
  if (bad_address(pud))
  goto bad;
 
- printk("PUD %lx ", pud_val(*pud));
+ printk(KERN_CONT "PUD %lx ", pud_val(*pud));
  if (!pud_present(*pud) || pud_large(*pud))
  goto out;
 
@@ -590,7 +594,7 @@ static void dump_pagetable(unsigned long address)
  if (bad_address(pmd))
  goto bad;
 
- printk("PMD %lx ", pmd_val(*pmd));
+ printk(KERN_CONT "PMD %lx ", pmd_val(*pmd));
  if (!pmd_present(*pmd) || pmd_large(*pmd))
  goto out;
 
@@ -598,12 +602,12 @@ static void dump_pagetable(unsigned long address)
  if (bad_address(pte))
  goto bad;
 
- printk("PTE %lx", pte_val(*pte));
+ printk(KERN_CONT "PTE %lx", pte_val(*pte));
 out:
- printk("\n");
+ printk(KERN_CONT "\n");
  return;
 bad:
- printk("BAD\n");
+ printk(KERN_CONT "BAD\n");
 }
 
 #endif /* CONFIG_X86_64 */
-- 
2.10.0.rc2.1.g053435c