Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Liu Hua <sdu.liu@huawei.com>
To: kumagai-atsushi@mxc.nes.nec.co.jp, chaowang@redhat.com
Cc: wangnan0@huawei.com, kexec@lists.infradead.org,
	peifeiyue@huawei.com, sdu.liu@huawei.com,
	ext-mika.1.westerberg@nokia.com
Subject: [PATCH] makedumpfile: ARM: get correct mem_map offset
Date: Wed, 7 May 2014 14:15:56 +0800	[thread overview]
Message-ID: <1399443356-46732-1-git-send-email-sdu.liu@huawei.com> (raw)

When converting paddr to pfn, makedumpfile firstly minuses the
offset of physical memory, and then do the right shift. But the
kernel only does the right shift.

For the cases of ARCH_PFN_OFFSET=0 or non sparse memormy model,
this introduces no problem.

But for my arma9 platform with ARCH_PFN_OFFSET=0x80000 and sparse
memory model. Makedumfile can not get the mem_map correctly. It it
due to there is still offset for mem_map array.

This patch introduces the offset of the mem_map.

But I have no environment to test this patch for other paltfrom.
So I am not sure this patch works on other platforms.

Signed-off-by: Liu Hua <sdu.liu@huawei.com>
---
 makedumpfile.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index 94515f6..6cf6e24 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -2807,6 +2807,7 @@ int
 get_mm_sparsemem(void)
 {
 	unsigned int section_nr, mem_section_size, num_section;
+	unsigned int section_start;
 	mdf_pfn_t pfn_start, pfn_end;
 	unsigned long section, mem_map;
 	unsigned long *mem_sec = NULL;
@@ -2817,6 +2818,7 @@ get_mm_sparsemem(void)
 	 * Get the address of the symbol "mem_section".
 	 */
 	num_section = divideup(info->max_mapnr, PAGES_PER_SECTION());
+	section_start = ARCH_PFN_OFFSET / PAGES_PER_SECTION();
 	if (is_sparsemem_extreme()) {
 		info->sections_per_root = _SECTIONS_PER_ROOT_EXTREME();
 		mem_section_size = sizeof(void *) * NR_SECTION_ROOTS();
@@ -2842,7 +2844,7 @@ get_mm_sparsemem(void)
 		goto out;
 	}
 	for (section_nr = 0; section_nr < num_section; section_nr++) {
-		section = nr_to_section(section_nr, mem_sec);
+		section = nr_to_section(section_nr + section_start, mem_sec);
 		if (section == NOT_KV_ADDR) {
 			mem_map = NOT_MEMMAP_ADDR;
 		} else {
@@ -2851,7 +2853,7 @@ get_mm_sparsemem(void)
 				mem_map = NOT_MEMMAP_ADDR;
 			} else {
 				mem_map = sparse_decode_mem_map(mem_map,
-								section_nr);
+								section_nr + section_start);
 				if (!is_kvaddr(mem_map))
 					mem_map = NOT_MEMMAP_ADDR;
 			}
-- 
1.9.0


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

             reply	other threads:[~2014-05-07  6:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-07  6:15 Liu Hua [this message]
2014-05-09  8:02 ` [PATCH] makedumpfile: ARM: get correct mem_map offset Atsushi Kumagai
2014-05-12  1:25   ` Liu hua
2014-05-15  8:21     ` Atsushi Kumagai
2014-05-19  8:26       ` Liu hua
2014-05-20  8:12         ` Atsushi Kumagai
2014-05-26  5:17           ` Liu hua
2014-06-03  6:37             ` 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=1399443356-46732-1-git-send-email-sdu.liu@huawei.com \
    --to=sdu.liu@huawei.com \
    --cc=chaowang@redhat.com \
    --cc=ext-mika.1.westerberg@nokia.com \
    --cc=kexec@lists.infradead.org \
    --cc=kumagai-atsushi@mxc.nes.nec.co.jp \
    --cc=peifeiyue@huawei.com \
    --cc=wangnan0@huawei.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