Skip to contentSkip to conversation

vmcoreinfo support for dump filtering

PATCH Applied Ken'ichi Ohmichi 6 participants 18 messages Aug 22, 2007 – Oct 19, 2007

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover vmcoreinfo support for dump filtering

Hi Andrew,

This patch set frees the restriction that makedumpfile users should install a vmlinux file (including the debugging information) into each system.

makedumpfile command is the dump filtering feature for kdump. It creates a small dumpfile by filtering unnecessary pages for the analysis. To distinguish unnecessary pages, it needs a vmlinux file including the debugging information. These days, the debugging package becomes a huge file, and it is hard to install it into each system.

To solve the problem, kdump developers discussed it at lkml and kexec-ml. As the result, we reached the conclusion that necessary information for dump filtering (called "vmcoreinfo") should be embedded into the first kernel file and it should be accessed through /proc/vmcore during the second kernel.
(http://www.uwsg.iu.edu/hypermail/linux/kernel/0707.0/1806.html)

Dan Aloni created the patch set for the above implementation.
(http://www.uwsg.iu.edu/hypermail/linux/kernel/0707.1/1053.html)

And I updated it for multi architectures and memory models.
(http://lists.infradead.org/pipermail/kexec/2007-August/000479.html)

PATCH SET:
[1/3] [linux] Add vmcoreinfo
The patch is for linux-2.6.22.
The patch adds the vmcoreinfo data. Its address and size are output to /sys/kernel/vmcoreinfo.

[2/3] [kexec-tools] Pass vmcoreinfo's address and size
The patch is for kexec-tools-testing-20070330.
(http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/)
kexec command gets the address and size of the vmcoreinfo data from /sys/kernel/vmcoreinfo, and passes them to the second kernel through ELF header of /proc/vmcore. When the second kernel is booting, the kernel gets them from the ELF header and creates vmcoreinfo's PT_NOTE segment into /proc/vmcore.

[3/3] [makedumpfile] Extract vmcoreinfo from /proc/vmcore
The patch is for makedumpfile v1.1.6.
(https://sourceforge.net/projects/makedumpfile/)
makedumpfile command extracts the vmcoreinfo data from /proc/vmcore and uses it for dump filtering.

Usage:
- Run the first kernel applied with [PATCH 1/3].
- Preload the second kernel by the kexec-tools applied with [PATCH 2/3].
- Cause panic and switch to the second kernel.
- Get a dumpfile by the makedumpfile applied with [PATCH 3/3]:
(Ex.) # makedumpfile -cd31 /proc/vmcore dumpfile

Thanks
Ken'ichi Ohmichi

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

#1 lore raw

PATCH 1/3 Add vmcoreinfo

[1/3] [linux] Add vmcoreinfo
The patch is for linux-2.6.22.
The patch adds the vmcoreinfo data.
Its address and size are output to /sys/kernel/vmcoreinfo.

Thanks
Ken'ichi Ohmichi

---

---

arch/i386/kernel/machine_kexec.c +13 -0
diff -rpuN a/arch/i386/kernel/machine_kexec.c b/arch/i386/kernel/machine_kexec.c
@@ -10,6 +10,7 @@
 #include <linux/kexec.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/numa.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
 #include <asm/tlbflush.h>
@@ -169,3 +170,15 @@ static int __init parse_crashkernel(char
 	return 0;
 }
 early_param("crashkernel", parse_crashkernel);
+
+void arch_crash_save_vmcoreinfo(void)
+{
+#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
+	SYMBOL(node_data);
+	LENGTH(node_data, MAX_NUMNODES);
+#endif
+#ifdef CONFIG_X86_PAE
+	CONFIG(X86_PAE);
+#endif
+}
+
arch/ia64/kernel/machine_kexec.c +30 -0
diff -rpuN a/arch/ia64/kernel/machine_kexec.c b/arch/ia64/kernel/machine_kexec.c
@@ -15,6 +15,8 @@
 #include <linux/cpu.h>
 #include <linux/irq.h>
 #include <linux/efi.h>
+#include <linux/numa.h>
+#include <linux/mmzone.h>
 #include <asm/mmu_context.h>
 #include <asm/setup.h>
 #include <asm/delay.h>
@@ -125,3 +127,31 @@ void machine_kexec(struct kimage *image)
 	unw_init_running(ia64_machine_kexec, image);
 	for(;;);
 }
+
+void arch_crash_save_vmcoreinfo(void)
+{
+#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
+	SYMBOL(pgdat_list);
+	LENGTH(pgdat_list, MAX_NUMNODES);
+
+	SYMBOL(node_memblk);
+	LENGTH(node_memblk, NR_NODE_MEMBLKS);
+	SIZE(node_memblk_s);
+	OFFSET(node_memblk_s, start_paddr);
+	OFFSET(node_memblk_s, size);
+#endif
+#ifdef CONFIG_PGTABLE_3
+	CONFIG(PGTABLE_3);
+#elif  CONFIG_PGTABLE_4
+	CONFIG(PGTABLE_4);
+#endif
+}
+
+unsigned long paddr_vmcoreinfo_note(void)
+{
+	unsigned long vaddr, paddr;
+	vaddr = (unsigned long)(char *)&vmcoreinfo_note;
+	asm volatile ("tpa %0 = %1" : "=r"(paddr) : "r"(vaddr) : "memory");
+	return paddr;
+}
+
arch/ia64/mm/discontig.c +1 -1
diff -rpuN a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
@@ -47,7 +47,7 @@ struct early_node_data {
 static struct early_node_data mem_data[MAX_NUMNODES] __initdata;
 static nodemask_t memory_less_mask __initdata;
 
-static pg_data_t *pgdat_list[MAX_NUMNODES];
+pg_data_t *pgdat_list[MAX_NUMNODES];
 
 /*
  * To prevent cache aliasing effects, align per-node structures so that they
arch/x86_64/kernel/machine_kexec.c +9 -0
diff -rpuN a/arch/x86_64/kernel/machine_kexec.c b/arch/x86_64/kernel/machine_kexec.c
@@ -10,6 +10,7 @@
 #include <linux/kexec.h>
 #include <linux/string.h>
 #include <linux/reboot.h>
+#include <linux/numa.h>
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
 #include <asm/mmu_context.h>
@@ -257,3 +258,11 @@ static int __init setup_crashkernel(char
 }
 early_param("crashkernel", setup_crashkernel);
 
+void arch_crash_save_vmcoreinfo(void)
+{
+#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
+	SYMBOL(node_data);
+	LENGTH(node_data, MAX_NUMNODES);
+#endif
+}
+
include/asm-ia64/numa.h +1 -0
diff -rpuN a/include/asm-ia64/numa.h b/include/asm-ia64/numa.h
@@ -24,6 +24,7 @@
 
 extern u16 cpu_to_node_map[NR_CPUS] __cacheline_aligned;
 extern cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
+extern pg_data_t *pgdat_list[MAX_NUMNODES];
 
 /* Stuff below this line could be architecture independent */
 
include/linux/kexec.h +26 -0
diff -rpuN a/include/linux/kexec.h b/include/linux/kexec.h
@@ -121,6 +121,23 @@ extern struct page *kimage_alloc_control
 extern void crash_kexec(struct pt_regs *);
 int kexec_should_crash(struct task_struct *);
 void crash_save_cpu(struct pt_regs *regs, int cpu);
+void crash_save_vmcoreinfo(void);
+void arch_crash_save_vmcoreinfo(void);
+void vmcoreinfo_append_str(const char *fmt, ...);
+unsigned long paddr_vmcoreinfo_note(void);
+
+#define SYMBOL(name) \
+	vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)
+#define SIZE(name) \
+	vmcoreinfo_append_str("SIZE(%s)=%d\n", #name, sizeof(struct name))
+#define OFFSET(name, field) \
+	vmcoreinfo_append_str("OFFSET(%s.%s)=%d\n", #name, #field, \
+			      &(((struct name *)0)->field))
+#define LENGTH(name, value) \
+	vmcoreinfo_append_str("LENGTH(%s)=%d\n", #name, value)
+#define CONFIG(name) \
+	vmcoreinfo_append_str("CONFIG_%s=y\n", #name)
+
 extern struct kimage *kexec_image;
 extern struct kimage *kexec_crash_image;
 
@@ -148,11 +165,20 @@ extern struct kimage *kexec_crash_image;
 
 #define KEXEC_FLAGS    (KEXEC_ON_CRASH)  /* List of defined/legal kexec flags */
 
+#define VMCOREINFO_BYTES           (4096)
+#define VMCOREINFO_NOTE_NAME       "VMCOREINFO"
+#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4)
+#define VMCOREINFO_NOTE_SIZE       (KEXEC_NOTE_HEAD_BYTES*2 + VMCOREINFO_BYTES \
+				    + VMCOREINFO_NOTE_NAME_BYTES)
+
 /* Location of a reserved region to hold the crash kernel.
  */
 extern struct resource crashk_res;
 typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4];
 extern note_buf_t *crash_notes;
+extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
+extern unsigned int vmcoreinfo_size;
+extern unsigned int vmcoreinfo_max_size;
 
 
 #else /* !CONFIG_KEXEC */
kernel/kexec.c +110 -0

135 lines not on this page · raw message

kernel/ksysfs.c +10 -0
diff -rpuN a/kernel/ksysfs.c b/kernel/ksysfs.c
@@ -60,6 +60,15 @@ static ssize_t kexec_crash_loaded_show(s
 	return sprintf(page, "%d\n", !!kexec_crash_image);
 }
 KERNEL_ATTR_RO(kexec_crash_loaded);
+
+static ssize_t vmcoreinfo_show(struct kset *kset, char *page)
+{
+	return sprintf(page, "%lx %x\n",
+		       paddr_vmcoreinfo_note(),
+		       vmcoreinfo_max_size);
+}
+KERNEL_ATTR_RO(vmcoreinfo);
+
 #endif /* CONFIG_KEXEC */
 
 decl_subsys(kernel, NULL, NULL);
@@ -73,6 +82,7 @@ static struct attribute * kernel_attrs[]
 #ifdef CONFIG_KEXEC
 	&kexec_loaded_attr.attr,
 	&kexec_crash_loaded_attr.attr,
+	&vmcoreinfo_attr.attr,
 #endif
 	NULL
 };

_

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

#2 lore raw

PATCH 2/3 Pass vmcoreinfo's address and size

In reply to Ken'ichi Ohmichi

[2/3] [kexec-tools] Pass vmcoreinfo's address and size
The patch is for kexec-tools-testing-20070330.
(http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/)
kexec command gets the address and size of the vmcoreinfo data from /sys/kernel/vmcoreinfo, and passes them to the second kernel through ELF header of /proc/vmcore. When the second kernel is booting, the kernel gets them from the ELF header and creates vmcoreinfo's PT_NOTE segment into /proc/vmcore.

Thanks
Ken'ichi Ohmichi

---

---

kexec/crashdump-elf.c renamed from kexec-tools-testing-20070330/kexec/crashdump-elf.c +22 -1
diff -rpuN backup/kexec-tools-testing-20070330/kexec/crashdump-elf.c kexec-tools/kexec/crashdump-elf.c
@@ -36,6 +36,8 @@ int FUNC(struct kexec_info *info,
 	char *bufp;
 	long int nr_cpus = 0;
 	uint64_t notes_addr, notes_len;
+	uint64_t vmcoreinfo_addr, vmcoreinfo_len;
+	int has_vmcoreinfo = 0;
 	int (*get_note_info)(int cpu, uint64_t *addr, uint64_t *len);
 
 	if (xen_present())
@@ -47,7 +49,11 @@ int FUNC(struct kexec_info *info,
 		return -1;
 	}
 
-	sz = sizeof(EHDR) + nr_cpus * sizeof(PHDR) + ranges * sizeof(PHDR);
+	if (get_kernel_vmcoreinfo(&vmcoreinfo_addr, &vmcoreinfo_len) == 0) {
+		has_vmcoreinfo = 1;
+	}
+
+	sz = sizeof(EHDR) + (nr_cpus + has_vmcoreinfo) * sizeof(PHDR) + ranges * sizeof(PHDR);
 
 	/*
 	 * Certain architectures such as x86_64 and ia64 require a separate
@@ -148,6 +154,21 @@ int FUNC(struct kexec_info *info,
 		dfprintf_phdr(stdout, "Elf header", phdr);
 	}
 
+	if (has_vmcoreinfo) {
+		phdr = (PHDR *) bufp;
+		bufp += sizeof(PHDR);
+		phdr->p_type	= PT_NOTE;
+		phdr->p_flags	= 0;
+		phdr->p_offset  = phdr->p_paddr = vmcoreinfo_addr;
+		phdr->p_vaddr   = 0;
+		phdr->p_filesz	= phdr->p_memsz	= vmcoreinfo_len;
+		/* Do we need any alignment of segments? */
+		phdr->p_align	= 0;
+
+		(elf->e_phnum)++;
+		dfprintf_phdr(stdout, "vmcoreinfo header", phdr);
+	}
+
 	/* Setup an PT_LOAD type program header for the region where
 	 * Kernel is mapped if info->kern_size is non-zero.
 	 */
kexec/crashdump.c renamed from kexec-tools-testing-20070330/kexec/crashdump.c +32 -0
diff -rpuN backup/kexec-tools-testing-20070330/kexec/crashdump.c kexec-tools/kexec/crashdump.c
@@ -108,3 +108,35 @@ int get_crash_notes_per_cpu(int cpu, uin
 
 	return 0;
 }
+
+/* Returns the physical address of start of crash notes buffer for a kernel. */
+int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len)
+{
+	char kdump_info[PATH_MAX];
+	char line[MAX_LINE];
+	int count;
+	FILE *fp;
+	unsigned long long temp, temp2;
+
+	*addr = 0;
+	*len = 0;
+
+	sprintf(kdump_info, "/sys/kernel/vmcoreinfo");
+	fp = fopen(kdump_info, "r");
+	if (!fp) {
+		die("Could not open \"%s\": %s\n", kdump_info,
+		    strerror(errno));
+		return -1;
+	}
+
+	if (!fgets(line, sizeof(line), fp))
+		die("Cannot parse %s: %s\n", kdump_info, strerror(errno));
+	count = sscanf(line, "%Lx %Lx", &temp, &temp2);
+	if (count != 2)
+		die("Cannot parse %s: %s\n", kdump_info, strerror(errno));
+
+	*addr = (uint64_t) temp;
+	*len = (uint64_t) temp2;
+
+	return 0;
+}
kexec/crashdump.h renamed from kexec-tools-testing-20070330/kexec/crashdump.h +1 -0
diff -rpuN backup/kexec-tools-testing-20070330/kexec/crashdump.h kexec-tools/kexec/crashdump.h
@@ -2,6 +2,7 @@
 #define CRASHDUMP_H
 
 extern int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len);
+extern int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len);
 
 /* Need to find a better way to determine per cpu notes section size. */
 #define MAX_NOTE_BYTES		1024

_

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

#3 lore raw

Re: [PATCH 2/3] [kexec-tools] Pass vmcoreinfo's address and size

Quoted 9 lines · Ken'ichi Ohmichi

[2/3] [kexec-tools] Pass vmcoreinfo's address and size
The patch is for kexec-tools-testing-20070330.
(http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/)
kexec command gets the address and size of the vmcoreinfo data from /sys/kernel/vmcoreinfo, and passes them to the second kernel through ELF header of /proc/vmcore. When the second kernel is booting, the kernel gets them from the ELF header and creates vmcoreinfo's PT_NOTE segment into /proc/vmcore.

Sorry for the long delay, I completely missed this patch.

The kexec-tools change seems ok to me. What is the status of the kernel portion of the change? Do you still want the kexec-tools portion applied?

Quoted 112 lines

Thanks
Ken'ichi Ohmichi

---

---
diff -rpuN backup/kexec-tools-testing-20070330/kexec/crashdump-elf.c kexec-tools/kexec/crashdump-elf.c

kexec/crashdump-elf.c renamed from kexec-tools-testing-20070330/kexec/crashdump-elf.c +22 -1
@@ -36,6 +36,8 @@ int FUNC(struct kexec_info *info,
 	char *bufp;
 	long int nr_cpus = 0;
 	uint64_t notes_addr, notes_len;
+	uint64_t vmcoreinfo_addr, vmcoreinfo_len;
+	int has_vmcoreinfo = 0;
 	int (*get_note_info)(int cpu, uint64_t *addr, uint64_t *len);
 
 	if (xen_present())
@@ -47,7 +49,11 @@ int FUNC(struct kexec_info *info,
 		return -1;
 	}
 
-	sz = sizeof(EHDR) + nr_cpus * sizeof(PHDR) + ranges * sizeof(PHDR);
+	if (get_kernel_vmcoreinfo(&vmcoreinfo_addr, &vmcoreinfo_len) == 0) {
+		has_vmcoreinfo = 1;
+	}
+
+	sz = sizeof(EHDR) + (nr_cpus + has_vmcoreinfo) * sizeof(PHDR) + ranges * sizeof(PHDR);
 
 	/*
 	 * Certain architectures such as x86_64 and ia64 require a separate
@@ -148,6 +154,21 @@ int FUNC(struct kexec_info *info,
 		dfprintf_phdr(stdout, "Elf header", phdr);
 	}
 
+	if (has_vmcoreinfo) {
+		phdr = (PHDR *) bufp;
+		bufp += sizeof(PHDR);
+		phdr->p_type	= PT_NOTE;
+		phdr->p_flags	= 0;
+		phdr->p_offset  = phdr->p_paddr = vmcoreinfo_addr;
+		phdr->p_vaddr   = 0;
+		phdr->p_filesz	= phdr->p_memsz	= vmcoreinfo_len;
+		/* Do we need any alignment of segments? */
+		phdr->p_align	= 0;
+
+		(elf->e_phnum)++;
+		dfprintf_phdr(stdout, "vmcoreinfo header", phdr);
+	}
+
 	/* Setup an PT_LOAD type program header for the region where
 	 * Kernel is mapped if info->kern_size is non-zero.
 	 */

diff -rpuN backup/kexec-tools-testing-20070330/kexec/crashdump.c kexec-tools/kexec/crashdump.c

kexec/crashdump.c renamed from kexec-tools-testing-20070330/kexec/crashdump.c +32 -0
@@ -108,3 +108,35 @@ int get_crash_notes_per_cpu(int cpu, uin
 
 	return 0;
 }
+
+/* Returns the physical address of start of crash notes buffer for a kernel. */
+int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len)
+{
+	char kdump_info[PATH_MAX];
+	char line[MAX_LINE];
+	int count;
+	FILE *fp;
+	unsigned long long temp, temp2;
+
+	*addr = 0;
+	*len = 0;
+
+	sprintf(kdump_info, "/sys/kernel/vmcoreinfo");
+	fp = fopen(kdump_info, "r");
+	if (!fp) {
+		die("Could not open \"%s\": %s\n", kdump_info,
+		    strerror(errno));
+		return -1;
+	}
+
+	if (!fgets(line, sizeof(line), fp))
+		die("Cannot parse %s: %s\n", kdump_info, strerror(errno));
+	count = sscanf(line, "%Lx %Lx", &temp, &temp2);
+	if (count != 2)
+		die("Cannot parse %s: %s\n", kdump_info, strerror(errno));
+
+	*addr = (uint64_t) temp;
+	*len = (uint64_t) temp2;
+
+	return 0;
+}

diff -rpuN backup/kexec-tools-testing-20070330/kexec/crashdump.h kexec-tools/kexec/crashdump.h

kexec/crashdump.h renamed from kexec-tools-testing-20070330/kexec/crashdump.h +1 -0
@@ -2,6 +2,7 @@
 #define CRASHDUMP_H
 
 extern int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len);
+extern int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len);
 
 /* Need to find a better way to determine per cpu notes section size. */
 #define MAX_NOTE_BYTES		1024

_

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

#4 lore raw

Re: [PATCH 2/3] [kexec-tools] Pass vmcoreinfo's address and size

Hi Simon,

Quoted 10 lines · Simon Horman
Quoted 8 lines · Ken'ichi Ohmichi

[2/3] [kexec-tools] Pass vmcoreinfo's address and size
The patch is for kexec-tools-testing-20070330.
(http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/)
kexec command gets the address and size of the vmcoreinfo data from /sys/kernel/vmcoreinfo, and passes them to the second kernel through ELF header of /proc/vmcore. When the second kernel is booting, the kernel gets them from the ELF header and creates vmcoreinfo's PT_NOTE segment into /proc/vmcore.

Quoted 4 lines

Sorry for the long delay, I completely missed this patch.

The kexec-tools change seems ok to me. What is the status of the kernel portion of the change?

The kernel portion is merged into linux-2.6.23-mm1.
According to Andrew's mail "-mm merge plans for 2.6.24", its status is "The infamous misc. Will re-review and will merge basically all of them".

http://www.ussg.iu.edu/hypermail/linux/kernel/0710.0/0313.html

Quoted 1 line

Do you still want the kexec-tools portion applied?

Yes, I hope so.

Thanks
Ken'ichi Ohmichi

maintainer
#5 lore raw

Re: [PATCH 2/3] [kexec-tools] Pass vmcoreinfo's address and size

Quoted 11 lines · On Wed, 17 Oct 2007 14:16:19 +0900 "Ken'ichi Ohmichi"…
Quoted 10 lines · Simon Horman
Quoted 8 lines · Ken'ichi Ohmichi

[2/3] [kexec-tools] Pass vmcoreinfo's address and size
The patch is for kexec-tools-testing-20070330.
(http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/)
kexec command gets the address and size of the vmcoreinfo data from /sys/kernel/vmcoreinfo, and passes them to the second kernel through ELF header of /proc/vmcore. When the second kernel is booting, the kernel gets them from the ELF header and creates vmcoreinfo's PT_NOTE segment into /proc/vmcore.

Quoted 8 lines
Quoted 4 lines

Sorry for the long delay, I completely missed this patch.

The kexec-tools change seems ok to me. What is the status of the kernel portion of the change?

The kernel portion is merged into linux-2.6.23-mm1.
According to Andrew's mail "-mm merge plans for 2.6.24", its status is "The infamous misc. Will re-review and will merge basically all of them".

It's all in this evening's batch, which is going through final QA (heh) now. Is looking OK.

#6 lore raw

Re: [PATCH 2/3] [kexec-tools] Pass vmcoreinfo's address and size

In reply to Ken'ichi Ohmichi
Quoted 23 lines · Ken'ichi Ohmichi

Hi Simon,

Quoted 10 lines · Simon Horman
Quoted 8 lines · Ken'ichi Ohmichi

[2/3] [kexec-tools] Pass vmcoreinfo's address and size
The patch is for kexec-tools-testing-20070330.
(http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/)
kexec command gets the address and size of the vmcoreinfo data from /sys/kernel/vmcoreinfo, and passes them to the second kernel through ELF header of /proc/vmcore. When the second kernel is booting, the kernel gets them from the ELF header and creates vmcoreinfo's PT_NOTE segment into /proc/vmcore.

Quoted 4 lines

Sorry for the long delay, I completely missed this patch.

The kexec-tools change seems ok to me. What is the status of the kernel portion of the change?

The kernel portion is merged into linux-2.6.23-mm1.
According to Andrew's mail "-mm merge plans for 2.6.24", its status is "The infamous misc. Will re-review and will merge basically all of them".

Quoted 6 lines

http://www.ussg.iu.edu/hypermail/linux/kernel/0710.0/0313.html

Quoted 1 line

Do you still want the kexec-tools portion applied?

Yes, I hope so.

Thanks, I'll try and look over it tomorrow.

Applied
#7 lore raw

Re: [PATCH 2/3] [kexec-tools] Pass vmcoreinfo's address and size

In reply to Ken'ichi Ohmichi
Quoted 23 lines · Ken'ichi Ohmichi

Hi Simon,

Quoted 10 lines · Simon Horman
Quoted 8 lines · Ken'ichi Ohmichi

[2/3] [kexec-tools] Pass vmcoreinfo's address and size
The patch is for kexec-tools-testing-20070330.
(http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/)
kexec command gets the address and size of the vmcoreinfo data from /sys/kernel/vmcoreinfo, and passes them to the second kernel through ELF header of /proc/vmcore. When the second kernel is booting, the kernel gets them from the ELF header and creates vmcoreinfo's PT_NOTE segment into /proc/vmcore.

Quoted 4 lines

Sorry for the long delay, I completely missed this patch.

The kexec-tools change seems ok to me. What is the status of the kernel portion of the change?

The kernel portion is merged into linux-2.6.23-mm1.
According to Andrew's mail "-mm merge plans for 2.6.24", its status is "The infamous misc. Will re-review and will merge basically all of them".

Quoted 6 lines

http://www.ussg.iu.edu/hypermail/linux/kernel/0710.0/0313.html

Quoted 1 line

Do you still want the kexec-tools portion applied?

Yes, I hope so.

Thanks, applied :-)

#8 lore raw

Re: [PATCH 2/3] [kexec-tools] Pass vmcoreinfo's address and size

Hi Simon,

Quoted 24 lines · Simon Horman
Quoted 23 lines · Ken'ichi Ohmichi

Hi Simon,

Quoted 10 lines · Simon Horman
Quoted 8 lines · Ken'ichi Ohmichi

[2/3] [kexec-tools] Pass vmcoreinfo's address and size
The patch is for kexec-tools-testing-20070330.
(http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/)
kexec command gets the address and size of the vmcoreinfo data from /sys/kernel/vmcoreinfo, and passes them to the second kernel through ELF header of /proc/vmcore. When the second kernel is booting, the kernel gets them from the ELF header and creates vmcoreinfo's PT_NOTE segment into /proc/vmcore.

Quoted 4 lines

Sorry for the long delay, I completely missed this patch.

The kexec-tools change seems ok to me. What is the status of the kernel portion of the change?

The kernel portion is merged into linux-2.6.23-mm1.
According to Andrew's mail "-mm merge plans for 2.6.24", its status is "The infamous misc. Will re-review and will merge basically all of them".

Quoted 8 lines
Quoted 6 lines

http://www.ussg.iu.edu/hypermail/linux/kernel/0710.0/0313.html

Quoted 1 line

Do you still want the kexec-tools portion applied?

Yes, I hope so.

Thanks, applied :-)

Thank you for applying ;-)

But it has the compatibility problem that the kexec command fails on kernels which don't have /sys/kernel/vmcoreinfo:

 # ls /sys/kernel/
 debug  kexec_crash_loaded  kexec_loaded  security  uevent_helper 
 uevent_seqnum
 #
 (There is not /sys/kernel/vmcoreinfo.)

#

 # kexec -p --args-linux vmlinuz --initrd=initrd.img
 Could not open "/sys/kernel/vmcoreinfo": No such file or directory
 #

To fix the problem, could you please apply the attached patch ? The fixed part is the same as the patch in the following mail.

To: kexec-ml <[email protected]>
Subject: [PATCH 2/2] [kexec-tools] Pass vmcoreinfo's address and size #2
From: "Ken'ichi Ohmichi" <[email protected]>
Date: Fri, 7 Sep 2007 18:10:02 +0900

Thanks
tachibana

---

kexec/crashdump.c +2 -6
diff -rpuN a/kexec/crashdump.c b/kexec/crashdump.c
@@ -122,12 +122,8 @@ int get_kernel_vmcoreinfo(uint64_t *addr
 	*len = 0;
 
 	sprintf(kdump_info, "/sys/kernel/vmcoreinfo");
-	fp = fopen(kdump_info, "r");
-	if (!fp) {
-		die("Could not open \"%s\": %s\n", kdump_info,
-		    strerror(errno));
-		return -1;
-	}
+	if (!(fp = fopen(kdump_info, "r")))
+		return 0;
 
 	if (!fgets(line, sizeof(line), fp))
 		die("Cannot parse %s: %s\n", kdump_info, strerror(errno));

_

Applied
#9 lore raw

Re: [PATCH 2/3] [kexec-tools] Pass vmcoreinfo's address and size

Quoted 48 lines · On Thu, Oct 18, 2007 at 06:14:07PM +0900, [email protected] wrote:

Hi Simon,

Quoted 24 lines · Simon Horman
Quoted 23 lines · Ken'ichi Ohmichi

Hi Simon,

Quoted 10 lines · Simon Horman
Quoted 8 lines · Ken'ichi Ohmichi

[2/3] [kexec-tools] Pass vmcoreinfo's address and size
The patch is for kexec-tools-testing-20070330.
(http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/)
kexec command gets the address and size of the vmcoreinfo data from /sys/kernel/vmcoreinfo, and passes them to the second kernel through ELF header of /proc/vmcore. When the second kernel is booting, the kernel gets them from the ELF header and creates vmcoreinfo's PT_NOTE segment into /proc/vmcore.

Quoted 4 lines

Sorry for the long delay, I completely missed this patch.

The kexec-tools change seems ok to me. What is the status of the kernel portion of the change?

The kernel portion is merged into linux-2.6.23-mm1.
According to Andrew's mail "-mm merge plans for 2.6.24", its status is "The infamous misc. Will re-review and will merge basically all of them".

Quoted 8 lines
Quoted 6 lines

http://www.ussg.iu.edu/hypermail/linux/kernel/0710.0/0313.html

Quoted 1 line

Do you still want the kexec-tools portion applied?

Yes, I hope so.

Thanks, applied :-)

Thank you for applying ;-)

But it has the compatibility problem that the kexec command fails on kernels which don't have /sys/kernel/vmcoreinfo:

 # ls /sys/kernel/
 debug  kexec_crash_loaded  kexec_loaded  security  uevent_helper 
 uevent_seqnum
 #
 (There is not /sys/kernel/vmcoreinfo.)
Quoted 7 lines

#

 # kexec -p --args-linux vmlinuz --initrd=initrd.img
 Could not open "/sys/kernel/vmcoreinfo": No such file or directory
 #

To fix the problem, could you please apply the attached patch ? The fixed part is the same as the patch in the following mail.

Thanks, applied.

#10 lore raw

PATCH 3/3 Extract vmcoreinfo from /proc/vmcore

In reply to Ken'ichi Ohmichi

[3/3] [makedumpfile] Extract vmcoreinfo from /proc/vmcore The patch is for makedumpfile v1.1.6.
(https://sourceforge.net/projects/makedumpfile/)
makedumpfile command extracts the vmcoreinfo data from /proc/vmcore and uses it for dump filtering.

Thanks
Ken'ichi Ohmichi

---

---

ia64.c renamed from v1.1.6/ia64.c +4 -0
diff -puN backup/v1.1.6/ia64.c makedumpfile/ia64.c
@@ -70,6 +70,10 @@ get_machdep_info_ia64()
 	else
 		info->vmalloc_start = KERNEL_VMALLOC_BASE;
 
+	if ((vt.mem_flags & MEMORY_PAGETABLE_4L)
+	    || (vt.mem_flags & MEMORY_PAGETABLE_3L))
+		return TRUE;
+
 	/*
 	 * Check the pgtable (3 Levels or 4 Levels).
 	 */
makedumpfile.c renamed from v1.1.6/makedumpfile.c +227 -13

282 lines not on this page · raw message

makedumpfile.h renamed from v1.1.6/makedumpfile.h +25 -7
diff -puN backup/v1.1.6/makedumpfile.h makedumpfile/makedumpfile.h
@@ -70,6 +70,7 @@ enum {
  */
 #define MEMORY_PAGETABLE_4L	(1 << 0)
 #define MEMORY_PAGETABLE_3L	(1 << 1)
+#define MEMORY_X86_PAE		(1 << 2)
 
 /*
  * Type of address
@@ -366,15 +367,26 @@ do { \
 #define LATEST_VERSION		(0x02060016)	/* linux-2.6.22 */
 
 /*
+ * vmcoreinfo in /proc/vmcore
+ */
+#define VMCOREINFO_BYTES		(4096)
+#define VMCOREINFO_NOTE_NAME		"VMCOREINFO"
+#define VMCOREINFO_NOTE_NAME_BYTES	(sizeof(VMCOREINFO_NOTE_NAME))
+#define FILENAME_VMCOREINFO		"/tmp/vmcoreinfoXXXXXX"
+
+/*
  * field name of vmcoreinfo file
  */
-#define STR_OSRELEASE	"OSRELEASE="
-#define STR_PAGESIZE	"PAGESIZE="
-#define STR_SYMBOL(X)	"SYMBOL("X")="
-#define STR_SIZE(X)	"SIZE("X")="
-#define STR_OFFSET(X)	"OFFSET("X")="
-#define STR_LENGTH(X)	"LENGTH("X")="
-#define STR_SRCFILE(X)	"SRCFILE("X")="
+#define STR_OSRELEASE		"OSRELEASE="
+#define STR_PAGESIZE		"PAGESIZE="
+#define STR_SYMBOL(X)		"SYMBOL("X")="
+#define STR_SIZE(X)		"SIZE("X")="
+#define STR_OFFSET(X)		"OFFSET("X")="
+#define STR_LENGTH(X)		"LENGTH("X")="
+#define STR_SRCFILE(X)		"SRCFILE("X")="
+#define STR_CONFIG_X86_PAE	"CONFIG_X86_PAE=y"
+#define STR_CONFIG_PGTABLE_4	"CONFIG_PGTABLE_4=y"
+#define STR_CONFIG_PGTABLE_3	"CONFIG_PGTABLE_3=y"
 
 /*
  * common value
@@ -664,6 +676,12 @@ struct DumpInfo {
 	char			release[STRLEN_OSRELEASE];
 
 	/*
+	 * vmcoreinfo in dump memory image info:
+	 */
+	off_t			offset_vmcoreinfo;
+	unsigned long		size_vmcoreinfo;
+
+	/*
 	 * for Xen extraction
 	 */
 	unsigned long xen_heap_start;	/* start mfn of xen heap area */
x86.c renamed from v1.1.6/x86.c +5 -4
diff -puN backup/v1.1.6/x86.c makedumpfile/x86.c
@@ -21,10 +21,11 @@ int
 get_machdep_info_x86()
 {
 	/* PAE */
-	if ((SYMBOL(pkmap_count) != NOT_FOUND_SYMBOL)
-	    && (SYMBOL(pkmap_count_next) != NOT_FOUND_SYMBOL)
-	    && ((SYMBOL(pkmap_count_next)-SYMBOL(pkmap_count))/sizeof(int))
-	    == 512) {
+	if ((vt.mem_flags & MEMORY_X86_PAE)
+	    || ((SYMBOL(pkmap_count) != NOT_FOUND_SYMBOL)
+	      && (SYMBOL(pkmap_count_next) != NOT_FOUND_SYMBOL)
+	      && ((SYMBOL(pkmap_count_next)-SYMBOL(pkmap_count))/sizeof(int))
+	      == 512)) {
 		DEBUG_MSG("\n");
 		DEBUG_MSG("PAE          : ON\n");
 		info->section_size_bits = _SECTION_SIZE_BITS_PAE;

_

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

maintainer
#11 lore raw
In reply to Ken'ichi Ohmichi
Quoted 20 lines · On Wed, 22 Aug 2007 21:08:38 +0900 "Ken'ichi Ohmichi"…

Hi Andrew,

This patch set frees the restriction that makedumpfile users should install a vmlinux file (including the debugging information) into each system.

makedumpfile command is the dump filtering feature for kdump. It creates a small dumpfile by filtering unnecessary pages for the analysis. To distinguish unnecessary pages, it needs a vmlinux file including the debugging information. These days, the debugging package becomes a huge file, and it is hard to install it into each system.

To solve the problem, kdump developers discussed it at lkml and kexec-ml. As the result, we reached the conclusion that necessary information for dump filtering (called "vmcoreinfo") should be embedded into the first kernel file and it should be accessed through /proc/vmcore during the second kernel.
(http://www.uwsg.iu.edu/hypermail/linux/kernel/0707.0/1806.html)

Quoted 5 lines

Dan Aloni created the patch set for the above implementation.
(http://www.uwsg.iu.edu/hypermail/linux/kernel/0707.1/1053.html)

And I updated it for multi architectures and memory models.
(http://lists.infradead.org/pipermail/kexec/2007-August/000479.html)

so... will this permit us to generate kdump files whcih don't have any pagecache or anonymous memory in them?

Quoted 1 line

+void vmcoreinfo_append_str(const char *fmt, ...);

This should have suitable __attribute__s so that the compiler can check its
use. See many examples in include/linux/kernel.h, around line 120.

Review

Quoted 4 lines
(quoted diff) +4 -0
+/* vmcoreinfo stuff */
+unsigned char vmcoreinfo_data[VMCOREINFO_BYTES];
+u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
+unsigned int vmcoreinfo_size = 0;

Please always run scripts/checkpatch.pl against your diffs.

Quoted 1 line

+unsigned int vmcoreinfo_max_size = sizeof(vmcoreinfo_data);

unsigned int = size_t? Perhaps vmcoreinfo_max_size should have size_t type?

Review

Quoted 8 lines
(quoted diff) +8 -0
+void crash_save_vmcoreinfo(void)
+{
+	u32 *buf;
+
+	if (!vmcoreinfo_size)
+		return;
+
+	vmcoreinfo_append_str("CRASHTIME=%d", xtime.tv_sec);

open-coded access to xtime probably isn't appropriate here. Consider using get_seconds(). That might be more accurate on tickless kernels, too.

Quoted 4 lines
(quoted diff) +4 -0
+	buf = (u32 *)vmcoreinfo_note;
+
+	buf = append_elf_note(buf, VMCOREINFO_NOTE_NAME, 0, vmcoreinfo_data,
+			      vmcoreinfo_size);

Review

Quoted 10 lines
(quoted diff) +10 -0
+
+	final_note(buf);
+}
+
+}
+
+static int __init crash_save_vmcoreinfo_init(void)
+{
+	vmcoreinfo_append_str("OSRELEASE=%s\n", UTS_RELEASE);
+	vmcoreinfo_append_str("PAGESIZE=%d\n", PAGE_SIZE);

I expect the virtualisation guys would be bothered by an open-coded access to UTS_RELEASE. I guess it doesn't matter much here, but perhaps it'd be setting a better example to use init_uts_ns.name.release?

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

#12 lore raw

Hi Andrew,

Thank you for the comments, I updated the patch.

Quoted 17 lines · Andrew Morton
Quoted 17 lines

This patch set frees the restriction that makedumpfile users should install a vmlinux file (including the debugging information) into each system.

makedumpfile command is the dump filtering feature for kdump. It creates a small dumpfile by filtering unnecessary pages for the analysis. To distinguish unnecessary pages, it needs a vmlinux file including the debugging information. These days, the debugging package becomes a huge file, and it is hard to install it into each system.

To solve the problem, kdump developers discussed it at lkml and kexec-ml. As the result, we reached the conclusion that necessary information for dump filtering (called "vmcoreinfo") should be embedded into the first kernel file and it should be accessed through /proc/vmcore during the second kernel.
(http://www.uwsg.iu.edu/hypermail/linux/kernel/0707.0/1806.html)

Quoted 8 lines
Quoted 5 lines

Dan Aloni created the patch set for the above implementation.
(http://www.uwsg.iu.edu/hypermail/linux/kernel/0707.1/1053.html)

And I updated it for multi architectures and memory models.
(http://lists.infradead.org/pipermail/kexec/2007-August/000479.html)

so... will this permit us to generate kdump files whcih don't have any pagecache or anonymous memory in them?

Yes, makedumpfile can do it. Moreover it can generate kdump files which don't have free pages or zero-filled pages too.

Quoted 4 lines
Quoted 1 line

+void vmcoreinfo_append_str(const char *fmt, ...);

This should have suitable __attribute__s so that the compiler can check its
use. See many examples in include/linux/kernel.h, around line 120.

OK. I added __attribute__ ((format (printf, 1, 2))) to the defination for vmcoreinfo_append_str(), and I fixed the coding problems related to this change.

Quoted 6 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+/* vmcoreinfo stuff */
+unsigned char vmcoreinfo_data[VMCOREINFO_BYTES];
+u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
+unsigned int vmcoreinfo_size = 0;

Please always run scripts/checkpatch.pl against your diffs.

OK, I confirmed that the attached patch does not have any problems by scripts/checkpatch.pl.

Quoted 4 lines
Quoted 1 line

+unsigned int vmcoreinfo_max_size = sizeof(vmcoreinfo_data);

unsigned int = size_t? Perhaps vmcoreinfo_max_size should have size_t type?

You are right. In the attached patch, both vmcoreinfo_max_size and vmcoreinfo_size are defined as size_t.

Quoted 11 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+void crash_save_vmcoreinfo(void)
+{
+	u32 *buf;
+
+	if (!vmcoreinfo_size)
+		return;
+
+	vmcoreinfo_append_str("CRASHTIME=%d", xtime.tv_sec);

open-coded access to xtime probably isn't appropriate here. Consider using get_seconds(). That might be more accurate on tickless kernels, too.

OK, I fixed it as you said.

Quoted 8 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+static int __init crash_save_vmcoreinfo_init(void)
+{
+	vmcoreinfo_append_str("OSRELEASE=%s\n", UTS_RELEASE);
+	vmcoreinfo_append_str("PAGESIZE=%d\n", PAGE_SIZE);

I expect the virtualisation guys would be bothered by an open-coded access to UTS_RELEASE. I guess it doesn't matter much here, but perhaps it'd be setting a better example to use init_uts_ns.name.release?

OK, I fixed it as you said.

Thanks
Ken'ichi Ohmichi

---

---

arch/i386/kernel/machine_kexec.c +13 -0
diff -rpuN a/arch/i386/kernel/machine_kexec.c b/arch/i386/kernel/machine_kexec.c
@@ -10,6 +10,7 @@
 #include <linux/kexec.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/numa.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
 #include <asm/tlbflush.h>
@@ -169,3 +170,15 @@ static int __init parse_crashkernel(char
 	return 0;
 }
 early_param("crashkernel", parse_crashkernel);
+
+void arch_crash_save_vmcoreinfo(void)
+{
+#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
+	SYMBOL(node_data);
+	LENGTH(node_data, MAX_NUMNODES);
+#endif
+#ifdef CONFIG_X86_PAE
+	CONFIG(X86_PAE);
+#endif
+}
+
arch/ia64/kernel/machine_kexec.c +28 -0
diff -rpuN a/arch/ia64/kernel/machine_kexec.c b/arch/ia64/kernel/machine_kexec.c
@@ -15,10 +15,13 @@
 #include <linux/cpu.h>
 #include <linux/irq.h>
 #include <linux/efi.h>
+#include <linux/numa.h>
+#include <linux/mmzone.h>
 #include <asm/mmu_context.h>
 #include <asm/setup.h>
 #include <asm/delay.h>
 #include <asm/meminit.h>
+#include <asm/processor.h>
 
 typedef NORET_TYPE void (*relocate_new_kernel_t)(
 					unsigned long indirection_page,
@@ -125,3 +128,28 @@ void machine_kexec(struct kimage *image)
 	unw_init_running(ia64_machine_kexec, image);
 	for(;;);
 }
+
+void arch_crash_save_vmcoreinfo(void)
+{
+#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
+	SYMBOL(pgdat_list);
+	LENGTH(pgdat_list, MAX_NUMNODES);
+
+	SYMBOL(node_memblk);
+	LENGTH(node_memblk, NR_NODE_MEMBLKS);
+	SIZE(node_memblk_s);
+	OFFSET(node_memblk_s, start_paddr);
+	OFFSET(node_memblk_s, size);
+#endif
+#ifdef CONFIG_PGTABLE_3
+	CONFIG(PGTABLE_3);
+#elif  CONFIG_PGTABLE_4
+	CONFIG(PGTABLE_4);
+#endif
+}
+
+unsigned long paddr_vmcoreinfo_note(void)
+{
+	return ia64_tpa((unsigned long)(char *)&vmcoreinfo_note);
+}
+
arch/ia64/mm/discontig.c +1 -1
diff -rpuN a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
@@ -47,7 +47,7 @@ struct early_node_data {
 static struct early_node_data mem_data[MAX_NUMNODES] __initdata;
 static nodemask_t memory_less_mask __initdata;
 
-static pg_data_t *pgdat_list[MAX_NUMNODES];
+pg_data_t *pgdat_list[MAX_NUMNODES];
 
 /*
  * To prevent cache aliasing effects, align per-node structures so that they
arch/x86_64/kernel/machine_kexec.c +9 -0
diff -rpuN a/arch/x86_64/kernel/machine_kexec.c b/arch/x86_64/kernel/machine_kexec.c
@@ -10,6 +10,7 @@
 #include <linux/kexec.h>
 #include <linux/string.h>
 #include <linux/reboot.h>
+#include <linux/numa.h>
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
 #include <asm/mmu_context.h>
@@ -257,3 +258,11 @@ static int __init setup_crashkernel(char
 }
 early_param("crashkernel", setup_crashkernel);
 
+void arch_crash_save_vmcoreinfo(void)
+{
+#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
+	SYMBOL(node_data);
+	LENGTH(node_data, MAX_NUMNODES);
+#endif
+}
+
include/asm-ia64/numa.h +1 -0
diff -rpuN a/include/asm-ia64/numa.h b/include/asm-ia64/numa.h
@@ -24,6 +24,7 @@
 
 extern u16 cpu_to_node_map[NR_CPUS] __cacheline_aligned;
 extern cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
+extern pg_data_t *pgdat_list[MAX_NUMNODES];
 
 /* Stuff below this line could be architecture independent */
 
include/linux/kexec.h +28 -0
diff -rpuN a/include/linux/kexec.h b/include/linux/kexec.h
@@ -121,6 +121,25 @@ extern struct page *kimage_alloc_control
 extern void crash_kexec(struct pt_regs *);
 int kexec_should_crash(struct task_struct *);
 void crash_save_cpu(struct pt_regs *regs, int cpu);
+void crash_save_vmcoreinfo(void);
+void arch_crash_save_vmcoreinfo(void);
+void vmcoreinfo_append_str(const char *fmt, ...)
+	__attribute__ ((format (printf, 1, 2)));
+unsigned long paddr_vmcoreinfo_note(void);
+
+#define SYMBOL(name) \
+	vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)
+#define SIZE(name) \
+	vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
+			      (unsigned long)sizeof(struct name))
+#define OFFSET(name, field) \
+	vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
+			      (unsigned long)&(((struct name *)0)->field))
+#define LENGTH(name, value) \
+	vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)
+#define CONFIG(name) \
+	vmcoreinfo_append_str("CONFIG_%s=y\n", #name)
+
 extern struct kimage *kexec_image;
 extern struct kimage *kexec_crash_image;
 
@@ -148,11 +167,20 @@ extern struct kimage *kexec_crash_image;
 
 #define KEXEC_FLAGS    (KEXEC_ON_CRASH)  /* List of defined/legal kexec flags */
 
+#define VMCOREINFO_BYTES           (4096)
+#define VMCOREINFO_NOTE_NAME       "VMCOREINFO"
+#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4)
+#define VMCOREINFO_NOTE_SIZE       (KEXEC_NOTE_HEAD_BYTES*2 + VMCOREINFO_BYTES \
+				    + VMCOREINFO_NOTE_NAME_BYTES)
+
 /* Location of a reserved region to hold the crash kernel.
  */
 extern struct resource crashk_res;
 typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4];
 extern note_buf_t *crash_notes;
+extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
+extern size_t vmcoreinfo_size;
+extern size_t vmcoreinfo_max_size;
 
 
 #else /* !CONFIG_KEXEC */
kernel/kexec.c +110 -0

135 lines not on this page · raw message

kernel/ksysfs.c +10 -0
diff -rpuN a/kernel/ksysfs.c b/kernel/ksysfs.c
@@ -60,6 +60,15 @@ static ssize_t kexec_crash_loaded_show(s
 	return sprintf(page, "%d\n", !!kexec_crash_image);
 }
 KERNEL_ATTR_RO(kexec_crash_loaded);
+
+static ssize_t vmcoreinfo_show(struct kset *kset, char *page)
+{
+	return sprintf(page, "%lx %x\n",
+		       paddr_vmcoreinfo_note(),
+		       (unsigned int)vmcoreinfo_max_size);
+}
+KERNEL_ATTR_RO(vmcoreinfo);
+
 #endif /* CONFIG_KEXEC */
 
 decl_subsys(kernel, NULL, NULL);
@@ -73,6 +82,7 @@ static struct attribute * kernel_attrs[]
 #ifdef CONFIG_KEXEC
 	&kexec_loaded_attr.attr,
 	&kexec_crash_loaded_attr.attr,
+	&vmcoreinfo_attr.attr,
 #endif
 	NULL
 };

_

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

#13 lore raw
In reply to Ken'ichi Ohmichi
Quoted 27 lines · Ken'ichi Ohmichi

Hi Andrew,

This patch set frees the restriction that makedumpfile users should install a vmlinux file (including the debugging information) into each system.

makedumpfile command is the dump filtering feature for kdump. It creates a small dumpfile by filtering unnecessary pages for the analysis. To distinguish unnecessary pages, it needs a vmlinux file including the debugging information. These days, the debugging package becomes a huge file, and it is hard to install it into each system.

To solve the problem, kdump developers discussed it at lkml and kexec-ml. As the result, we reached the conclusion that necessary information for dump filtering (called "vmcoreinfo") should be embedded into the first kernel file and it should be accessed through /proc/vmcore during the second kernel.
(http://www.uwsg.iu.edu/hypermail/linux/kernel/0707.0/1806.html)

Dan Aloni created the patch set for the above implementation.
(http://www.uwsg.iu.edu/hypermail/linux/kernel/0707.1/1053.html)

And I updated it for multi architectures and memory models.
(http://lists.infradead.org/pipermail/kexec/2007-August/000479.html)

Quoted 6 lines

PATCH SET:
[1/3] [linux] Add vmcoreinfo
The patch is for linux-2.6.22.
The patch adds the vmcoreinfo data. Its address and size are output to /sys/kernel/vmcoreinfo.

Looks good to me.

Thanks
Vivek

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

#14 lore raw
In reply to Ken'ichi Ohmichi

Hi,

Quoted 27 lines · Ken'ichi Ohmichi

Hi Andrew,

This patch set frees the restriction that makedumpfile users should install a vmlinux file (including the debugging information) into each system.

makedumpfile command is the dump filtering feature for kdump. It creates a small dumpfile by filtering unnecessary pages for the analysis. To distinguish unnecessary pages, it needs a vmlinux file including the debugging information. These days, the debugging package becomes a huge file, and it is hard to install it into each system.

To solve the problem, kdump developers discussed it at lkml and kexec-ml. As the result, we reached the conclusion that necessary information for dump filtering (called "vmcoreinfo") should be embedded into the first kernel file and it should be accessed through /proc/vmcore during the second kernel.
(http://www.uwsg.iu.edu/hypermail/linux/kernel/0707.0/1806.html)

Dan Aloni created the patch set for the above implementation.
(http://www.uwsg.iu.edu/hypermail/linux/kernel/0707.1/1053.html)

And I updated it for multi architectures and memory models.
(http://lists.infradead.org/pipermail/kexec/2007-August/000479.html)

Quoted 5 lines

PATCH SET:
[1/3] [linux] Add vmcoreinfo
The patch is for linux-2.6.22.
The patch adds the vmcoreinfo data. Its address and size are output to /sys/kernel/vmcoreinfo.

The patch for linux (add-vmcoreinfo.patch) is included in 2.6.23-rc4-mm1.
http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.23-rc4/2.6.23-rc4-mm1/announce.txt

Thank you for your cooperation.

Quoted 8 lines

[2/3] [kexec-tools] Pass vmcoreinfo's address and size
The patch is for kexec-tools-testing-20070330.
(http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/)
kexec command gets the address and size of the vmcoreinfo data from /sys/kernel/vmcoreinfo, and passes them to the second kernel through ELF header of /proc/vmcore. When the second kernel is booting, the kernel gets them from the ELF header and creates vmcoreinfo's PT_NOTE segment into /proc/vmcore.

Horms, could you please merge the above patch ?

Quoted 5 lines

[3/3] [makedumpfile] Extract vmcoreinfo from /proc/vmcore
The patch is for makedumpfile v1.1.6.
(https://sourceforge.net/projects/makedumpfile/)
makedumpfile command extracts the vmcoreinfo data from /proc/vmcore and uses it for dump filtering.

I will release the next makedumpfile with the above patch.

Thanks
Ken'ichi Ohmichi

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

#15 lore raw
In reply to Ken'ichi Ohmichi
Quoted 3 lines

This patch set frees the restriction that makedumpfile users should install a vmlinux file (including the debugging information) into each system.

This patch went from Andrew to Linus last night, and looks at first glance to be the reason why the ia64 build is broken this morning when using the arch/ia64/configs/tiger_defconfig configuration.

Here are the error messages:
arch/ia64/kernel/machine_kexec.c: In function `arch_crash_save_vmcoreinfo':
arch/ia64/kernel/machine_kexec.c:131: error: `pgdat_list' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:131: error: (Each undeclared identifier is reported only once arch/ia64/kernel/machine_kexec.c:131: error: for each function it appears in.) arch/ia64/kernel/machine_kexec.c:134: error: node_memblk' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:135: error: NR_NODE_MEMBLKS' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:136: error: invalid application of sizeof' to incomplete type node_memblk_s' arch/ia64/kernel/machine_kexec.c:137: error: dereferencing pointer to incomplete type
arch/ia64/kernel/machine_kexec.c:138: error: dereferencing pointer to incomplete type
make[1]: *** [arch/ia64/kernel/machine_kexec.o] Error 1

-Tony

maintainer
#16 lore raw
Quoted 18 lines · On Wed, 17 Oct 2007 10:19:18 -0700 "Tony Luck" <[email protected]> wrote:
Quoted 3 lines

This patch set frees the restriction that makedumpfile users should install a vmlinux file (including the debugging information) into each system.

This patch went from Andrew to Linus last night, and looks at first glance to be the reason why the ia64 build is broken this morning when using the arch/ia64/configs/tiger_defconfig configuration.

Here are the error messages:
arch/ia64/kernel/machine_kexec.c: In function `arch_crash_save_vmcoreinfo':
arch/ia64/kernel/machine_kexec.c:131: error: `pgdat_list' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:131: error: (Each undeclared identifier is reported only once arch/ia64/kernel/machine_kexec.c:131: error: for each function it appears in.) arch/ia64/kernel/machine_kexec.c:134: error: node_memblk' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:135: error: NR_NODE_MEMBLKS'

Quoted 9 lines

undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:136: error: invalid application of sizeof' to incomplete type node_memblk_s' arch/ia64/kernel/machine_kexec.c:137: error: dereferencing pointer to incomplete type
arch/ia64/kernel/machine_kexec.c:138: error: dereferencing pointer to incomplete type
make[1]: *** [arch/ia64/kernel/machine_kexec.o] Error 1

This?

arch/ia64/kernel/machine_kexec.c renamed from arch/ia64/kernel/machine_kexec.c~ia64-fix-non-numa-build +3 -1
@@ -17,6 +17,8 @@
 #include <linux/efi.h>
 #include <linux/numa.h>
 #include <linux/mmzone.h>
+
+#include <asm/numa.h>
 #include <asm/mmu_context.h>
 #include <asm/setup.h>
 #include <asm/delay.h>
@@ -127,7 +129,7 @@ void machine_kexec(struct kimage *image)
 
 void arch_crash_save_vmcoreinfo(void)
 {
-#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
+#if defined(CONFIG_ARCH_DISCONTIGMEM_ENABLE) && defined(CONFIG_NUMA)
 	VMCOREINFO_SYMBOL(pgdat_list);
 	VMCOREINFO_LENGTH(pgdat_list, MAX_NUMNODES);
 

_

(the asm/numa.h include isn't needed by this patch, but strictly should be there, as this file refers to things which are defined in asm/numa.h)

(it's weird that linux/numa.h doesn't include asm/numa.h)

(please tell me if you want me to send this to Linus)

#17 lore raw
Quoted 1 line

This?

That does the trick, yes.

Quoted 1 line

(please tell me if you want me to send this to Linus)

I've put it in my tree now ... so I'll ask Linus to pull it from there.

-Tony