[Crash-utility] [RFC/PATCH] s390x: Add live dump detection

Michael Holzheu holzheu at linux.vnet.ibm.com
Thu Apr 19 16:28:19 UTC 2012


Hi Dave,

On s390 we will have a dump method that creates live dumps, similar to
the snap.so crash plugin. Because Linux is not stopped while the dump
is created, the resulting dump is not consistent. Therefore it is
important that the crash tool informs the user about this issue.

The dump tool writes a magic number (ASCII "LIVEDUMP") into the first 8
bytes of the dump memory. With this patch this is checked in POST_INIT
by the s390x backend crash code. If the magic is found, the LIVE_SYSTEM
flag is set. This ensures that commands that do not work with /dev/mem
also will fail with s390x live dumps.

Example:

crash> bt -a
bt: -a option not supported on a live system

In addition to that with this patch crash prints a "[LIVE DUMP]" info
tag for live dump files at startup (similar to [PARTIAL DUMP]):

$ crash livedump vmlinux
      KERNEL: /boot/vmlinux
    DUMPFILE: dump.s390 [LIVE DUMP]

Michael
---
 kernel.c |    8 ++++++--
 s390x.c  |   12 ++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

--- a/kernel.c
+++ b/kernel.c
@@ -975,7 +975,9 @@ non_matching_kernel(void)
 	else
         	fprintf(fp, "    DUMPFILE: ");
         if (ACTIVE()) {
-                if (REMOTE_ACTIVE())
+		if (pc->dumpfile)
+			fprintf(fp, "%s [LIVE DUMP]\n", pc->dumpfile);
+		else if (REMOTE_ACTIVE())
                         fprintf(fp, "%s@%s  (remote live system)\n",
                                 pc->server_memsrc, pc->server);
                 else 
@@ -4080,7 +4082,9 @@ display_sys_stats(void)
 	else
 		fprintf(fp, "    DUMPFILE: ");
         if (ACTIVE()) {
-		if (REMOTE_ACTIVE()) 
+		if (pc->dumpfile)
+			fprintf(fp, "%s [LIVE DUMP]\n", pc->dumpfile);
+		else if (REMOTE_ACTIVE())
 			fprintf(fp, "%s@%s  (remote live system)\n",
 			    	pc->server_memsrc, pc->server);
 		else
--- a/s390x.c
+++ b/s390x.c
@@ -328,6 +328,17 @@ static void s390x_process_elf_notes(void
 	}
 }
 
+static void s390x_check_live(void)
+{
+	unsigned long long live_magic;
+
+	readmem(0, KVADDR, &live_magic, sizeof(live_magic),
"live_magic",
+		RETURN_ON_ERROR | QUIET);
+
+	if (live_magic == 0x4c49564544554d50ULL)
+		pc->flags |= LIVE_SYSTEM;
+}
+
 /*
  *  Do all necessary machine-specific setup here.  This is called
several
  *  times during initialization.
@@ -402,6 +413,7 @@ s390x_init(int when)
 		break;
 
 	case POST_INIT:
+		s390x_check_live();
 		break;
 	}
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: crash-6.0.5-s390x-live-dump.patch
Type: text/x-patch
Size: 2402 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20120419/2e070558/attachment.bin>


More information about the Crash-utility mailing list