Re: [PATCH] [kdump] Find the PAGESIZE from VMCOREINFO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




----- 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@xxxxxxxxxx>
> ---
> 
>  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

--- crash-6.0.2/netdump.c.orig
+++ crash-6.0.2/netdump.c
@@ -52,7 +52,7 @@ static void kdump_get_osrelease(void);
  * which can differ from the host machine's page size.
  */
 #define READ_PAGESIZE_FROM_VMCOREINFO() \
-	(machine_type("IA64") || machine_type("PPC64"))
+	(machine_type("IA64") || machine_type("PPC64") || machine_type("PPC"))
 
 /*
  * kdump installs NT_PRSTATUS elf notes only to the cpus
@@ -1740,6 +1740,9 @@ dump_Elf32_Nhdr(Elf32_Off offset, int st
 			netdump_print("(unused)\n");
 			nd->vmcoreinfo = (char *)(ptr + note->n_namesz + 1);
 			nd->size_vmcoreinfo = note->n_descsz;
+			if (READ_PAGESIZE_FROM_VMCOREINFO() && store)
+				nd->page_size = (uint)
+					vmcoreinfo_read_integer("PAGESIZE", 0);
 		} else if (eraseinfo) {
 			netdump_print("(unused)\n");
 			if (note->n_descsz)
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux