[Crash-utility] [PATCH v3 0/9] teach crash to work with "live" ramdump

Dave Anderson anderson at redhat.com
Wed May 4 16:03:25 UTC 2016


Hi Oleg,

The v3 patchset has been queued for crash-7.1.6:
   
  https://github.com/crash-utility/crash/commit/89ed9d0a7f7da4578294a492c1ad857244ce7352

I added some documentation in help.c for "crash -h", and in the crash.8 man page.
Also, I changed ACTIVE() to LOCAL_ACTIVE() in the x86_64_calc_phys_base() function,
so phys_base will default to 0 instead of being based upon the host kernel's.

So the next stage should be support for creation of a permanent ELF vmcore from
one of these QEMU ramdumps with "crash -o".  AFAICT, it should simply be a matter
of adding this to ramdump_to_elf(): 

--- crash-7.1.5/ramdump.c.orig
+++ crash-7.1.5/ramdump.c
@@ -186,6 +186,8 @@ char *ramdump_to_elf(void)
 		e_machine = EM_AARCH64;
 	else if (machine_type("MIPS"))
 		e_machine = EM_MIPS;
+	else if (machine_type("X86_64"))
+		e_machine = EM_X86_64;
 	else
 		error(FATAL, "ramdump: unsupported machine type: %s\n", 
 			MACHINE_TYPE);

Can you try that patch with an image?  It would be best if it were with a crashed guest
image.  If you want, I can do it, but I will need a pointer to a ramdump image that
I can work with.

Thanks,
  Dave





----- Original Message -----
> Hi Dave,
> 
> Based on your comments, please see the interdiff below.
> 
> Changes:
> 
> 	- s/LIVEDUMP/LIVE_RAMDUMP/
> 
> 	- redefine LOCAL_ACTIVE() using LIVE_RAMDUMP
> 
> 	- change pc->dumpfile to be the name of the first ramdump file
> 
> 	- remove the stale label in ramdump_to_elf()
> 
> Oleg.
> ---
> 
> diff --git a/defs.h b/defs.h
> index d3a03c1..61497a5 100644
> --- a/defs.h
> +++ b/defs.h
> @@ -212,7 +212,7 @@ struct number_option {
>  #define DEVMEM                (0x2000000ULL)
>  #define REM_LIVE_SYSTEM       (0x4000000ULL)
>  #define NAMELIST_LOCAL        (0x8000000ULL)
> -#define LIVEDUMP             (0x10000000ULL)
> +#define LIVE_RAMDUMP         (0x10000000ULL)
>  #define NAMELIST_SAVED       (0x20000000ULL)
>  #define DUMPFILE_SAVED       (0x40000000ULL)
>  #define UNLINK_NAMELIST      (0x80000000ULL)
> @@ -251,11 +251,11 @@ struct number_option {
>  #define PROC_KCORE   (0x8000000000000000ULL)
>  
>  #define ACTIVE()            (pc->flags & LIVE_SYSTEM)
> -#define LOCAL_ACTIVE()      ((pc->flags & LIVE_SYSTEM) && (pc->flags2 &
> MEMSRC_LOCAL))
> +#define LOCAL_ACTIVE()      ((pc->flags & (LIVE_SYSTEM|LIVE_RAMDUMP)) ==
> LIVE_SYSTEM)
>  #define DUMPFILE()          (!(pc->flags & LIVE_SYSTEM))
>  #define LIVE()              (pc->flags2 & LIVE_DUMP || pc->flags &
>  LIVE_SYSTEM)
> -#define MEMORY_SOURCES
> (NETDUMP|KDUMP|MCLXCD|LKCD|DEVMEM|S390D|MEMMOD|DISKDUMP|XENDUMP|CRASHBUILTIN|KVMDUMP|PROC_KCORE|SADUMP|VMWARE_VMSS|LIVEDUMP)
> -#define DUMPFILE_TYPES
> (DISKDUMP|NETDUMP|KDUMP|MCLXCD|LKCD|S390D|XENDUMP|KVMDUMP|SADUMP|VMWARE_VMSS|LIVEDUMP)
> +#define MEMORY_SOURCES
> (NETDUMP|KDUMP|MCLXCD|LKCD|DEVMEM|S390D|MEMMOD|DISKDUMP|XENDUMP|CRASHBUILTIN|KVMDUMP|PROC_KCORE|SADUMP|VMWARE_VMSS|LIVE_RAMDUMP)
> +#define DUMPFILE_TYPES
> (DISKDUMP|NETDUMP|KDUMP|MCLXCD|LKCD|S390D|XENDUMP|KVMDUMP|SADUMP|VMWARE_VMSS|LIVE_RAMDUMP)
>  #define REMOTE()            (pc->flags2 & REMOTE_DAEMON)
>  #define REMOTE_ACTIVE()     (pc->flags & REM_LIVE_SYSTEM)
>  #define REMOTE_DUMPFILE() \
> diff --git a/filesys.c b/filesys.c
> index 2779b2f..c291298 100644
> --- a/filesys.c
> +++ b/filesys.c
> @@ -124,7 +124,6 @@ fd_init(void)
>  	
>  		if (!pc->dumpfile) {
>  			pc->flags |= LIVE_SYSTEM;
> -			pc->flags2 |= MEMSRC_LOCAL;
>  			get_live_memory_source();
>  		}
>  	
> @@ -209,8 +208,7 @@ memory_source_init(void)
>          }
>  
>  	if (pc->dumpfile) {
> -	        if (!(pc->flags & LIVEDUMP) &&
> -	            !file_exists(pc->dumpfile, NULL))
> +	        if (!file_exists(pc->dumpfile, NULL))
>  	        	error(FATAL, "%s: %s\n", pc->dumpfile,
>  				strerror(ENOENT));
>  	
> diff --git a/main.c b/main.c
> index 0fbd10a..075a1e8 100644
> --- a/main.c
> +++ b/main.c
> @@ -430,9 +430,7 @@ main(int argc, char **argv)
>  			}
>  
>  			if (ACTIVE()) {
> -				pc->flags |= LIVEDUMP;
> -				/* disable get_live_memory_source() logic in fd_init() */
> -				pc->dumpfile = "livedump";
> +				pc->flags |= LIVE_RAMDUMP;
>  				pc->readmem = read_ramdump;
>  				pc->writemem = NULL;
>  				optind++;
> diff --git a/memory.c b/memory.c
> index 3339aa2..aa8be87 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -16463,7 +16463,7 @@ memory_page_size(void)
>  	case CRASHBUILTIN:
>  	case KVMDUMP:
>  	case PROC_KCORE:
> -	case LIVEDUMP:
> +	case LIVE_RAMDUMP:
>  		psz = (uint)getpagesize();
>  		break;
>  
> diff --git a/ramdump.c b/ramdump.c
> index 12bfe05..941851c 100644
> --- a/ramdump.c
> +++ b/ramdump.c
> @@ -227,7 +227,7 @@ char *ramdump_to_elf(void)
>  	}
>  
>  	e_file = write_elf(load, e_head, data_offset);
> -end:
> +
>  	free(e_head);
>  	return e_file;
>  }
> @@ -242,7 +242,7 @@ int is_ramdump(char *p)
>  	size_t len;
>  	char *pattern;
>  	struct stat64 st;
> -	int is_live = 0;
> +	int is_live;
>  	int err = 0;
>  
>  	is_live = PREFIX(p, "live:");
> @@ -283,9 +283,11 @@ int is_ramdump(char *p)
>  		pat = NULL;
>  	}
>  
> -	if (nodes && is_live)
> +	if (nodes && is_live) {
>  		pc->flags |= LIVE_SYSTEM;
> -
> +		pc->dumpfile = ramdump[0].path;
> +		pc->live_memsrc = pc->dumpfile;
> +	}
>  	return nodes;
>  }
>  
> 
> 




More information about the Crash-utility mailing list