lkml.org 
[lkml]   [2013]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: /proc/vmcore mmap() failure issue
Date
On 2013/11/18 22:56:10, kexec <kexec-bounces@lists.infradead.org> wrote:
> On Mon, Nov 18, 2013 at 12:51:39AM +0000, Atsushi Kumagai wrote:
>
> [..]
> > > Is there any chance that you could look into fixing this. I have no
> > > experience writing code for makedumpfile.
> >
> > I'll send a patch to fix this soon.
>
> Thanks Atsushi.
>
> Vivek

Vivek, could you test this patch ?

Thanks
Atsushi Kumagai


From: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Date: Wed, 20 Nov 2013 10:05:03 +0900
Subject: [PATCH] Disable mmap() for reading fractional pages.

Since mmap() was introduced on /proc/vmcore, it fails
for fractional pages which don't start or end at page boundary
due to kernel issue.
This patch disables mmap() temporarily for fractional pages
to avoid this issue, so mmap() will be used only for aligned pages.

Signed-off-by: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
---
makedumpfile.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index 3746cf6..ca03440 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -368,6 +368,7 @@ readpage_elf(unsigned long long paddr, void *bufptr)
off_t offset1, offset2;
size_t size1, size2;
unsigned long long phys_start, phys_end, frac_head = 0;
+ int original_usemmap = info->flag_usemmap;

offset1 = paddr_to_offset(paddr);
offset2 = paddr_to_offset(paddr + info->page_size);
@@ -392,6 +393,7 @@ readpage_elf(unsigned long long paddr, void *bufptr)
offset1 = paddr_to_offset(phys_start);
frac_head = phys_start - paddr;
memset(bufptr, 0, frac_head);
+ info->flag_usemmap = FALSE;
}

/*
@@ -402,6 +404,7 @@ readpage_elf(unsigned long long paddr, void *bufptr)
phys_end = page_head_to_phys_end(paddr);
offset2 = paddr_to_offset(phys_end);
memset(bufptr + (phys_end - paddr), 0, info->page_size - (phys_end - paddr));
+ info->flag_usemmap = FALSE;
}

/*
@@ -420,7 +423,7 @@ readpage_elf(unsigned long long paddr, void *bufptr)
if(!read_from_vmcore(offset1, bufptr + frac_head, size1)) {
ERRMSG("Can't read the dump memory(%s).\n",
info->name_memory);
- return FALSE;
+ goto error;
}

if (size1 + frac_head != info->page_size) {
@@ -429,11 +432,16 @@ readpage_elf(unsigned long long paddr, void *bufptr)
if(!read_from_vmcore(offset2, bufptr + frac_head + size1, size2)) {
ERRMSG("Can't read the dump memory(%s).\n",
info->name_memory);
- return FALSE;
+ goto error;
}
}

+ info->flag_usemmap = original_usemmap;
return TRUE;
+
+error:
+ info->flag_usemmap = original_usemmap;
+ return FALSE;
}

static int
--
1.8.0.2

\
 
 \ /
  Last update: 2013-11-20 07:01    [W:0.336 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site