[Crash-utility] [PATCH] [kdump] Find the PAGESIZE from VMCOREINFO

Dave Anderson anderson at redhat.com
Mon Jan 9 19:29:35 UTC 2012



----- Original Message -----
> { PS: Missed this one in the series posted under
>    [PATCH v3 0/4] Kdump core analysis support for PPC32
> }
> 
> This patch adds support for finding the page size of the crashed system from
> the VMCOREINFO when available. If it is not available, fall back to the old
> methods. This is more useful when we do cross-arch core dump analysis.
> 
> Signed-off-by: Suzuki K. Poulose <suzuki at in.ibm.com>
> ---
> 
>  netdump.c |   27 +++++++++++++++++++++++++--
>  1 files changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/netdump.c b/netdump.c
> index f7bf7d8..3228316 100644
> --- a/netdump.c
> +++ b/netdump.c
> @@ -2700,6 +2700,25 @@ get_kdump_regs(struct bt_info *bt, ulong *eip,
> ulong *esp)
>  	get_netdump_regs(bt, eip, esp);
>  }
>  
> +/*
> + * Get the pagesize of the system from the VMCORE
> + * if it is available.
> + */
> +static uint
> +get_pagesize_vmcoreinfo()
> +{
> +	uint pagesz;
> +	char *buf = nd->vmcoreinfo;
> +
> +	if(!buf)
> +		return 0;
> +	buf = strstr(buf, "PAGESIZE=");
> +	if (!buf)
> +		return 0;
> +	sscanf(buf,"PAGESIZE=%d\n",&pagesz);
> +	return pagesz;
> +}
> +
>  uint
>  kdump_page_size(void)
>  {
> @@ -2708,8 +2727,12 @@ kdump_page_size(void)
>          if (!VMCORE_VALID())
>                  return 0;
>  
> -	if (!(pagesz = nd->page_size))
> -                pagesz = (uint)getpagesize();
> +	if (!(pagesz = nd->page_size)) {
> +		if (nd->vmcoreinfo)
> +			nd->page_size = pagesz = get_pagesize_vmcoreinfo();
> +		if (!pagesz)
> +	                pagesz = (uint)getpagesize();
> +	}
>  
>          return pagesz;
>  }

I'd prefer to use the pre-existing page-size-from-vmcoreinfo algorithm
by applying it to PPC and 32-bit ELF kdumps.  Can you try the attached
patch?

Thanks,
  Dave

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ppc32-pagesize.patch
Type: text/x-patch
Size: 808 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20120109/6a6ccbda/attachment.bin>


More information about the Crash-utility mailing list