From: Baoquan He <bhe@redhat.com>
To: ats-kumagai@wm.jp.nec.com
Cc: panand@redhat.com, kexec@lists.infradead.org,
anderson@redhat.com, ebiederm@xmission.com, tglx@linutronix.de,
dyoung@redhat.com
Subject: [PATCH v2 1/2] makedumpfile: Adapt code to get value of phys_base
Date: Thu, 10 Nov 2016 14:30:50 +0800 [thread overview]
Message-ID: <20161110063050.GE22737@x1> (raw)
In-Reply-To: <1478595319-9299-2-git-send-email-bhe@redhat.com>
Kernel code only exports virtual address of phys_base now and it's helpless
for Crash and Makedumpfile. Below patch which changes code to export value
of phys_base has been posted to upstream. So adapt code to get it.
kexec: Change to export the value of phys_base instead of symbol address
marc.info/?l=linux-kernel&m=147856863629624&w=2
Signed-off-by: Baoquan He <bhe@redhat.com>
---
v1->v2:
Patch v1 is not compatible with the old kernel. Change code in
get_phys_base_x86_64 and vtop4_x86_64 to avoid that according to
Atsushi's suggestion.
arch/x86_64.c | 12 +++++-------
makedumpfile.c | 5 ++---
makedumpfile.h | 2 +-
3 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/arch/x86_64.c b/arch/x86_64.c
index 3ef33ae..010ea10 100644
--- a/arch/x86_64.c
+++ b/arch/x86_64.c
@@ -62,6 +62,10 @@ get_phys_base_x86_64(void)
* Get the relocatable offset
*/
info->phys_base = 0; /* default/traditional */
+ if (NUMBER(phys_base) != NOT_FOUND_NUMBER) {
+ info->phys_base = NUMBER(phys_base);
+ return TRUE;
+ }
for (i = 0; get_pt_load(i, &phys_start, NULL, &virt_start, NULL); i++) {
if (virt_start >= __START_KERNEL_map) {
@@ -187,12 +191,6 @@ vtop4_x86_64(unsigned long vaddr)
{
unsigned long page_dir, pml4, pgd_paddr, pgd_pte, pmd_paddr, pmd_pte;
unsigned long pte_paddr, pte;
- unsigned long phys_base;
-
- if (SYMBOL(phys_base) != NOT_FOUND_SYMBOL)
- phys_base = info->phys_base;
- else
- phys_base = 0;
if (SYMBOL(init_level4_pgt) == NOT_FOUND_SYMBOL) {
ERRMSG("Can't get the symbol of init_level4_pgt.\n");
@@ -202,7 +200,7 @@ vtop4_x86_64(unsigned long vaddr)
/*
* Get PGD.
*/
- page_dir = SYMBOL(init_level4_pgt) - __START_KERNEL_map + phys_base;
+ page_dir = SYMBOL(init_level4_pgt) - __START_KERNEL_map + info->phys_base;
page_dir += pml4_index(vaddr) * sizeof(unsigned long);
if (!readmem(PADDR, page_dir, &pml4, sizeof pml4)) {
ERRMSG("Can't get pml4 (page_dir:%lx).\n", page_dir);
diff --git a/makedumpfile.c b/makedumpfile.c
index b916dfb..a3f711e 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -1507,7 +1507,6 @@ get_symbol_info(void)
SYMBOL_INIT(init_level4_pgt, "init_level4_pgt");
SYMBOL_INIT(vmlist, "vmlist");
SYMBOL_INIT(vmap_area_list, "vmap_area_list");
- SYMBOL_INIT(phys_base, "phys_base");
SYMBOL_INIT(node_online_map, "node_online_map");
SYMBOL_INIT(node_states, "node_states");
SYMBOL_INIT(node_memblk, "node_memblk");
@@ -2134,7 +2133,6 @@ write_vmcoreinfo_data(void)
WRITE_SYMBOL("init_level4_pgt", init_level4_pgt);
WRITE_SYMBOL("vmlist", vmlist);
WRITE_SYMBOL("vmap_area_list", vmap_area_list);
- WRITE_SYMBOL("phys_base", phys_base);
WRITE_SYMBOL("node_online_map", node_online_map);
WRITE_SYMBOL("node_states", node_states);
WRITE_SYMBOL("node_data", node_data);
@@ -2261,6 +2259,7 @@ write_vmcoreinfo_data(void)
WRITE_NUMBER("PAGE_BUDDY_MAPCOUNT_VALUE", PAGE_BUDDY_MAPCOUNT_VALUE);
WRITE_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
+ WRITE_NUMBER("phys_base", phys_base);
WRITE_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR);
@@ -2488,7 +2487,6 @@ read_vmcoreinfo(void)
READ_SYMBOL("init_level4_pgt", init_level4_pgt);
READ_SYMBOL("vmlist", vmlist);
READ_SYMBOL("vmap_area_list", vmap_area_list);
- READ_SYMBOL("phys_base", phys_base);
READ_SYMBOL("node_online_map", node_online_map);
READ_SYMBOL("node_states", node_states);
READ_SYMBOL("node_data", node_data);
@@ -2609,6 +2607,7 @@ read_vmcoreinfo(void)
READ_NUMBER("PAGE_BUDDY_MAPCOUNT_VALUE", PAGE_BUDDY_MAPCOUNT_VALUE);
READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
+ READ_NUMBER("phys_base", phys_base);
READ_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR);
diff --git a/makedumpfile.h b/makedumpfile.h
index 338c651..422b6be 100644
--- a/makedumpfile.h
+++ b/makedumpfile.h
@@ -1394,7 +1394,6 @@ struct symbol_table {
unsigned long long init_level4_pgt;
unsigned long long vmlist;
unsigned long long vmap_area_list;
- unsigned long long phys_base;
unsigned long long node_online_map;
unsigned long long node_states;
unsigned long long node_memblk;
@@ -1718,6 +1717,7 @@ struct number_table {
long SECTION_SIZE_BITS;
long MAX_PHYSMEM_BITS;
long HUGETLB_PAGE_DTOR;
+ long phys_base;
};
struct srcfile_table {
--
2.5.5
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2016-11-10 6:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-08 8:55 [PATCH 0/2] makedumpfile: Adapt code to get value of phys_base Baoquan He
2016-11-08 8:55 ` [PATCH 1/2] " Baoquan He
2016-11-10 3:57 ` Atsushi Kumagai
2016-11-10 4:51 ` Baoquan He
2016-11-10 6:30 ` Baoquan He [this message]
2016-11-11 8:12 ` [PATCH v2 " Atsushi Kumagai
2016-11-11 9:49 ` Baoquan He
2016-11-08 8:55 ` [PATCH 2/2] makedumpfile: Clean up unused KERNEL_IMAGE_SIZE Baoquan He
2016-11-08 14:26 ` Dave Anderson
2016-11-09 0:16 ` Baoquan He
2016-11-10 1:15 ` Atsushi Kumagai
2016-11-10 2:06 ` Baoquan He
2016-11-10 3:58 ` Atsushi Kumagai
2016-11-10 4:48 ` Baoquan He
2016-11-10 5:31 ` Atsushi Kumagai
2016-11-10 13:48 ` Dave Anderson
2016-11-09 6:55 ` Baoquan He
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=20161110063050.GE22737@x1 \
--to=bhe@redhat.com \
--cc=anderson@redhat.com \
--cc=ats-kumagai@wm.jp.nec.com \
--cc=dyoung@redhat.com \
--cc=ebiederm@xmission.com \
--cc=kexec@lists.infradead.org \
--cc=panand@redhat.com \
--cc=tglx@linutronix.de \
/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