From: "bhe@redhat.com" <bhe@redhat.com>
To: Atsushi Kumagai <ats-kumagai@wm.jp.nec.com>
Cc: Pratyush Anand <panand@redhat.com>,
"kexec@lists.infradead.org" <kexec@lists.infradead.org>,
"dyoung@redhat.com" <dyoung@redhat.com>
Subject: Re: [PATCH Makedumpfile 1/4] x86_64: Calculate page_offset from pt_load
Date: Wed, 2 Nov 2016 16:02:05 +0800 [thread overview]
Message-ID: <20161102080205.GA6084@x1> (raw)
In-Reply-To: <0910DD04CBD6DE4193FCF86B9C00BE9701E7C84F@BPXM01GP.gisp.nec.co.jp>
On 11/02/16 at 07:40am, Atsushi Kumagai wrote:
> Hello Pratyush,
>
> >On Monday 24 October 2016 10:18 PM, Pratyush Anand wrote:
> >> page_offset can always be calculated as 'virtual - physical' for a direct
> >> mapping area on x86. Therefore, remove the version dependent calculation
> >> and use this method.
> >>
> >> Signed-off-by: Pratyush Anand <panand@redhat.com>
> >> ---
> >> arch/x86_64.c | 24 ++++++++++++++++++++----
> >> 1 file changed, 20 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/arch/x86_64.c b/arch/x86_64.c
> >> index ddf7be6bc57b..a96fd8ae00a1 100644
> >> --- a/arch/x86_64.c
> >> +++ b/arch/x86_64.c
> >> @@ -44,6 +44,24 @@ get_xen_p2m_mfn(void)
> >> return NOT_FOUND_LONG_VALUE;
> >> }
> >>
> >> +static int
> >> +get_page_offset_x86_64(void)
> >> +{
> >> + int i;
> >> + unsigned long long phys_start;
> >> + unsigned long long virt_start;
> >> +
> >> + for (i = 0; get_pt_load(i, &phys_start, NULL, &virt_start, NULL); i++) {
> >> + if (virt_start >= __START_KERNEL_map) {
> >
> >OK..So, this is the problem. We should have
> >
> >if (virt_start < __START_KERNEL_map) {
> >
> >Kernel text region lies above __START_KERNEL_map, which is linearly
> >mapped however not a direct mapping. Direct mapping region lies below it
> >instead. So, page_offset can only be calculated with a region which is
> >below __START_KERNEL_map.
> >
> >Thanks Baoquan for finding it.
>
> Could you explain the issue in more detail, what is the difference
> between "linear map" and "direct map" ?
Well, these could be easily misunderstood. Virtual address in kernel text
region or within direct mapping which is from PAGE_OFFSET are all linear
mapping. Because the related PA can be calculated by:
PA= VA - PAGE_OFFSET; //y=x - a;
PA= VA - __START_KERNEL_map + phys_base; //y=x-a+b
In user-space kexec-tools we created pt_load program segments for kernel
text region and crash memory regions. The first program header is kernel
text region. So here if we want to get page_offset, just need to ignore
the 1st one, kernel text region.
>
> BTW, I confirmed that the difference of v2 patch is only this and
> the result of benchmark looks great, thank you very much.
>
>
> Regards,
> Atsushi Kumagai
>
> >> + info->page_offset = virt_start - phys_start;
> >> + return TRUE;
> >> + }
> >> + }
> >> +
> >> + ERRMSG("Can't get any pt_load to calculate page offset.\n");
> >> + return FALSE;
> >> +}
> >> +
> >> int
> >> get_phys_base_x86_64(void)
> >> {
> >> @@ -159,10 +177,8 @@ get_versiondep_info_x86_64(void)
> >> else
> >> info->max_physmem_bits = _MAX_PHYSMEM_BITS_2_6_31;
> >>
> >> - if (info->kernel_version < KERNEL_VERSION(2, 6, 27))
> >> - info->page_offset = __PAGE_OFFSET_ORIG;
> >> - else
> >> - info->page_offset = __PAGE_OFFSET_2_6_27;
> >> + if (!get_page_offset_x86_64())
> >> + return FALSE;
> >>
> >> if (info->kernel_version < KERNEL_VERSION(2, 6, 31)) {
> >> info->vmalloc_start = VMALLOC_START_ORIG;
> >>
> >
> >_______________________________________________
> >kexec mailing list
> >kexec@lists.infradead.org
> >http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2016-11-02 8:02 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 16:48 [PATCH Makedumpfile 0/4] x86_64: Fix page_offset for randomized base enabled Pratyush Anand
2016-10-24 16:48 ` [PATCH] temp Pratyush Anand
2016-10-24 16:51 ` Pratyush Anand
2016-10-24 16:48 ` [PATCH Makedumpfile 1/4] x86_64: Calculate page_offset from pt_load Pratyush Anand
2016-10-27 6:03 ` Pratyush Anand
2016-11-02 7:40 ` Atsushi Kumagai
2016-11-02 8:02 ` bhe [this message]
2016-11-04 10:35 ` Atsushi Kumagai
2016-10-24 16:48 ` [PATCH Makedumpfile 2/4] x86_64: translate all VA to PA using page table values Pratyush Anand
2016-10-25 9:20 ` Atsushi Kumagai
2016-10-25 15:12 ` Pratyush Anand
2016-10-25 23:28 ` bhe
2016-10-26 6:24 ` Atsushi Kumagai
2016-10-24 16:48 ` [PATCH Makedumpfile 3/4] x86_64: kill is_vmalloc_addr_x86_64() Pratyush Anand
2016-10-24 16:48 ` [PATCH Makedumpfile 4/4] x86_64: kill some unused initialization Pratyush Anand
2016-10-25 9:17 ` [PATCH Makedumpfile 0/4] x86_64: Fix page_offset for randomized base enabled Louis Bouchard
2016-10-25 9:20 ` Pratyush Anand
2016-10-27 2:37 ` Dave Young
2016-10-27 2:54 ` Dave Young
2016-10-27 6:19 ` Dave Young
[not found] ` <926225735.8567580.1477574985798.JavaMail.zimbra@redhat.com>
2016-10-27 15:25 ` Dave Anderson
2016-10-27 15:41 ` Dave Anderson
2016-10-28 2:04 ` Dave Young
2016-10-27 15:59 ` Pratyush Anand
2016-10-27 3:25 ` Baoquan He
2016-10-27 5:11 ` Pratyush Anand
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=20161102080205.GA6084@x1 \
--to=bhe@redhat.com \
--cc=ats-kumagai@wm.jp.nec.com \
--cc=dyoung@redhat.com \
--cc=kexec@lists.infradead.org \
--cc=panand@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox