Commit 315c215c authored by Vivek Goyal's avatar Vivek Goyal Committed by Linus Torvalds

[PATCH] kdump: cleanups for dump file access in linear raw format

Removed the dependency on backup region.  Now all the information is encoded
in ELF format.  /dev/oldmem is a dummy interface.  User space tool need to be
intelligent enough to parse the elf headers and read the relevant memory areas
with the help of /dev/oldmem.
Signed-off-by: default avatarVivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 50b1fdbd
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/crash_dump.h> #include <linux/crash_dump.h>
#include <linux/backing-dev.h> #include <linux/backing-dev.h>
#include <linux/bootmem.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -278,55 +279,33 @@ static int mmap_kmem(struct file * file, struct vm_area_struct * vma) ...@@ -278,55 +279,33 @@ static int mmap_kmem(struct file * file, struct vm_area_struct * vma)
#ifdef CONFIG_CRASH_DUMP #ifdef CONFIG_CRASH_DUMP
/* /*
* Read memory corresponding to the old kernel. * Read memory corresponding to the old kernel.
* If we are reading from the reserved section, which is
* actually used by the current kernel, we just return zeroes.
* Or if we are reading from the first 640k, we return from the
* backed up area.
*/ */
static ssize_t read_oldmem(struct file * file, char * buf, static ssize_t read_oldmem(struct file *file, char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
unsigned long pfn; unsigned long pfn, offset;
unsigned backup_start, backup_end, relocate_start; size_t read = 0, csize;
size_t read=0, csize; int rc = 0;
backup_start = CRASH_BACKUP_BASE / PAGE_SIZE;
backup_end = backup_start + (CRASH_BACKUP_SIZE / PAGE_SIZE);
relocate_start = (CRASH_BACKUP_BASE + CRASH_BACKUP_SIZE) / PAGE_SIZE;
while(count) { while(count) {
pfn = *ppos / PAGE_SIZE; pfn = *ppos / PAGE_SIZE;
if (pfn > saved_max_pfn)
return read;
csize = (count > PAGE_SIZE) ? PAGE_SIZE : count; offset = (unsigned long)(*ppos % PAGE_SIZE);
if (count > PAGE_SIZE - offset)
/* Perform translation (see comment above) */ csize = PAGE_SIZE - offset;
if ((pfn >= backup_start) && (pfn < backup_end)) { else
if (clear_user(buf, csize)) { csize = count;
read = -EFAULT;
goto done;
}
goto copy_done;
} else if (pfn < (CRASH_RELOCATE_SIZE / PAGE_SIZE))
pfn += relocate_start;
if (pfn > saved_max_pfn) {
read = 0;
goto done;
}
if (copy_oldmem_page(pfn, buf, csize, 1)) {
read = -EFAULT;
goto done;
}
copy_done: rc = copy_oldmem_page(pfn, buf, csize, offset, 1);
if (rc < 0)
return rc;
buf += csize; buf += csize;
*ppos += csize; *ppos += csize;
read += csize; read += csize;
count -= csize; count -= csize;
} }
done:
return read; return read;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment