From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
To: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Cc: "kexec@lists.infradead.org" <kexec@lists.infradead.org>
Subject: Re: [PATCH v2] vmcore: copy fractional pages into buffers in the kdump 2nd kernel
Date: Fri, 14 Feb 2014 21:18:05 +0900 [thread overview]
Message-ID: <52FE097D.1070408@jp.fujitsu.com> (raw)
In-Reply-To: <0910DD04CBD6DE4193FCF86B9C00BE971E6D19@BPXM01GP.gisp.nec.co.jp>
(2014/02/06 18:38), Atsushi Kumagai wrote:
> On 2014/01/31 18:58:08, HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> wrote:
>> (2014/01/31 11:36), Atsushi Kumagai wrote:
>>> Hello HATAYAMA-san,
>>>
>>> On 2013/12/09 17:06:18, HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> wrote:
>>>> This is a patch for fixing mmap failure due to fractional page issue.
>>>>
>>>> This patch might be still a bit too large as a single patch and might need to split.
>>>> If you think patch refactoring is needed, please suggest.
>>>>
>>>> Change Log:
>>>>
>>>> v1 => v2)
>>>>
>>>> - Copy fractional pages from 1st kernel to 2nd kernel to reduce read
>>>> to the fractional pages for reliability.
>>>>
>>>> - Deal with the case where multiple System RAM areas are contained in
>>>> a single fractional page.
>>>>
>>>> Test:
>>>>
>>>> Tested on X86_64. Fractional pages are created using memmap= kernel
>>>> parameter on the kdump 1st kernel.
>>>
>>> Could you tell me more details about how to reproduce this ?
>>> I tried to create such fractional pages to test the patch at
>>> the end of this mail, by using memmap= kernel parameter as you said
>>> like below:
>>>
>>> # cat /proc/iomem
>>> ...
>>> 100000000-10fff57ff : System RAM
>>> 10fff5800-1100057ff : reserved
>>> 110005800-11fffffff : System RAM
>>>
>>> However, I couldn't face the mmap() failure and makedumpfile worked
>>> normally even using mmap() on linux-3.12.1. What am I missing here ?
>>>
>>
>> This patch set tries to reduce potential risk on accessing i.e. creating
>> page tables reading memory outside System RAM regions. The potential risk
>> I intend here is for example effect of accessing mmio region.
>>
>> If you didn't see any failure except for mmap() failure on fractional pages,
>> there's no potential risk on your system in the sense of what I mean above.
>> Or you could probably see different behavior by choosing other System RAM
>> region that resides in the memory that is used for something special.
>
> Thanks for your response, but I couldn't see even the mmap() failure caused
> by a sanity check in remap_pfn_range().
> I'll describe what I did for debugging as below.
>
> First, the 1st kernel's memory map I prepared and its PT_LOAD are here.
>
> # cat /proc/iomem
>
> ...
> 100000000-10fff57ff : System RAM
> 10fff5800-1100057ff : ACPI Tables
> 110005800-11fffffff : System RAM
>
> ...
>
> Type Offset VirtAddr PhysAddr
> FileSiz MemSiz Flags Align
> LOAD 0x00000000d07ca000 0xffff880100000000 0x0000000100000000
> 0x000000000fff5800 0x000000000fff5800 RWE 0
> LOAD 0x00000000e07c0800 0xffff880110005800 0x0000000110005800
> 0x000000000fffa800 0x000000000fffa800 RWE 0
>
>
> The fractional page I expected was [0x10fff5000 - 0x10fff57ff],
> so its file offset was [0xe07bf000 - 0xe07bf7ff].
>
> Second, I prepared a patch to make sure whether the fractional page was
> mapped with mmap() or not as below:
>
>
> diff --git a/makedumpfile.c b/makedumpfile.c
> index 7536274..b6abd31 100644
> --- a/makedumpfile.c
> +++ b/makedumpfile.c
> @@ -251,11 +251,16 @@ update_mmap_range(off_t offset, int initial) {
>
> map_size = MIN(max_offset - start_offset, info->mmap_region_size);
>
> + if (start_offset <= 0xe07bf000 && 0xe07bf000 <= (start_offset + map_size)) {
> + MSG("Try mapping [%llx-%llx] with mmap()\n",
> + (ulonglong)start_offset,
> + (ulonglong)(start_offset + map_size));
> + }
> +
> info->mmap_buf = mmap(NULL, map_size, PROT_READ, MAP_PRIVATE,
> info->fd_memory, start_offset);
>
>
> Finally, I run makedumpfile_v1.5.5 with only the debug patch above in
> 2nd kernel (linux-3.12.1):
>
> # makedumpfile -D -c /proc/vmcore ./dumpfile.c
> ...
>
> mmap() is available on the kernel.
> Copying data : [ 92.9 %] -Try mapping [e03f9000-e07f9000] with mmap()
> Copying data : [100.0 %] |
> Writing erase info...
> offset_eraseinfo: 12ad1218, size_eraseinfo: 0
>
> The dumpfile is saved to ./dumpfile.c.
>
> makedumpfile Completed.
> #
>
>
> According to this result, mmap() for the fractional page seemed to
> succeed even without any fix, so I suspect that I misunderstand
> something about the mmap() issue reported by Vivek.
> Perhaps, can a fractional page pass that sanity check depending on
> the situation ?
>
mmap fails if target region contains two or more different memory types,
and on Vivek's environment, some ACPI region was mapped as UC.
Because you didn't see this failure, ACPI Tables on your environment
would have the same memory type as System RAM.
--
Thanks.
HATAYAMA, Daisuke
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
prev parent reply other threads:[~2014-02-14 12:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-09 8:06 [PATCH v2] vmcore: copy fractional pages into buffers in the kdump 2nd kernel HATAYAMA Daisuke
2013-12-09 8:06 ` HATAYAMA Daisuke
2013-12-11 11:33 ` WANG Chao
2013-12-11 11:33 ` WANG Chao
2013-12-12 16:42 ` Vivek Goyal
2013-12-12 16:42 ` Vivek Goyal
2013-12-13 1:42 ` HATAYAMA Daisuke
2013-12-13 1:42 ` HATAYAMA Daisuke
2014-01-31 2:36 ` Atsushi Kumagai
2014-01-31 9:57 ` HATAYAMA Daisuke
2014-02-06 9:38 ` Atsushi Kumagai
2014-02-14 12:18 ` HATAYAMA Daisuke [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52FE097D.1070408@jp.fujitsu.com \
--to=d.hatayama@jp.fujitsu.com \
--cc=kexec@lists.infradead.org \
--cc=kumagai-atsushi@mxc.nes.nec.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.