Aaron Tomlin | 24 Apr 20:18 2015
Picon

[PATCH] kmem: introduce -m option

The dump_mem_map() function displays basic data about each entry in the
mem_map[] array, or if an address is specified, just the mem_map[] entry
for that address. This patch introduces the -m option to be used with
'kmem -p' exclusively. When used with -p, a comma-separated list of one or
more struct page members may be specified to generate a custom, formatted
display. For example:

  crash> kmem -p -m mapping,index,_mapcount.counter,_count.counter
  ffffea0000000000	0x0	0	0	0
  ffffea0000000040	0x0	0	-1	1
  ffffea0000000080	0x0	0	-1	1
  ffffea00000000c0	0x0	0	-1	1
  ffffea0000000100	0x0	0	-1	1
  ffffea0000000140	0x0	0	-1	1
  ffffea0000000180	0x0	0	-1	1
  ffffea00000001c0	0x0	0	-1	1
  ffffea0000000200	0x0	0	-1	1
  ffffea0000000240	0x0	0	-1	1
  ...

Signed-off-by: Aaron Tomlin <atomlin <at> redhat.com>
---
 help.c   |   19 +-
 memory.c | 1074 ++++++++++++++++++++++++++++++++++++--------------------------
 2 files changed, 649 insertions(+), 444 deletions(-)

diff --git a/help.c b/help.c
index b2f4d21..76b640a 100644
--- a/help.c
+++ b/help.c
(Continue reading)

Rabin Vincent | 24 Apr 16:09 2015
Picon

[PATCH 1/6] MIPS: fix register numbers

The MIPS general purpose registers in the elf_gregset_t don't start at
index 0 but at index 6.

(Note that the example dump files I provided earlier use the wrong
 offsets; I'll make new ones).
---
 mips.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/mips.c b/mips.c
index c181074..e5567f0 100644
--- a/mips.c
+++ b/mips.c
 <at>  <at>  -47,6 +47,11  <at>  <at>  typedef ulong pte_t;

 #define MIPS_CPU_RIXI	0x00800000llu

+#define MIPS32_EF_R0	6
+#define MIPS32_EF_R29	35
+#define MIPS32_EF_R31	37
+#define MIPS32_EF_CPU0_EPC	40
+
 static struct machine_specific mips_machine_specific = { 0 };

 static void
 <at>  <at>  -520,7 +525,7  <at>  <at>  mips_back_trace_cmd(struct bt_info *bt)

 	if (bt->machdep) {
 		struct mips_regset *regs = bt->machdep;
-		previous.pc = current.ra = regs->regs[31];
(Continue reading)

Aaron Tomlin | 9 Apr 22:22 2015
Picon

[PATCH] kmem: Show a page's _mapcount value in dump_mem_map()

The dump_mem_map() function displays basic data about each entry in the
mem_map[] array, or if an address is specified, just the mem_map[] entry
for that address.

For kernels where the page data structure includes the _mapcount field,
this patch is an enhancement to the "kmem -p" option to include a given
page's _mapcount value to be appended to the traditional output of the
command.

For example:

 crash> kmem -p
       PAGE        PHYSICAL      MAPPING        INDEX  COUNT MAPCOUNT FLAGS
 ffffea0000000000         0                0        0      0        0 0
 ffffea0000000040      1000                0        0      1       -1 1ffff800000400 reserved
 ffffea0000000080      2000                0        0      1       -1 1ffff800000400 reserved
 ffffea00000000c0      3000                0        0      1       -1 1ffff800000400 reserved
 ffffea0000000100      4000                0        0      1       -1 1ffff800000400 reserved
 ...

Please note that a given page's _mapcount value (much like the index field)
is always displayed by default regardless. The relevant kernel sources
should be consulted for the meaning of the hexadecimal bit value.

Signed-off-by: Aaron Tomlin <atomlin <at> redhat.com>
---
 defs.h   |  1 +
 memory.c | 60 ++++++++++++++++++++++++++++++++++++++++++------------------
 2 files changed, 43 insertions(+), 18 deletions(-)

(Continue reading)

Dyno (Hongjun) Fu | 24 Mar 18:03 2015

Re: patch to add vmss memory regions support

Dave,
  patch attached. thanks.
rgds,
Dyno

On 3/24/15 10:00 AM, Dyno Hongjun Fu wrote:
> ---------- Forwarded message ----------
> From: Dave Anderson <anderson <at> redhat.com>
> Date: Tue, Mar 24, 2015 at 7:17 AM
> Subject: Re: [Crash-utility] patch to add vmss memory regions support
> To: "Discussion list for crash utility usage, maintenance and
> development" <crash-utility <at> redhat.com>
> 
> 
> 
> Dyno,
> 
> Can you re-post this path so that it applies cleanly to the
> current git repository?  This is what happens:
> 
>  $ git clone
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_crash-2Dutility_crash.git&d=AwIBaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=g2Vka_25x09RSowRkQw8pA&m=CMSBEaJrUe0l1I8xeRN7TmIsyloBPUmxxxRDdOkWC_0&s=urNZ6YRJ7FSXVWnWZBOKvR8FnqMpawcqdLe_2jNTvo0&e= 
>  Cloning into 'crash'...
>  remote: Counting objects: 811, done.
>  remote: Total 811 (delta 0), reused 0 (delta 0), pack-reused 811
>  Receiving objects: 100% (811/811), 1.87 MiB | 1.04 MiB/s, done.
>  Resolving deltas: 100% (532/532), done.
>  $ cd crash
>  $ patch -p1 < ../vmware_memory_region_support.patch
>  patching file vmware_vmss.c
(Continue reading)

Dyno (Hongjun) Fu | 23 Mar 23:22 2015

patch to add vmss memory regions support

Dave,
 
    attached patch is to  add vmss memroy regions support.

    There might be holes in the memory address saved for PCI etc.
    In such case memory dump is divided into regions. Currently
    up to 3 regions are supported.

    Memory dump larger than 3GB will have the first hole.
    My dropbox space used up, I cannot attach a 4GB memory dump.
    and here is how it looks like in the vmss meta data dump.

3GB:
===
- Group: memory pos=0x1f6f6 size=0xc000090c ------------------------------------
align_mask[0, 0]                         => 0x00ffff
regionsCount                             => 0x000000
Memory[0, 0]                             => BLOCK, pos=0x20000, size=0xc0000000

4GB:
=== 
- Group: memory pos=0x1f6f6 size=0x10000090c -----------------------------------
align_mask[0, 0]                         => 0x00ffff
regionsCount                             => 0x000002
regionPageNum[0]                         => 0x000000
regionPPN[0]                             => 0x000000
regionSize[0]                            => 0x0c0000
regionPageNum[1]                         => 0x0c0000
regionPPN[1]                             => 0x100000
regionSize[1]                            => 0x040000
Memory[0, 0]                             => BLOCK, pos=0x20000, size=0x100000000

rgds,
Dyno
diff --git a/vmware_vmss.c b/vmware_vmss.c
index 9a98832..a836221 100644
--- a/vmware_vmss.c
+++ b/vmware_vmss.c
 <at>  <at>  -40,6 +40,8  <at>  <at>  is_vmware_vmss(char *filename)
 		return FALSE;
 	}

+	fclose(fp);
+
 	if (hdr.id != CPTDUMP_OLD_MAGIC_NUMBER &&
 	    hdr.id != CPTDUMP_MAGIC_NUMBER &&
 	    hdr.id != CPTDUMP_PARTIAL_MAGIC_NUMBER &&
 <at>  <at>  -137,8 +139,7  <at>  <at>  vmware_vmss_init(char *filename, FILE *ofp)
 				break;
 			}
 			name[nameLen] = 0;
-			DEBUG_PARSE_PRINT((vmss.ofp, LOGPRX"\t Item %20s",
-					   name));
+			DEBUG_PARSE_PRINT((vmss.ofp, LOGPRX"\t Item %20s", name));

 			nindx = TAG_NINDX(tag);
 			if (nindx > 3) {
 <at>  <at>  -161,6 +162,9  <at>  <at>  vmware_vmss_init(char *filename, FILE *ofp)
 				int compressed = IS_BLOCK_COMPRESSED_TAG(tag);
 				uint16_t padsize;

+				assert(strcmp(name, "Memory") == 0);
+				assert(!compressed);
+
 				if (fread(&nbytes, sizeof(nbytes), 1, vmss.dfp) != 1) {
 					fprintf(vmss.ofp, LOGPRX"Cannot read block size.\n");
 					break;
 <at>  <at>  -186,11 +190,8  <at>  <at>  vmware_vmss_init(char *filename, FILE *ofp)
 				}

 				/* The things that we really care about...*/
-				if (strcmp(grps[i].name, "memory") == 0 &&
-				    strcmp(name, "Memory") == 0) {
-					vmss.memoffset = blockpos;
-					vmss.memsize = nbytesinmem;
-				}
+				vmss.memoffset = blockpos;
+				vmss.memsize = nbytesinmem;

 				DEBUG_PARSE_PRINT((vmss.ofp, "\t=> %sBLOCK: position=%#llx size=%#llx memsize=%#llx\n",
 						  compressed ? "COMPRESSED " : "",
 <at>  <at>  -214,18 +215,21  <at>  <at>  vmware_vmss_init(char *filename, FILE *ofp)

 				if (strcmp(grps[i].name, "memory") == 0) {
 					if (strcmp(name, "regionsCount") == 0) {
-						vmss.regionscount = (uint32_t) *val;
-						if (vmss.regionscount != 0) {
-							fprintf(vmss.ofp, LOGPRX"regionsCount=%d (!= 0) NOT TESTED!",
-							        vmss.regionscount);
-						}
+						vmss.regionscount = *(uint32_t*)val;
+						assert(vmss.regionscount <= MAX_REGIONS);
+					}
+				        if (strcmp(name, "regionPageNum") == 0) {
+						vmss.regions[idx[0]].startpagenum = *(uint32_t*)val;
+					}
+					if (strcmp(name, "regionPPN") == 0) {
+						vmss.regions[idx[0]].startppn = *(uint32_t*)val;
+					}
+					if (strcmp(name, "regionSize") == 0) {
+						vmss.regions[idx[0]].size = *(uint32_t*)val;
 					}
 					if (strcmp(name, "align_mask") == 0) {
-						vmss.alignmask = (uint32_t) *val;
-						if (vmss.alignmask != 0xff) {
-							fprintf(vmss.ofp, LOGPRX"align_mask=%d (!= 0xff) NOT TESTED!",
-							        vmss.regionscount);
-						}
+						vmss.alignmask = *(uint32_t*)val;
+						assert(vmss.alignmask == 0xFFFF);
 					}
 				}

 <at>  <at>  -252,8 +256,8  <at>  <at>  vmware_vmss_init(char *filename, FILE *ofp)
 		}
 		strcpy(p, "vmem");
 		if ((fp = fopen(vmem_filename, "r")) == NULL) {
-			free(vmem_filename);
 			error(INFO, LOGPRX"%s: %s\n", vmem_filename, strerror(errno));
+			free(vmem_filename);
 			return FALSE;
 		}
 		vmss.dfp = fp;
 <at>  <at>  -270,27 +274,35  <at>  <at>  vmware_vmss_init(char *filename, FILE *ofp)

 uint vmware_vmss_page_size(void)
 {
-	return 4096;
+	return PAGE_SIZE;
 }

 int
 read_vmware_vmss(int fd, void *bufptr, int cnt, ulong addr, physaddr_t paddr)
 {
-	uint64_t pos = vmss.memoffset + paddr;
+	uint64_t pos = paddr;
+
+	if (vmss.regionscount > 0) {
+		/* Memory is divided into regions and there are holes between them. */
+		uint32_t ppn = (uint32_t) (pos >> PAGE_SHIFT);
+	        int i;
+
+		for (i = 0; i < vmss.regionscount; i++) {
+			if (ppn < vmss.regions[i].startppn)
+				break;

-	if (pos + cnt > vmss.memoffset + vmss.memsize) {
-		cnt -= ((pos + cnt) - (vmss.memoffset + vmss.memsize));
-		if (cnt < 0) {
-			error(INFO, LOGPRX"Read beyond the end of file! paddr=%#lx\n",
-			      paddr);
+			/* skip holes. */
+			pos -= ((vmss.regions[i].startppn - vmss.regions[i].startpagenum)
+				<< PAGE_SHIFT);
 		}
 	}
+	assert(pos + cnt <= vmss.memsize);

+	pos += vmss.memoffset;
         if (fseek(vmss.dfp, pos, SEEK_SET) != 0)
 		return SEEK_ERROR;

-        if (fread(bufptr, 1 , cnt, vmss.dfp) != cnt)
-		return READ_ERROR;
+	cnt = fread(bufptr, 1, cnt, vmss.dfp);

 	return cnt;
 }
diff --git a/vmware_vmss.h b/vmware_vmss.h
index dcbde2d..3f46188 100644
--- a/vmware_vmss.h
+++ b/vmware_vmss.h
 <at>  <at>  -82,6 +82,14  <at>  <at>  struct cptgroupdesc {
 };
 typedef struct cptgroupdesc	cptgroupdesc;

+struct memregion {
+   uint32_t startpagenum;
+   uint32_t startppn;
+   uint32_t size;
+};
+typedef struct memregion	memregion;
+
+#define MAX_REGIONS	3
 struct vmssdata {
 	int32_t	cpt64bit;
 	FILE	*dfp;
 <at>  <at>  -89,6 +97,7  <at>  <at>  struct vmssdata {
 	/* about the memory */
 	uint32_t	alignmask;
 	uint32_t	regionscount;
+        memregion	regions[MAX_REGIONS];
 	uint64_t	memoffset;
 	uint64_t	memsize;
 };
diff --git a/vmware_vmss.c b/vmware_vmss.c
index 9a98832..a836221 100644
--- a/vmware_vmss.c
+++ b/vmware_vmss.c
 <at>  <at>  -40,6 +40,8  <at>  <at>  is_vmware_vmss(char *filename)
 		return FALSE;
 	}

+	fclose(fp);
+
 	if (hdr.id != CPTDUMP_OLD_MAGIC_NUMBER &&
 	    hdr.id != CPTDUMP_MAGIC_NUMBER &&
 	    hdr.id != CPTDUMP_PARTIAL_MAGIC_NUMBER &&
 <at>  <at>  -137,8 +139,7  <at>  <at>  vmware_vmss_init(char *filename, FILE *ofp)
 				break;
 			}
 			name[nameLen] = 0;
-			DEBUG_PARSE_PRINT((vmss.ofp, LOGPRX"\t Item %20s",
-					   name));
+			DEBUG_PARSE_PRINT((vmss.ofp, LOGPRX"\t Item %20s", name));

 			nindx = TAG_NINDX(tag);
 			if (nindx > 3) {
 <at>  <at>  -161,6 +162,9  <at>  <at>  vmware_vmss_init(char *filename, FILE *ofp)
 				int compressed = IS_BLOCK_COMPRESSED_TAG(tag);
 				uint16_t padsize;

+				assert(strcmp(name, "Memory") == 0);
+				assert(!compressed);
+
 				if (fread(&nbytes, sizeof(nbytes), 1, vmss.dfp) != 1) {
 					fprintf(vmss.ofp, LOGPRX"Cannot read block size.\n");
 					break;
 <at>  <at>  -186,11 +190,8  <at>  <at>  vmware_vmss_init(char *filename, FILE *ofp)
 				}

 				/* The things that we really care about...*/
-				if (strcmp(grps[i].name, "memory") == 0 &&
-				    strcmp(name, "Memory") == 0) {
-					vmss.memoffset = blockpos;
-					vmss.memsize = nbytesinmem;
-				}
+				vmss.memoffset = blockpos;
+				vmss.memsize = nbytesinmem;

 				DEBUG_PARSE_PRINT((vmss.ofp, "\t=> %sBLOCK: position=%#llx size=%#llx memsize=%#llx\n",
 						  compressed ? "COMPRESSED " : "",
 <at>  <at>  -214,18 +215,21  <at>  <at>  vmware_vmss_init(char *filename, FILE *ofp)

 				if (strcmp(grps[i].name, "memory") == 0) {
 					if (strcmp(name, "regionsCount") == 0) {
-						vmss.regionscount = (uint32_t) *val;
-						if (vmss.regionscount != 0) {
-							fprintf(vmss.ofp, LOGPRX"regionsCount=%d (!= 0) NOT TESTED!",
-							        vmss.regionscount);
-						}
+						vmss.regionscount = *(uint32_t*)val;
+						assert(vmss.regionscount <= MAX_REGIONS);
+					}
+				        if (strcmp(name, "regionPageNum") == 0) {
+						vmss.regions[idx[0]].startpagenum = *(uint32_t*)val;
+					}
+					if (strcmp(name, "regionPPN") == 0) {
+						vmss.regions[idx[0]].startppn = *(uint32_t*)val;
+					}
+					if (strcmp(name, "regionSize") == 0) {
+						vmss.regions[idx[0]].size = *(uint32_t*)val;
 					}
 					if (strcmp(name, "align_mask") == 0) {
-						vmss.alignmask = (uint32_t) *val;
-						if (vmss.alignmask != 0xff) {
-							fprintf(vmss.ofp, LOGPRX"align_mask=%d (!= 0xff) NOT TESTED!",
-							        vmss.regionscount);
-						}
+						vmss.alignmask = *(uint32_t*)val;
+						assert(vmss.alignmask == 0xFFFF);
 					}
 				}

 <at>  <at>  -252,8 +256,8  <at>  <at>  vmware_vmss_init(char *filename, FILE *ofp)
 		}
 		strcpy(p, "vmem");
 		if ((fp = fopen(vmem_filename, "r")) == NULL) {
-			free(vmem_filename);
 			error(INFO, LOGPRX"%s: %s\n", vmem_filename, strerror(errno));
+			free(vmem_filename);
 			return FALSE;
 		}
 		vmss.dfp = fp;
 <at>  <at>  -270,27 +274,35  <at>  <at>  vmware_vmss_init(char *filename, FILE *ofp)

 uint vmware_vmss_page_size(void)
 {
-	return 4096;
+	return PAGE_SIZE;
 }

 int
 read_vmware_vmss(int fd, void *bufptr, int cnt, ulong addr, physaddr_t paddr)
 {
-	uint64_t pos = vmss.memoffset + paddr;
+	uint64_t pos = paddr;
+
+	if (vmss.regionscount > 0) {
+		/* Memory is divided into regions and there are holes between them. */
+		uint32_t ppn = (uint32_t) (pos >> PAGE_SHIFT);
+	        int i;
+
+		for (i = 0; i < vmss.regionscount; i++) {
+			if (ppn < vmss.regions[i].startppn)
+				break;

-	if (pos + cnt > vmss.memoffset + vmss.memsize) {
-		cnt -= ((pos + cnt) - (vmss.memoffset + vmss.memsize));
-		if (cnt < 0) {
-			error(INFO, LOGPRX"Read beyond the end of file! paddr=%#lx\n",
-			      paddr);
+			/* skip holes. */
+			pos -= ((vmss.regions[i].startppn - vmss.regions[i].startpagenum)
+				<< PAGE_SHIFT);
 		}
 	}
+	assert(pos + cnt <= vmss.memsize);

+	pos += vmss.memoffset;
         if (fseek(vmss.dfp, pos, SEEK_SET) != 0)
 		return SEEK_ERROR;

-        if (fread(bufptr, 1 , cnt, vmss.dfp) != cnt)
-		return READ_ERROR;
+	cnt = fread(bufptr, 1, cnt, vmss.dfp);

 	return cnt;
 }
diff --git a/vmware_vmss.h b/vmware_vmss.h
index dcbde2d..3f46188 100644
--- a/vmware_vmss.h
+++ b/vmware_vmss.h
 <at>  <at>  -82,6 +82,14  <at>  <at>  struct cptgroupdesc {
 };
 typedef struct cptgroupdesc	cptgroupdesc;

+struct memregion {
+   uint32_t startpagenum;
+   uint32_t startppn;
+   uint32_t size;
+};
+typedef struct memregion	memregion;
+
+#define MAX_REGIONS	3
 struct vmssdata {
 	int32_t	cpt64bit;
 	FILE	*dfp;
 <at>  <at>  -89,6 +97,7  <at>  <at>  struct vmssdata {
 	/* about the memory */
 	uint32_t	alignmask;
 	uint32_t	regionscount;
+        memregion	regions[MAX_REGIONS];
 	uint64_t	memoffset;
 	uint64_t	memsize;
 };
Dietmar Hahn | 11 Mar 13:57 2015

[PATCH] xen: support changed item in struct domain

Hi,

with xen version 4.2.5 in struct domain the item is_paused_by_controller
got changed to controller_pause_count and hence crash doesn't work on
newer xen environments.
This patch allows to support older and newer xen versions.

Dietmar.

diff -pNaur crash-7.1.0-org/xen_hyper.c crash-7.1.0/xen_hyper.c
--- crash-7.1.0-org/xen_hyper.c	2015-02-06 19:44:11.000000000 +0100
+++ crash-7.1.0/xen_hyper.c	2015-03-11 12:02:17.000000000 +0100
 <at>  <at>  -218,7 +218,12  <at>  <at>  xen_hyper_domain_init(void)
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_polling, "domain", "is_polling");

 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_dying, "domain", "is_dying");
+	/*
+	 * With Xen 4.2.5 is_paused_by_controller changed to
+	 * controller_pause_count.
+	 */
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_paused_by_controller, "domain", "is_paused_by_controller");
+	XEN_HYPER_MEMBER_OFFSET_INIT(domain_controller_pause_count, "domain", "controller_pause_count");
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_shutting_down, "domain", "is_shutting_down");
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_shut_down, "domain", "is_shut_down");
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_vcpu, "domain", "vcpu");
 <at>  <at>  -1269,7 +1274,12  <at>  <at>  xen_hyper_store_domain_context(struct xe
 				*(dp + XEN_HYPER_OFFSET(domain_is_polling))) {
 			dc->domain_flags |= XEN_HYPER_DOMS_polling;
 		}
-		if (*(dp + XEN_HYPER_OFFSET(domain_is_paused_by_controller))) {
+		if (XEN_HYPER_VALID_MEMBER(domain_is_paused_by_controller) &&
+			*(dp + XEN_HYPER_OFFSET(domain_is_paused_by_controller))) {
+			dc->domain_flags |= XEN_HYPER_DOMS_ctrl_pause;
+		}
+		if (XEN_HYPER_VALID_MEMBER(domain_controller_pause_count) &&
+			*(dp + XEN_HYPER_OFFSET(domain_controller_pause_count))) {
 			dc->domain_flags |= XEN_HYPER_DOMS_ctrl_pause;
 		}
 		if (*(dp + XEN_HYPER_OFFSET(domain_is_dying))) {
diff -pNaur crash-7.1.0-org/xen_hyper_defs.h crash-7.1.0/xen_hyper_defs.h
--- crash-7.1.0-org/xen_hyper_defs.h	2015-02-06 19:44:11.000000000 +0100
+++ crash-7.1.0/xen_hyper_defs.h	2015-03-11 12:02:17.000000000 +0100
 <at>  <at>  -678,6 +678,10  <at>  <at>  struct xen_hyper_offset_table {
 	long domain_debugger_attached;
 	long domain_is_polling;
 	long domain_is_dying;
+	/*
+	 * This changed from xen-4.2.5 to domain_controller_pause_count.
+	 * See below!
+	 */
 	long domain_is_paused_by_controller;
 	long domain_is_shutting_down;
 	long domain_is_shut_down;
 <at>  <at>  -752,6 +756,8  <at>  <at>  struct xen_hyper_offset_table {
 	long vcpu_runstate_info_state;
 	long vcpu_runstate_info_state_entry_time;
 	long vcpu_runstate_info_time;
+	/* domain - changed item see domain_is_paused_by_controller */
+	long domain_controller_pause_count;
 };

 /*
diff -pNaur crash-7.1.0-org/xen_hyper_dump_tables.c crash-7.1.0/xen_hyper_dump_tables.c
--- crash-7.1.0-org/xen_hyper_dump_tables.c	2015-02-06 19:44:11.000000000 +0100
+++ crash-7.1.0/xen_hyper_dump_tables.c	2015-03-11 12:05:59.000000000 +0100
 <at>  <at>  -784,8 +784,11  <at>  <at>  xen_hyper_dump_xen_hyper_offset_table(ch
 	}
 	XEN_HYPER_PRI(fp, len, "domain_is_dying: ", buf, flag,
 		(buf, "%ld\n", xen_hyper_offset_table.domain_is_dying));
+	/* Only one of next both exists but print both, ones value is -1. */
 	XEN_HYPER_PRI(fp, len, "domain_is_paused_by_controller: ", buf, flag,
 		(buf, "%ld\n", xen_hyper_offset_table.domain_is_paused_by_controller));
+	XEN_HYPER_PRI(fp, len, "domain_controller_pause_count: ", buf, flag,
+		(buf, "%ld\n", xen_hyper_offset_table.domain_controller_pause_count));
 	XEN_HYPER_PRI(fp, len, "domain_is_shutting_down: ", buf, flag,
 		(buf, "%ld\n", xen_hyper_offset_table.domain_is_shutting_down));
 	XEN_HYPER_PRI(fp, len, "domain_is_shut_down: ", buf, flag,

--

-- 
Company details: http://ts.fujitsu.com/imprint.html

Dietmar Hahn | 10 Mar 14:39 2015

Crash problems with Xen

Hi,

for me crash failed to debug xen environments with:

crash: invalid structure member offset: domain_is_paused_by_controller
       FILE: xen_hyper.c  LINE: 1255  FUNCTION: xen_hyper_store_domain_context()

[/usr/bin/crash] error trace: 546170 => 545bc9 => 545a81 => 510fd0

  510fd0: OFFSET_verify+224
  545a81: xen_hyper_store_domain_context+1265
  545bc9: xen_hyper_refresh_domain_context_space+153
  546170: xen_hyper_domain_init+864

The problem is a change of an item in struct domain in xen version 4.2
I tried to fix the problem for me so I can debug the old and the newer
xen versions. I'm not sure this was the right way to fix this.
Thanks.

Dietmar.

diff -pNaur crash-7.1.0-org/xen_hyper.c crash-7.1.0/xen_hyper.c
--- crash-7.1.0-org/xen_hyper.c	2015-02-06 19:44:11.000000000 +0100
+++ crash-7.1.0/xen_hyper.c	2015-03-10 13:57:48.000000000 +0100
 <at>  <at>  -218,7 +218,12  <at>  <at>  xen_hyper_domain_init(void)
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_polling, "domain", "is_polling");

 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_dying, "domain", "is_dying");
+	/*
+	 * In Xen 4.2 is_paused_by_controller changed to
+	 * controller_pause_count.
+	 */
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_paused_by_controller, "domain", "is_paused_by_controller");
+	XEN_HYPER_MEMBER_OFFSET_INIT(domain_controller_pause_count, "domain", "controller_pause_count");
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_shutting_down, "domain", "is_shutting_down");
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_shut_down, "domain", "is_shut_down");
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_vcpu, "domain", "vcpu");
 <at>  <at>  -1269,9 +1274,15  <at>  <at>  xen_hyper_store_domain_context(struct xe
 				*(dp + XEN_HYPER_OFFSET(domain_is_polling))) {
 			dc->domain_flags |= XEN_HYPER_DOMS_polling;
 		}
-		if (*(dp + XEN_HYPER_OFFSET(domain_is_paused_by_controller))) {
+		if (XEN_HYPER_VALID_MEMBER(domain_is_paused_by_controller) &&
+			*(dp + XEN_HYPER_OFFSET(domain_is_paused_by_controller))) {
 			dc->domain_flags |= XEN_HYPER_DOMS_ctrl_pause;
 		}
+		if (XEN_HYPER_VALID_MEMBER(domain_controller_pause_count) &&
+			*(dp + XEN_HYPER_OFFSET(domain_controller_pause_count))) {
+			dc->domain_flags |= XEN_HYPER_DOMS_ctrl_pause;
+		}
+
 		if (*(dp + XEN_HYPER_OFFSET(domain_is_dying))) {
 			dc->domain_flags |= XEN_HYPER_DOMS_dying;
 		}
diff -pNaur crash-7.1.0-org/xen_hyper_defs.h crash-7.1.0/xen_hyper_defs.h
--- crash-7.1.0-org/xen_hyper_defs.h	2015-02-06 19:44:11.000000000 +0100
+++ crash-7.1.0/xen_hyper_defs.h	2015-03-10 13:52:37.000000000 +0100
 <at>  <at>  -679,6 +679,7  <at>  <at>  struct xen_hyper_offset_table {
 	long domain_is_polling;
 	long domain_is_dying;
 	long domain_is_paused_by_controller;
+	long domain_controller_pause_count;
 	long domain_is_shutting_down;
 	long domain_is_shut_down;
 	long domain_vcpu;
diff -pNaur crash-7.1.0-org/xen_hyper_dump_tables.c crash-7.1.0/xen_hyper_dump_tables.c
--- crash-7.1.0-org/xen_hyper_dump_tables.c	2015-02-06 19:44:11.000000000 +0100
+++ crash-7.1.0/xen_hyper_dump_tables.c	2015-03-10 14:00:20.000000000 +0100
 <at>  <at>  -784,8 +784,14  <at>  <at>  xen_hyper_dump_xen_hyper_offset_table(ch
 	}
 	XEN_HYPER_PRI(fp, len, "domain_is_dying: ", buf, flag,
 		(buf, "%ld\n", xen_hyper_offset_table.domain_is_dying));
-	XEN_HYPER_PRI(fp, len, "domain_is_paused_by_controller: ", buf, flag,
-		(buf, "%ld\n", xen_hyper_offset_table.domain_is_paused_by_controller));
+	if (XEN_HYPER_VALID_MEMBER(domain_is_paused_by_controller)) {
+		XEN_HYPER_PRI(fp, len, "domain_is_paused_by_controller: ", buf, flag,
+			(buf, "%ld\n", xen_hyper_offset_table.domain_is_paused_by_controller));
+	}
+	if (XEN_HYPER_VALID_MEMBER(domain_controller_pause_count)) {
+		XEN_HYPER_PRI(fp, len, "domain_controller_pause_count: ", buf, flag,
+			(buf, "%ld\n", xen_hyper_offset_table.domain_controller_pause_count));
+	}
 	XEN_HYPER_PRI(fp, len, "domain_is_shutting_down: ", buf, flag,
 		(buf, "%ld\n", xen_hyper_offset_table.domain_is_shutting_down));
 	XEN_HYPER_PRI(fp, len, "domain_is_shut_down: ", buf, flag,

--

-- 
Company details: http://ts.fujitsu.com/imprint.html

HATAYAMA Daisuke | 20 Feb 02:11 2015

[PATCH] sadump: Support more than 16TB physical memory space

Hello Dave,

This is an sadump enhancement patch.
Could you please apply this?

This patch is made on top of crash-7.1.0.

--
Thanks.
HATAYAMA, Daisuke
Hello Dave,

This is an sadump enhancement patch.
Could you please apply this?

This patch is made on top of crash-7.1.0.

--
Thanks.
HATAYAMA, Daisuke
Sam Watters | 12 Feb 23:04 2015
Picon

[PATCH] Remove lkcd_speedo() output spinner

This patch removes the lkcd_speedo() function and its use.

The lkcd_speedo() function produces a 'spinner' in output when crash is
busy processing kernel crash dump files. The spinner makes the output of
crash commands unpredictable and complicates the parsing of output.  

---
diff -Nurp crash-7.1.0/lkcd_common.c crash-7.1.0+/lkcd_common.c
--- crash-7.1.0/lkcd_common.c	2015-02-06 12:44:11.000000000 -0600
+++ crash-7.1.0+/lkcd_common.c	2015-02-12 11:32:19.000000000 -0600
 <at>  <at>  -618,32 +618,6  <at>  <at>  lkcd_memory_dump(FILE *fp)

 }

-static void
-lkcd_speedo(void)
-{
-        static int i = 0;
-
-        if (pc->flags & SILENT) {
-                return;
-        }
-
-        switch (++i%4) {
-        case 0:
-                lkcd_print("|\b");
-                break;
-        case 1:
-                lkcd_print("\\\b");
-                break;
-        case 2:
-                lkcd_print("-\b");
-                break;
-        case 3:
-                lkcd_print("/\b");
-                break;
-        }
-	fflush(stdout);
-}
-

 /*
  *  The lkcd_lseek() routine does the bulk of the work setting things up 
 <at>  <at>  -856,10 +830,6  <at>  <at>  lkcd_lseek(physaddr_t paddr)
     lseek(lkcd->fd, lkcd->page_offset_max, SEEK_SET);
     eof = FALSE;
     while (!eof) {
-	if( (i++%2048) == 0) {
-	    lkcd_speedo();
-	}
-
 	switch (lkcd_load_dump_page_header(dp, page))
 	{
 	    case LKCD_DUMPFILE_OK:

Sam Watters | 11 Feb 22:04 2015
Picon

[PATCH] RESEND: Suppress lkcd_speedo() spinner in redirected output

Resent using a benign email client

When redirecting output to a file or script the 'spinner' written by the
lkcd_speedo() function complicates parsing output.

Currently the spinner is only suppressed if crash is run with the '-s'
option or the command 'set silent on' has been executed. The change in
this patch suppresses the spinner when the output is redirected to a
pipe or file.

---
diff -Nurp crash-7.1.0//lkcd_common.c crash-7.1.0+//lkcd_common.c
--- crash-7.1.0//lkcd_common.c	2015-02-06 12:44:11.000000000 -0600
+++ crash-7.1.0+//lkcd_common.c	2015-02-11 13:50:11.000000000 -0600
 <at>  <at>  -623,7 +623,8  <at>  <at>  lkcd_speedo(void)
 {
         static int i = 0;

-        if (pc->flags & SILENT) {
+        if (pc->flags & SILENT ||
+			pc->redirect & (REDIRECT_TO_PIPE | REDIRECT_TO_FILE)) {
                 return;
         }

Sam Watters | 11 Feb 21:51 2015
Picon

[PATCH] Suppress lkcd_speedo() spinner in redirected output

When redirecting output to a file or script the 'spinner' written by the 
lkcd_speedo() function complicates parsing output.

Currently the spinner is only suppressed if crash is run with the '-s' 
option or the command 'set silent on' has been executed. The change in 
this patch suppresses the spinner when the output is redirected to a 
pipe or file.

----
diff -Nurp crash-7.1.0//lkcd_common.c crash-7.1.0+//lkcd_common.c
--- crash-7.1.0//lkcd_common.c  2015-02-06 12:44:11.000000000 -0600
+++ crash-7.1.0+//lkcd_common.c 2015-02-11 13:50:11.000000000 -0600
 <at>  <at>  -623,7 +623,8  <at>  <at>  lkcd_speedo(void)
  {
          static int i = 0;

-        if (pc->flags & SILENT) {
+        if (pc->flags & SILENT ||
+                       pc->redirect & (REDIRECT_TO_PIPE | 
REDIRECT_TO_FILE)) {
                  return;
          }


Gmane