Skip to contentSkip to conversation

arch/x86: get rid of KERN_CONT in show_fault_oops()

PATCH Superseded Dmitry Vyukov 5 participants 5 messages Jun 25, 2018 – Jun 26, 2018

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 arch/x86: get rid of KERN_CONT in show_fault_oops()

From: Dmitry Vyukov <[email protected]>

KERN_CONT leads to split lines in kernel output
and complicates useful changes to printk like
printing context before each line.

Only acceptable use of continuations is basically
boot-time testing.

Get rid of it.

---

Changes since v1:
- use pr_alert() instead of printk(KERN_ALERT)

---
 arch/x86/mm/fault.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
arch/x86/mm/fault.c +3 -7
index 9a84a0d08727..b9ceeaadde48 100644
@@ -671,13 +671,9 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code,
 			printk(smep_warning, from_kuid(&init_user_ns, current_uid()));
 	}
 
-	printk(KERN_ALERT "BUG: unable to handle kernel ");
-	if (address < PAGE_SIZE)
-		printk(KERN_CONT "NULL pointer dereference");
-	else
-		printk(KERN_CONT "paging request");
-
-	printk(KERN_CONT " at %px\n", (void *) address);
+	pr_alert("BUG: unable to handle kernel %s at %px\n",
+		(address < PAGE_SIZE ? "NULL pointer dereference" :
+		"paging request"), (void *) address);
 
 	dump_pagetable(address);
 }
Signature · 1 line
2.18.0.rc2.346.g013aa6912e-goog
#1 lore raw

arch/x86/mm/fault.c

Quoted 22 lines · Dmitry Vyukov

From: Dmitry Vyukov <[email protected]>

KERN_CONT leads to split lines in kernel output
and complicates useful changes to printk like
printing context before each line.

Only acceptable use of continuations is basically
boot-time testing.

Get rid of it.

---

Changes since v1:
- use pr_alert() instead of printk(KERN_ALERT)

---
 arch/x86/mm/fault.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
arch/x86/mm/fault.c +0 -0

[]

Quoted 4 lines
arch/x86/mm/fault.c +0 -0
@@ -671,13 +671,9 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code,
 			printk(smep_warning, from_kuid(&init_user_ns, current_uid()));
 	}
 

arch/x86/mm/fault.c show_fault_oops(struct pt_regs *regs, unsigned long error_code, · line 676

Quoted 10 lines
arch/x86/mm/fault.c +3 -7
-	printk(KERN_ALERT "BUG: unable to handle kernel ");
-	if (address < PAGE_SIZE)
-		printk(KERN_CONT "NULL pointer dereference");
-	else
-		printk(KERN_CONT "paging request");
-
-	printk(KERN_CONT " at %px\n", (void *) address);
+	pr_alert("BUG: unable to handle kernel %s at %px\n",
+		(address < PAGE_SIZE ? "NULL pointer dereference" :
+		"paging request"), (void *) address);

Perhaps remove the used-once KERN_CRIT uses of
nx_warning and smep_warning strings and maybe the
unnecessary parentheses and spaces used here too.

#2 lore raw
Quoted 28 lines · Joe Perches

arch/x86/mm/fault.c

Quoted 22 lines · Dmitry Vyukov

From: Dmitry Vyukov <[email protected]>

KERN_CONT leads to split lines in kernel output
and complicates useful changes to printk like
printing context before each line.

Only acceptable use of continuations is basically
boot-time testing.

Get rid of it.

---

Changes since v1:
- use pr_alert() instead of printk(KERN_ALERT)

---
 arch/x86/mm/fault.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
arch/x86/mm/fault.c +0 -0

[]

Quoted 4 lines
arch/x86/mm/fault.c +0 -0
@@ -671,13 +671,9 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code,
                      printk(smep_warning, from_kuid(&init_user_ns, current_uid()));
      }
 
Quoted 14 lines

arch/x86/mm/fault.c show_fault_oops(struct pt_regs *regs, unsigned long error_code, · line 676

Quoted 10 lines
arch/x86/mm/fault.c +3 -7
-     printk(KERN_ALERT "BUG: unable to handle kernel ");
-     if (address < PAGE_SIZE)
-             printk(KERN_CONT "NULL pointer dereference");
-     else
-             printk(KERN_CONT "paging request");
-
-     printk(KERN_CONT " at %px\n", (void *) address);
+     pr_alert("BUG: unable to handle kernel %s at %px\n",
+             (address < PAGE_SIZE ? "NULL pointer dereference" :
+             "paging request"), (void *) address);

Perhaps remove the used-once KERN_CRIT uses of
nx_warning and smep_warning strings and maybe the
unnecessary parentheses and spaces used here too.

Mailed v3 with both changes.

Andy actually already pointed to parentheses in v1 but I forgot about it in v2.

Reviewed-by on v2 1/1
#3 lore raw
In reply to Dmitry Vyukov
Quoted 6 lines · Dmitry Vyukov

From: Dmitry Vyukov <[email protected]>

KERN_CONT leads to split lines in kernel output
and complicates useful changes to printk like
printing context before each line.

Quoted 6 lines

Only acceptable use of continuations is basically
boot-time testing.

Get rid of it.

FWIW, looks good to me

	-ss
#4 lore raw

[tip:x86/urgent] x86/mm: Get rid of KERN_CONT in show_fault_oops()

In reply to Dmitry Vyukov
x86/mm: Get rid of KERN_CONT in show_fault_oops()
Commit-ID:  4188f063e3694ccbf2a2044cf17cc325f91e458f
Gitweb:     https://git.kernel.org/tip/4188f063e3694ccbf2a2044cf17cc325f91e458f
Author:     Dmitry Vyukov <[email protected]>
AuthorDate: Mon, 25 Jun 2018 14:38:08 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 26 Jun 2018 09:00:25 +0200

x86/mm: Get rid of KERN_CONT in show_fault_oops()

KERN_CONT leads to split lines in kernel output
and complicates useful changes to printk like
printing context before each line.

Only acceptable use of continuations is basically
boot-time testing.

Get rid of it.

Cc Andy Lutomirski <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Josh Poimboeuf <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
[ Removed unnecessary parentheses and prettified the printk statement. ]
---
 arch/x86/mm/fault.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
arch/x86/mm/fault.c +3 -7
index 9a84a0d08727..ee85766e6329 100644
@@ -671,13 +671,9 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code,
 			printk(smep_warning, from_kuid(&init_user_ns, current_uid()));
 	}
 
-	printk(KERN_ALERT "BUG: unable to handle kernel ");
-	if (address < PAGE_SIZE)
-		printk(KERN_CONT "NULL pointer dereference");
-	else
-		printk(KERN_CONT "paging request");
-
-	printk(KERN_CONT " at %px\n", (void *) address);
+	pr_alert("BUG: unable to handle kernel %s at %px\n",
+		 address < PAGE_SIZE ? "NULL pointer dereference" : "paging request",
+		 (void *)address);
 
 	dump_pagetable(address);
 }