Re: /proc/vmcore mmap() failure issue

From: Vivek Goyal
Date: Wed Nov 13 2013 - 18:01:39 EST


On Wed, Nov 13, 2013 at 02:44:45PM -0800, H. Peter Anvin wrote:
> On 11/13/2013 02:41 PM, Vivek Goyal wrote:
> >
> > Hi Peter,
> >
> > I noticed we seem to be trimming away partial pages in memblock.
> >
> > memblock_x86_fill() {
> > /* throw away partial pages */
> > memblock_trim_memory(PAGE_SIZE);
> > }
> >
> > But not in e820 hence they show up in /proc/iomem.
> >
>
> Why does /proc/iomem matter?

Kexec-tools parse /proc/iomem and prepare PT_LOAD elf headers for all
the RAM regions which need to be dumped out, including the partial page ones.
Second kernel parses these headers and exports to user space in /proc/vmcore.
Makedumpfile tries to mmap() vmcore then tries to map the partial page pfn
too and we run into issues.

>
> > How about something along the lines as below patch. This fixes my
> > /proc/vmcore mmap() issue.
>
> I'm not sure if what you're seeing is something that is better handled
> in userspace.

I think it should be easy to truncate ELF headers in kexec-tools too when
we are preparing elf headers. I am not sure if it is right thing to do or
not. If some entry is showing up in /proc/iomem as RAM, then kexec-tools
need to believe that it is a possibility that kernel is using that pfn and
that pfn needs to be dumped out in vmcore. IMHO, kernel should fix this
issue.

Secondly, I am writing in-kernel kexec support too and I prepare ELF
headers there too. And I am facing the same problem there too. So if
we truncate partial pages in e820 both kexec-tools and in kernel kexec
implementation don't have to do anything.

Thanks
Vivek
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/