Skip to contentSkip to conversation

makedumpfile question / request

PATCH In review Dave Anderson 2 participants 3 messages Apr 20, 2009 – Apr 21, 2009 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1214523746.42431240232120653.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com

#1 lore raw
Quoted 18 lines · ----- "Ken'ichi Ohmichi

Hi Dave,

Quoted 2 lines · Dave Anderson

Is there a reason that makedumpfile does not fill in the utsname structure in the compressed dumpfile's header?

Thank you for good point.

makedumpfile does not fill it because makedumpfile might not be able to get kernel debug information (containing symbol system_utsname/init_uts_ns). makedumpfile does not need kernel debug information if dump_level is 0 or 1, and it does not read a new_utsname structure. (check_release() is not called.)

Quoted 4 lines

The data structure does get read into a local new_utsname structure in the check_release() function, but it doesn't get saved and copied into the disk_dump_header in write_kdump_header().

Quoted 6 lines
Quoted 2 lines

It would be helpful if that were in place as a quick ID for what the compressed dumpfile contains.

I feel that is worth.
How about saving new_utsname data into disk_dump_header only if dump_level is 2 or bigger ?

Well, that's certainly preferable than the way it is now.

But let me ask you this...

Given that the init_uts_ns structure is always located in:

(1) unity-mapped memory, or in a mapped kernel region for x86_64/ia64, and
(2) that your initial() function calls get_phys_base() in all cases,

can't you just strip the relevant unity-mapping from the supplied VMCOREINFO/init_uts_ns symbol value, apply the phys_base, and then read it from the vmcore file?

Dave

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#2 lore raw

PATCH 1/1 makedumpfile: Save utsname data into disk_dump_header.(Re: makedumpfile question / request)

Hi Dave,

Quoted 24 lines · Dave Anderson
Quoted 14 lines
Quoted 2 lines

Is there a reason that makedumpfile does not fill in the utsname structure in the compressed dumpfile's header?

Thank you for good point.

makedumpfile does not fill it because makedumpfile might not be able to get kernel debug information (containing symbol system_utsname/init_uts_ns). makedumpfile does not need kernel debug information if dump_level is 0 or 1, and it does not read a new_utsname structure. (check_release() is not called.)

Quoted 4 lines

The data structure does get read into a local new_utsname structure in the check_release() function, but it doesn't get saved and copied into the disk_dump_header in write_kdump_header().

Quoted 5 lines
Quoted 2 lines

It would be helpful if that were in place as a quick ID for what the compressed dumpfile contains.

I feel that is worth.
How about saving new_utsname data into disk_dump_header only if dump_level is 2 or bigger ?

Well, that's certainly preferable than the way it is now.

But let me ask you this...

Quoted 8 lines

Given that the init_uts_ns structure is always located in:

(1) unity-mapped memory, or in a mapped kernel region for x86_64/ia64, and
(2) that your initial() function calls get_phys_base() in all cases,

can't you just strip the relevant unity-mapping from the supplied VMCOREINFO/init_uts_ns symbol value, apply the phys_base, and then read it from the vmcore file?

Thank you for the comment.
We can do it by the attached patch.

Thanks
Ken'ichi Ohmichi

---
[PATCH] Save utsname data into disk_dump_header.

By this patch, makedumpfile saves utsname data into disk_dump_header. The crash utility can output the data by 'help -n' command:

crash> help -n
diskdump_data:

             flags: 6 (KDUMP_CMPRS_LOCAL|ERROR_EXCLUDED)
               dfd: 3
               ofp: 3b29b4d760
      machine_type: 62 (EM_X86_64)

            header: c34c70
           signature: "KDUMP   "
      header_version: 2
             utsname:
               sysname: Linux
              nodename: localhost.localdomain
               release: 2.6.29-rc7
               version: #1 SMP Mon Mar 9 11:20:46 JST 2009
               machine: x86_64
            domainname: (none)
           timestamp:

[snip]

---

makedumpfile.c +20 -10
diff -puN a/makedumpfile.c b/makedumpfile.c
@@ -382,9 +382,8 @@ fallback_to_current_page_size(void)
 }
 
 int
-check_release(void)
+get_utsname(struct utsname *system_utsname)
 {
-	struct utsname system_utsname;
 	unsigned long utsname;
 
 	/*
@@ -398,13 +397,18 @@ check_release(void)
 		ERRMSG("Can't get the symbol of system_utsname.\n");
 		return FALSE;
 	}
-	if (!readmem(VADDR, utsname, &system_utsname, sizeof(struct utsname))){
+	if (!readmem(VADDR, utsname, system_utsname, sizeof(struct utsname))){
 		ERRMSG("Can't get the address of system_utsname.\n");
 		return FALSE;
 	}
+	return TRUE;
+}
 
+int
+check_release(void)
+{
 	if (info->flag_read_vmcoreinfo) {
-		if (strcmp(system_utsname.release, info->release)) {
+		if (strcmp(info->system_utsname.release, info->release)) {
 			ERRMSG("%s and %s don't match.\n",
 			    info->name_vmcoreinfo, info->name_memory);
 			retcd = WRONG_RELEASE;
@@ -412,7 +416,7 @@ check_release(void)
 		}
 	}
 
-	info->kernel_version = get_kernel_version(system_utsname.release);
+	info->kernel_version = get_kernel_version(info->system_utsname.release);
 	if (info->kernel_version == FALSE) {
 		if (!info->flag_read_vmcoreinfo)
 			ERRMSG("Or %s and %s don't match.\n",
@@ -3378,7 +3382,7 @@ get_mem_map(void)
 int
 initial(void)
 {
-	int flag_need_debuginfo;
+	int flag_get_debuginfo = FALSE, flag_need_debuginfo = FALSE;
 
 	if (!(vt.mem_flags & MEMORY_XEN) && info->flag_exclude_xen_dom) {
 		MSG("'-X' option is disable,");
@@ -3398,6 +3402,7 @@ initial(void)
 		if (!read_vmcoreinfo())
 			return FALSE;
 		close_vmcoreinfo();
+		flag_get_debuginfo = TRUE;
 	/*
 	 * Get the debug information for analysis from the kernel file
 	 */
@@ -3413,6 +3418,7 @@ initial(void)
 
 		if (!get_srcfile_info())
 			return FALSE;
+		flag_get_debuginfo = TRUE;
 	} else {
 		/*
 		 * Check whether /proc/vmcore contains vmcoreinfo,
@@ -3438,6 +3444,7 @@ initial(void)
 		if (!read_vmcoreinfo_from_vmcore(info->offset_vmcoreinfo,
 		    info->size_vmcoreinfo, FALSE))
 			return FALSE;
+		flag_get_debuginfo = TRUE;
 	}
 
 	if (!get_value_for_old_linux())
@@ -3454,6 +3461,12 @@ out:
 	if (!get_max_mapnr())
 		return FALSE;
 
+	if (flag_get_debuginfo) {
+		if (!get_machdep_info())
+			return FALSE;
+		if (!get_utsname(&info->system_utsname))
+			return FALSE;
+	}
 	if ((info->max_dump_level <= DL_EXCLUDE_ZERO) && !info->flag_dmesg)
 		flag_need_debuginfo = FALSE;
 	else 
@@ -3465,10 +3478,6 @@ out:
 		else
 			return TRUE;
 	}
-
-	if (!get_machdep_info())
-		return FALSE;
-
 	if (!check_release())
 		return FALSE;
 
@@ -4969,6 +4978,7 @@ write_kdump_header(void)
 	dh->bitmap_blocks
 	    = divideup(info->len_bitmap, dh->block_size);
 	memcpy(&dh->timestamp, &info->timestamp, sizeof(dh->timestamp));
+	memcpy(&dh->utsname, &info->system_utsname, sizeof(dh->utsname));
 
 	size = sizeof(struct disk_dump_header);
 	if (!write_buffer(info->fd_dumpfile, 0, dh, size, info->name_dumpfile))
makedumpfile.h +1 -0
diff -puN a/makedumpfile.h b/makedumpfile.h
@@ -750,6 +750,7 @@ struct splitting_info {
 struct DumpInfo {
 	int32_t		kernel_version;      /* version of first kernel*/
 	struct timeval	timestamp;
+	struct utsname	system_utsname;
 
 	/*
 	 * General info:

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw

Re: [Crash-utility] [PATCH] makedumpfile: Save utsname data into disk_dump_header.(Re: makedumpfile question / request)

Hi Dave,

Quoted 28 lines · Ken'ichi Ohmichi
Quoted 28 lines
Quoted 14 lines
Quoted 2 lines

Is there a reason that makedumpfile does not fill in the utsname structure in the compressed dumpfile's header?

Thank you for good point.

makedumpfile does not fill it because makedumpfile might not be able to get kernel debug information (containing symbol system_utsname/init_uts_ns). makedumpfile does not need kernel debug information if dump_level is 0 or 1, and it does not read a new_utsname structure. (check_release() is not called.)

Quoted 4 lines

The data structure does get read into a local new_utsname structure in the check_release() function, but it doesn't get saved and copied into the disk_dump_header in write_kdump_header().

Quoted 5 lines
Quoted 2 lines

It would be helpful if that were in place as a quick ID for what the compressed dumpfile contains.

I feel that is worth.
How about saving new_utsname data into disk_dump_header only if dump_level is 2 or bigger ?

Well, that's certainly preferable than the way it is now.

But let me ask you this...

Given that the init_uts_ns structure is always located in:

(1) unity-mapped memory, or in a mapped kernel region for x86_64/ia64, and
(2) that your initial() function calls get_phys_base() in all cases,

Quoted 6 lines
Quoted 3 lines

can't you just strip the relevant unity-mapping from the supplied VMCOREINFO/init_uts_ns symbol value, apply the phys_base, and then read it from the vmcore file?

Thank you for the comment.
We can do it by the attached patch.

I forgot to say.
I will take a vacation since tomorrow, and I'll reply to you after 7 May.

Thanks
Ken'ichi Ohmichi

Quoted 150 lines

---
[PATCH] Save utsname data into disk_dump_header.

By this patch, makedumpfile saves utsname data into disk_dump_header. The crash utility can output the data by 'help -n' command:

crash> help -n
diskdump_data:

             flags: 6 (KDUMP_CMPRS_LOCAL|ERROR_EXCLUDED)
               dfd: 3
               ofp: 3b29b4d760
      machine_type: 62 (EM_X86_64)

            header: c34c70
           signature: "KDUMP   "
      header_version: 2
             utsname:
               sysname: Linux
              nodename: localhost.localdomain
               release: 2.6.29-rc7
               version: #1 SMP Mon Mar 9 11:20:46 JST 2009
               machine: x86_64
            domainname: (none)
           timestamp:

[snip]

---
diff -puN a/makedumpfile.c b/makedumpfile.c

makedumpfile.c +20 -10
@@ -382,9 +382,8 @@ fallback_to_current_page_size(void)
 }
 
 int
-check_release(void)
+get_utsname(struct utsname *system_utsname)
 {
-	struct utsname system_utsname;
 	unsigned long utsname;
 
 	/*
@@ -398,13 +397,18 @@ check_release(void)
 		ERRMSG("Can't get the symbol of system_utsname.\n");
 		return FALSE;
 	}
-	if (!readmem(VADDR, utsname, &system_utsname, sizeof(struct utsname))){
+	if (!readmem(VADDR, utsname, system_utsname, sizeof(struct utsname))){
 		ERRMSG("Can't get the address of system_utsname.\n");
 		return FALSE;
 	}
+	return TRUE;
+}
 
+int
+check_release(void)
+{
 	if (info->flag_read_vmcoreinfo) {
-		if (strcmp(system_utsname.release, info->release)) {
+		if (strcmp(info->system_utsname.release, info->release)) {
 			ERRMSG("%s and %s don't match.\n",
 			    info->name_vmcoreinfo, info->name_memory);
 			retcd = WRONG_RELEASE;
@@ -412,7 +416,7 @@ check_release(void)
 		}
 	}
 
-	info->kernel_version = get_kernel_version(system_utsname.release);
+	info->kernel_version = get_kernel_version(info->system_utsname.release);
 	if (info->kernel_version == FALSE) {
 		if (!info->flag_read_vmcoreinfo)
 			ERRMSG("Or %s and %s don't match.\n",
@@ -3378,7 +3382,7 @@ get_mem_map(void)
 int
 initial(void)
 {
-	int flag_need_debuginfo;
+	int flag_get_debuginfo = FALSE, flag_need_debuginfo = FALSE;
 
 	if (!(vt.mem_flags & MEMORY_XEN) && info->flag_exclude_xen_dom) {
 		MSG("'-X' option is disable,");
@@ -3398,6 +3402,7 @@ initial(void)
 		if (!read_vmcoreinfo())
 			return FALSE;
 		close_vmcoreinfo();
+		flag_get_debuginfo = TRUE;
 	/*
 	 * Get the debug information for analysis from the kernel file
 	 */
@@ -3413,6 +3418,7 @@ initial(void)
 
 		if (!get_srcfile_info())
 			return FALSE;
+		flag_get_debuginfo = TRUE;
 	} else {
 		/*
 		 * Check whether /proc/vmcore contains vmcoreinfo,
@@ -3438,6 +3444,7 @@ initial(void)
 		if (!read_vmcoreinfo_from_vmcore(info->offset_vmcoreinfo,
 		    info->size_vmcoreinfo, FALSE))
 			return FALSE;
+		flag_get_debuginfo = TRUE;
 	}
 
 	if (!get_value_for_old_linux())
@@ -3454,6 +3461,12 @@ out:
 	if (!get_max_mapnr())
 		return FALSE;
 
+	if (flag_get_debuginfo) {
+		if (!get_machdep_info())
+			return FALSE;
+		if (!get_utsname(&info->system_utsname))
+			return FALSE;
+	}
 	if ((info->max_dump_level <= DL_EXCLUDE_ZERO) && !info->flag_dmesg)
 		flag_need_debuginfo = FALSE;
 	else 
@@ -3465,10 +3478,6 @@ out:
 		else
 			return TRUE;
 	}
-
-	if (!get_machdep_info())
-		return FALSE;
-
 	if (!check_release())
 		return FALSE;
 
@@ -4969,6 +4978,7 @@ write_kdump_header(void)
 	dh->bitmap_blocks
 	    = divideup(info->len_bitmap, dh->block_size);
 	memcpy(&dh->timestamp, &info->timestamp, sizeof(dh->timestamp));
+	memcpy(&dh->utsname, &info->system_utsname, sizeof(dh->utsname));
 
 	size = sizeof(struct disk_dump_header);
 	if (!write_buffer(info->fd_dumpfile, 0, dh, size, info->name_dumpfile))

diff -puN a/makedumpfile.h b/makedumpfile.h

makedumpfile.h +1 -1
@@ -750,6 +750,7 @@ struct splitting_info {
 struct DumpInfo {
 	int32_t		kernel_version;      /* version of first kernel*/
 	struct timeval	timestamp;
+	struct utsname	system_utsname;
 
 	/*
 	 * General info:
 
--
Quoted 4 lines

Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec