linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc: Use seq_buf to avoid pr_cont() in __die()
@ 2019-01-08 12:04 Michael Ellerman
  2019-01-08 12:05 ` [PATCH 2/2] powerpc: Show PAGE_SIZE in __die() output Michael Ellerman
  2019-01-08 12:18 ` [PATCH 1/2] powerpc: Use seq_buf to avoid pr_cont() in __die() Christophe Leroy
  0 siblings, 2 replies; 7+ messages in thread
From: Michael Ellerman @ 2019-01-08 12:04 UTC (permalink / raw)
  To: linuxppc-dev

Using pr_cont() risks having our output interleaved with other output
from other CPUs. Instead use a seq_buf to construct the line and then
print it as a whole.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/traps.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 64936b60d521..431a86d3f772 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -38,6 +38,7 @@
 #include <linux/kdebug.h>
 #include <linux/ratelimit.h>
 #include <linux/context_tracking.h>
+#include <linux/seq_buf.h>
 #include <linux/smp.h>
 #include <linux/console.h>
 #include <linux/kmsg_dump.h>
@@ -255,26 +256,34 @@ NOKPROBE_SYMBOL(oops_end);
 
 static int __die(const char *str, struct pt_regs *regs, long err)
 {
+	char buf[128]; /* enough for all flags and a long platform name */
+	struct seq_buf s;
+
+	seq_buf_init(&s, buf, sizeof(buf));
+
 	printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
 
 	if (IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN))
-		printk("LE ");
+		seq_buf_puts(&s, "LE ");
 	else
-		printk("BE ");
+		seq_buf_puts(&s, "BE ");
 
 	if (IS_ENABLED(CONFIG_PREEMPT))
-		pr_cont("PREEMPT ");
+		seq_buf_puts(&s, "PREEMPT ");
 
 	if (IS_ENABLED(CONFIG_SMP))
-		pr_cont("SMP NR_CPUS=%d ", NR_CPUS);
+		seq_buf_printf(&s, "SMP NR_CPUS=%d ", NR_CPUS);
 
 	if (debug_pagealloc_enabled())
-		pr_cont("DEBUG_PAGEALLOC ");
+		seq_buf_puts(&s, "DEBUG_PAGEALLOC ");
 
 	if (IS_ENABLED(CONFIG_NUMA))
-		pr_cont("NUMA ");
+		seq_buf_puts(&s, "NUMA ");
+
+	if (ppc_md.name)
+		seq_buf_puts(&s, ppc_md.name);
 
-	pr_cont("%s\n", ppc_md.name ? ppc_md.name : "");
+	printk("%s\n", buf);
 
 	if (notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV) == NOTIFY_STOP)
 		return 1;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-01-10 10:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-08 12:04 [PATCH 1/2] powerpc: Use seq_buf to avoid pr_cont() in __die() Michael Ellerman
2019-01-08 12:05 ` [PATCH 2/2] powerpc: Show PAGE_SIZE in __die() output Michael Ellerman
2019-01-08 12:21   ` Christophe Leroy
2019-01-09  7:47     ` Christophe Leroy
2019-01-10  1:02       ` Michael Ellerman
2019-01-08 12:18 ` [PATCH 1/2] powerpc: Use seq_buf to avoid pr_cont() in __die() Christophe Leroy
2019-01-10 10:54   ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).