From: "bhe@redhat.com" <bhe@redhat.com>
To: Atsushi Kumagai <ats-kumagai@wm.jp.nec.com>
Cc: Pratyush Anand <panand@redhat.com>,
"dyoung@redhat.com" <dyoung@redhat.com>,
"louis.bouchard@canonical.com" <louis.bouchard@canonical.com>,
"kexec@lists.infradead.org" <kexec@lists.infradead.org>
Subject: Re: [Makedumpfile PATCH V2 2/4] x86_64: translate all VA to PA using page table values
Date: Mon, 12 Dec 2016 17:50:20 +0800 [thread overview]
Message-ID: <20161212095020.GI1034@x1> (raw)
In-Reply-To: <0910DD04CBD6DE4193FCF86B9C00BE9701E8867A@BPXM01GP.gisp.nec.co.jp>
On 12/12/16 at 08:40am, Atsushi Kumagai wrote:
> >On Saturday 10 December 2016 07:03 AM, bhe@redhat.com wrote:
> >> On 12/10/16 at 09:29am, Baoquan He wrote:
> >>> On 12/09/16 at 10:25pm, Baoquan He wrote:
> >>>> On 12/09/16 at 03:40pm, Pratyush Anand wrote:
> >>>>>>> - page_dir = SYMBOL(init_level4_pgt);
> >>>>>>> + page_dir = SYMBOL(init_level4_pgt) - __START_KERNEL_map + phys_base;
> >>>>>>
> >>>>>> I found that this change breaks the backward compatibility for
> >>>>>> kernel 2.6.21 or older since phys_base was introduced in kernel 2.6.22
> >>>>>> by the commit below:
> >>>>>>
> >>>>>> commit 1ab60e0f72f71ec54831e525a3e1154f1c092408
> >>>>>> Author: Vivek Goyal <vgoyal@in.ibm.com>
> >>>>>> Date: Wed May 2 19:27:07 2007 +0200
> >>>>>>
> >>>>>> [PATCH] x86-64: Relocatable Kernel Support
> >>>>>>
> >>>>>> There is no problem if phys_base is always 0 in older kernel, but
> >>>>>> get_phys_base_x86_64() calculates "phys_base = 0x100000" from my vmcore:
> >>>>
> >>>> This is really awkward. Checked code, found PAGE_OFFSET is
> >>>> 0xffff810000000000 before 2.6.26, then changed to 0xffff880000000000
> >>>> after that. Can we check the page_offset calculated from pt_load
> >>>> segments, meanwhile check if has VMCOREINFO and osrelease after 2.6.21.
> >>>>
> >>>> With both of above condition, we could set phys_vase to 0. Not sure if
> >>>> this can solve the existing problem.
> >>>
> >>> I meant making a judgement:
> >>>
> >>
> >> Sorry, should be:
> >> if (page_offset == 0xffff810000000000 && !info->kernel_version > KERNEL_VERSION(2, 6, 21))
> >> info->phys_base = 0;
> >>
> >
> >
> >But you can not read kernel_version because those version does not have
> >VMCOREINFO. So, has_vmcoreinfo() still need to be used.
>
> Thanks for your comments, using has_vmcoreinfo() sounds like a good approach,
> but not perfect way. VMCOREINFO has been introduced since 2.6.24,
> 2.6.22 and 2.6.23 don't have VMCOREINFO but have phys_base.
>
> Conversely, 2.6.22 and 2.6.23 require vmlinux, so we can confirm the existence of
> phys_base with that. My idea is:
>
> diff --git a/arch/x86_64.c b/arch/x86_64.c
> index 010ea10..893cd51 100644
> --- a/arch/x86_64.c
> +++ b/arch/x86_64.c
> @@ -67,6 +67,14 @@ get_phys_base_x86_64(void)
> return TRUE;
> }
>
> + /* linux-2.6.21 or older don't have phys_base, should be set to 0. */
> + if (!has_vmcoreinfo()) {
> + SYMBOL_INIT(phys_base, "phys_base");
> + if (SYMBOL(phys_base) == NOT_FOUND_SYMBOL) {
> + return TRUE;
> + }
> + }
> +
> for (i = 0; get_pt_load(i, &phys_start, NULL, &virt_start, NULL); i++) {
> if (virt_start >= __START_KERNEL_map) {
>
>
> This fix may resolve my issue, but now I have another question that
> "Is the logic of get_phys_base_x86_64() correct in any kernel configuration ?"
> I mean I'm worried about the possibility that another offset gets mixed with
> the result of get_phys_base_x86_64() like my 2.6.21 case.
> After phys_base was introduced, does it always equal to the offset which can be
> calculated from PT_LOAD headers ?
Don't worry. phys_base was introduced just after 2.6.21.
commit 1ab60e0f72f71ec54831e525a3e1154f1c092408
Author: Vivek Goyal <vgoyal@in.ibm.com>
Date: Wed May 2 19:27:07 2007 +0200
[PATCH] x86-64: Relocatable Kernel Support
[bhe@x1 linux]$ git describe 1ab60e0f72f71ec54831e525a3e1154f1c092408
v2.6.21-1836-g1ab60e0
Thanks
Baoquan
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2016-12-12 9:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-31 8:17 [Makedumpfile PATCH V2 0/4] x86_64: Fix page_offset for randomized base enabled Pratyush Anand
2016-10-31 8:17 ` [Makedumpfile PATCH V2 1/4] x86_64: Calculate page_offset from pt_load Pratyush Anand
2016-10-31 8:17 ` [Makedumpfile PATCH V2 2/4] x86_64: translate all VA to PA using page table values Pratyush Anand
2016-12-09 7:35 ` Atsushi Kumagai
2016-12-09 10:10 ` Pratyush Anand
2016-12-09 14:25 ` bhe
2016-12-10 1:29 ` bhe
2016-12-10 1:33 ` bhe
2016-12-10 6:20 ` Pratyush Anand
2016-12-12 8:40 ` Atsushi Kumagai
2016-12-12 9:50 ` bhe [this message]
2016-12-13 7:03 ` Atsushi Kumagai
2016-10-31 8:17 ` [Makedumpfile PATCH V2 3/4] x86_64: kill is_vmalloc_addr_x86_64() Pratyush Anand
2016-10-31 8:17 ` [Makedumpfile PATCH V2 4/4] x86_64: kill some unused initialization Pratyush Anand
2016-11-01 5:34 ` [Makedumpfile PATCH V2 0/4] x86_64: Fix page_offset for randomized base enabled Dave Young
2016-11-04 10:35 ` Atsushi Kumagai
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=20161212095020.GI1034@x1 \
--to=bhe@redhat.com \
--cc=ats-kumagai@wm.jp.nec.com \
--cc=dyoung@redhat.com \
--cc=kexec@lists.infradead.org \
--cc=louis.bouchard@canonical.com \
--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 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.