[PATCH] makedumpfile: search for a debug vmlinux

HATAYAMA Daisuke d.hatayama at jp.fujitsu.com
Thu Aug 29 21:11:09 EDT 2013


(2013/08/29 7:08), Cliff Wickman wrote:
> From: Cliff Wickman <cpw at sgi.com>
> 
> 
> makedumpfile needs the debug info from either /proc/vmcore or in vmlinux
> to know how to find free pages using the buddy method.
> 
> The distro procedures do not pass the vmlinux (with the -x option), so
> add a search for a debug vmlinux in the usual locations.
> It's not needed if the page info is in vmcore.  But warn if it is found
> in neither place.
> 

makedumpfile is designed to get necessary debug information from VMCOREINFO note
available from /proc/vmcore. Why do you need vmlinux?

<cut>

> @@ -8740,6 +8747,91 @@ static struct option longopts[] = {
>   	{0, 0, 0, 0}
>   };
>   
> +/*
> + * Look for a debug vmlinux in the usual places.
> + */
> +void
> +find_vmlinux()
> +{
> +	int ret;
> +	char pathname[200];
> +	struct stat stat_buf;
> +
> +	ret = uname(&utsname);
> +	if (ret < 0) {
> +		fprintf(stderr, "uname failed; errno %d", errno);
> +	}
> +
> +	/* these may work if the crash kernel is in multi-user mode */
> +	sprintf(pathname, "/usr/lib/debug/lib/modules/%s/vmlinux",
> +		utsname.release);
> +	if (stat(pathname, &stat_buf) == 0) {
> +		info->name_vmlinux = pathname;
> +		PROGRESS_MSG("Using %s.\n", pathname);
> +		return;
> +	}
> +	sprintf(pathname, "/usr/lib/debug/boot/vmlinux-%s.debug",
> +		utsname.release);
> +	if (stat(pathname, &stat_buf) == 0) {
> +		info->name_vmlinux = pathname;
> +		PROGRESS_MSG("Using %s.\n", pathname);
> +		return;
> +	}
> +	sprintf(pathname, "/boot/vmlinux-%s", utsname.release);
> +	if (stat(pathname, &stat_buf) == 0) {
> +		info->name_vmlinux = pathname;
> +		PROGRESS_MSG("Using %s.\n", pathname);
> +		return;
> +	}
> +
> +	/*
> +	 * the crash kernel normally runs with the root device mounted
> +	 * as /root or /mnt
> +	 */

This depends on distributions and their own kdump/kexec userland configuration
tools. I don't think it a good idea. It is the distribution tools that know
where debuginfo files are located and so they should search for debuginfo files
and they should specify them with -x option.

Basically, makedumpfile should not assume root device in the 2nd kernel since
it could be corrupted due to the same crash causing kdump to be triggered.
Also, debug informaiton is very large file over 100MiB and so should not be
included in kdump initramfs. VMCOREINFO was invented so to suppress amount
of debug informaiton as much as possible.

> +	sprintf(pathname, "/root/usr/lib/debug/lib/modules/%s/vmlinux",
> +		utsname.release);
> +	if (stat(pathname, &stat_buf) == 0) {
> +		info->name_vmlinux = pathname;
> +		PROGRESS_MSG("Using %s.\n", pathname);
> +		return;
> +	}
> +	sprintf(pathname, "/root/usr/lib/debug/boot/vmlinux-%s.debug",
> +		utsname.release);
> +	if (stat(pathname, &stat_buf) == 0) {
> +		info->name_vmlinux = pathname;
> +		PROGRESS_MSG("Using %s.\n", pathname);
> +		return;
> +	}
> +	sprintf(pathname, "/root/boot/vmlinux-%s", utsname.release);
> +	if (stat(pathname, &stat_buf) == 0) {
> +		info->name_vmlinux = pathname;
> +		PROGRESS_MSG("Using %s.\n", pathname);
> +		return;
> +	}
> +	sprintf(pathname, "/mnt/usr/lib/debug/lib/modules/%s/vmlinux",
> +		utsname.release);
> +	if (stat(pathname, &stat_buf) == 0) {
> +		info->name_vmlinux = pathname;
> +		PROGRESS_MSG("Using %s.\n", pathname);
> +		return;
> +	}
> +	sprintf(pathname, "/mnt/usr/lib/debug/boot/vmlinux-%s.debug",
> +		utsname.release);
> +	if (stat(pathname, &stat_buf) == 0) {
> +		info->name_vmlinux = pathname;
> +		PROGRESS_MSG("Using %s.\n", pathname);
> +		return;
> +	}
> +	sprintf(pathname, "/mnt/boot/vmlinux-%s", utsname.release);
> +	if (stat(pathname, &stat_buf) == 0) {
> +		info->name_vmlinux = pathname;
> +		PROGRESS_MSG("Using %s.\n", pathname);
> +		return;
> +	}
> +
> +	no_vmlinux = 1;
> +}
> +


-- 
Thanks.
HATAYAMA, Daisuke




More information about the kexec mailing list