All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] makedumpfile: readpage_elf: handle 0-pages not stored in the ELF file
@ 2016-01-22 23:35 Ivan Delalande
  2016-01-27  2:21 ` Atsushi Kumagai
  0 siblings, 1 reply; 15+ messages in thread
From: Ivan Delalande @ 2016-01-22 23:35 UTC (permalink / raw)
  To: Masaki Tachibana, Minoru Usui, Daisuke Nishimura, Atsushi Kumagai
  Cc: kexec-ml

Handle pages filled with zeros that are not stored in the ELF file
directly, but have addresses between p_filesz and p_memsz of a segment.

This allows makedumpfile to dump-dmesg from a previously makedumpfile-ed
vmcore where all 0-pages were excluded (dump_level & 1) for example.

Signed-off-by: Ivan Delalande <colona@arista.com>
---
 elf_info.c     | 22 ++++++++++++++++++++++
 elf_info.h     |  1 +
 makedumpfile.c | 16 ++++++++++++++++
 3 files changed, 39 insertions(+)

diff --git a/elf_info.c b/elf_info.c
index 8bce942..340e885 100644
--- a/elf_info.c
+++ b/elf_info.c
@@ -42,6 +42,7 @@ struct pt_load_segment {
 	unsigned long long	phys_end;
 	unsigned long long	virt_start;
 	unsigned long long	virt_end;
+	size_t			mem_size;
 };
 
 static int			nr_cpus;             /* number of cpu */
@@ -166,6 +167,7 @@ dump_Elf_load(Elf64_Phdr *prog, int num_load)
 	pls->virt_start  = prog->p_vaddr;
 	pls->virt_end    = pls->virt_start + prog->p_filesz;
 	pls->file_offset = prog->p_offset;
+	pls->mem_size    = prog->p_memsz;
 
 	DEBUG_MSG("LOAD (%d)\n", num_load);
 	DEBUG_MSG("  phys_start : %llx\n", pls->phys_start);
@@ -584,6 +586,26 @@ offset_to_pt_load_end(off_t offset)
 }
 
 /*
+ * Return true if a page is in the zone between p_filesz and p_memsz of a
+ * segment, which is a page filled with zero and not stored in the ELF file.
+ */
+int
+paddr_is_null(unsigned long long paddr)
+{
+	int i;
+	struct pt_load_segment *pls;
+
+	for (i = 0; i < num_pt_loads; i++) {
+		pls = &pt_loads[i];
+		if ((paddr >= pls->phys_start)
+		    && (paddr + info->page_size
+			<= pls->phys_start + pls->mem_size))
+			return TRUE;
+	}
+	return FALSE;
+}
+
+/*
  * Judge whether the page is fractional or not.
  */
 int
diff --git a/elf_info.h b/elf_info.h
index e712253..4823311 100644
--- a/elf_info.h
+++ b/elf_info.h
@@ -36,6 +36,7 @@ unsigned long long page_head_to_phys_start(unsigned long long head_paddr);
 unsigned long long page_head_to_phys_end(unsigned long long head_paddr);
 off_t offset_to_pt_load_start(off_t offset);
 off_t offset_to_pt_load_end(off_t offset);
+int paddr_is_null(unsigned long long paddr);
 unsigned long long vaddr_to_paddr_general(unsigned long long vaddr);
 off_t vaddr_to_offset_slow(int fd, char *filename, unsigned long long vaddr);
 unsigned long long get_max_paddr(void);
diff --git a/makedumpfile.c b/makedumpfile.c
index fa0b779..120bfdc 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -654,6 +654,14 @@ readpage_elf(unsigned long long paddr, void *bufptr)
 	phys_end = paddr + info->page_size;
 
 	/*
+	 * Check the 0-filled pages that are not in the ELF file.
+	 */
+	if (!offset1 && !offset2 && paddr_is_null(paddr)) {
+		memset(bufptr, 0, info->page_size);
+		return TRUE;
+	}
+
+	/*
 	 * Check the case phys_start isn't aligned by page size like below:
 	 *
 	 *                           phys_start
@@ -728,6 +736,14 @@ readpage_elf_parallel(int fd_memory, unsigned long long paddr, void *bufptr)
 	phys_end = paddr + info->page_size;
 
 	/*
+	 * Check the 0-filled pages that are not in the ELF file.
+	 */
+	if (!offset1 && !offset2 && paddr_is_null(paddr)) {
+		memset(bufptr, 0, info->page_size);
+		return TRUE;
+	}
+
+	/*
 	 * Check the case phys_start isn't aligned by page size like below:
 	 *
 	 *                           phys_start
-- 
2.7.0

-- 
Ivan "Colona" Delalande
Arista Networks

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 15+ messages in thread
* Kexec on ARM?
@ 2010-02-23 22:32 Phil Black
       [not found] ` <d1b08f941002240448s30863e7cg751e6f9cd1f875c5@mail.gmail.com>
  0 siblings, 1 reply; 15+ messages in thread
From: Phil Black @ 2010-02-23 22:32 UTC (permalink / raw)
  To: kexec


[-- Attachment #1.1: Type: text/plain, Size: 1082 bytes --]

Hi, I've been trying to kexec a kernel on an arm platform.  I've
successfully compiled the userland kexec-tools both from the git repo,
and the latest 2.0.1 release.  I've tried the latest official kernel
(2.6.33-rc8) as well as from the arago project (a patched 2.6.32
kernel), but have yet to see anything happen.

 

I'm trying this on a Ti DM365 EVM board, which is an ARM926EJ-S core

 Kexec seems to be able to load the kernel, but just hangs after
decompression.... My terminal output looks like:

 

root@10.9.5.34:~# kexec -l uImage

root@10.9.5.34:~# kexec -e

Starting new kernel

Bye!

Uncompressing Linux... done, booting the kernel.

 

 

After this, it just sits there....

 

I haven't done a whole lot of kernel debugging, so any
suggestions/advice would be appreciated.  I'm not really sure where to
start.  I've also tried zImage files which don't work either.

 

I don't know if it matters, but uBoot (the bootloader) loads the kernel
at 0x80008000 with kernel entry point at 0x80008000.

 

 

Thanks,

Phil


[-- Attachment #1.2: Type: text/html, Size: 4755 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-02-10 18:07 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-22 23:35 [PATCH] makedumpfile: readpage_elf: handle 0-pages not stored in the ELF file Ivan Delalande
2016-01-27  2:21 ` Atsushi Kumagai
     [not found]   ` <20160127085821.3be424e1@hananiah.suse.cz>
2016-01-27  9:37     ` Petr Tesarik
2016-02-01  6:48       ` Atsushi Kumagai
2016-02-01 12:00         ` Petr Tesarik
2016-02-02  6:48           ` Atsushi Kumagai
2016-02-02  7:00             ` Ivan Delalande
2016-02-09  8:31               ` Petr Tesarik
2016-02-10  2:57                 ` Kexec on ARM? Rudici Cazeao
2016-02-10  3:21                 ` [PATCH] makedumpfile: readpage_elf: handle 0-pages not stored in the ELF file Ivan Delalande
2016-02-10  7:52                   ` Petr Tesarik
2016-02-10 18:06                 ` Kexec on ARM? Rudici Cazeao
2016-01-27 22:17   ` [PATCH v2] makedumpfile: readpage_elf: handle 0-pages not stored in the ELF file Ivan Delalande
  -- strict thread matches above, loose matches on Subject: below --
2010-02-23 22:32 Kexec on ARM? Phil Black
     [not found] ` <d1b08f941002240448s30863e7cg751e6f9cd1f875c5@mail.gmail.com>
2010-02-24 13:20   ` Andrea Adami

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.