Skip to contentSkip to conversation

um: add a kmsg_dumper

PATCH New Thomas Meyer 1 participant 1 message Mar 28, 2015 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH v4 2/2 um: add a kmsg_dumper

Add a kmsg_dumper, that dumps the kmsg buffer to stdout, when no console is available. This an enables the printing of early panic() calls triggered in uml_postsetup().
When a panic() call happens so early in the UML kernel no earlyprintk/console is available yet, but with a kmsg_dumper in place the kernel message buffer will be outputted to the user, to give a better hint, of what the failure was.

---
 arch/um/kernel/Makefile    |  2 +-
 arch/um/kernel/kmsg_dump.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 arch/um/kernel/um_arch.c   |  2 ++
 3 files changed, 46 insertions(+), 1 deletion(-)
 create mode 100644 arch/um/kernel/kmsg_dump.c
arch/um/kernel/Makefile +1 -1
index 2d840a0..3345e71 100644
@@ -13,7 +13,7 @@ clean-files :=
 obj-y = config.o exec.o exitcode.o irq.o ksyms.o mem.o \
 	physmem.o process.o ptrace.o reboot.o sigio.o \
 	signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o \
-	um_arch.o umid.o maccess.o skas/
+	um_arch.o umid.o maccess.o kmsg_dump.o skas/
 
 obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
 obj-$(CONFIG_GPROF)	+= gprof_syms.o
arch/um/kernel/kmsg_dump.c new file +43 -0

43 lines not on this page · raw message

arch/um/kernel/um_arch.c +2 -0
index ea92aa1..f1efeee 100644
@@ -11,6 +11,7 @@
 #include <linux/string.h>
 #include <linux/utsname.h>
 #include <linux/sched.h>
+#include <linux/kmsg_dump.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
 #include <asm/sections.h>
@@ -234,6 +235,7 @@ static void __init uml_postsetup(void)
 static int panic_exit(struct notifier_block *self, unsigned long unused1,
 		      void *unused2)
 {
+	kmsg_dump(KMSG_DUMP_PANIC);
 	bust_spinlocks(1);
 	bust_spinlocks(0);
 	uml_exitcode = 1;
Signature · 16 lines
2.1.0





------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel