From: Bernhard Walle <bwalle@suse.de>
To: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Cc: kexec@lists.infradead.org
Subject: [PATCH] [makedumpfile] Fix problem with `half' pages
Date: Fri, 18 May 2007 12:50:04 +0200 [thread overview]
Message-ID: <20070518105003.GE16227@suse.de> (raw)
We have a system here with following memory map:
/proc/iomem:
4ffe14000-4ffe7ffff : reserved
4ffe80000-4fffb5fff : System RAM
4fffb6000-4ffffffff : reserved
max_pfn = 1310720
In that case, the last page of the "System RAM" is not full in 16K page size
configuration. That leads to an error in makedumpfile when it checks if that's
a zero page. It's because it tries to read the whole page and the read()
fails because it's after the end of the dump file.
That patch fixes this problem.
Signed-off-by: Bernhard Walle <bwalle@suse.de>
---
makedumpfile.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -3155,6 +3155,7 @@ create_dump_bitmap(struct DumpInfo *info
for (; pfn < mmd->pfn_end;
pfn++, mem_map += SIZE(page),
paddr += info->page_size) {
+ int page_mem_size = info->page_size;
if ((pfn != 0) && (pfn%PFN_BUFBITMAP) == 0) {
/*
@@ -3190,6 +3191,14 @@ create_dump_bitmap(struct DumpInfo *info
val = 0;
/*
+ * check for pages that are not complete pages and
+ * decrease the page size here
+ */
+ if (val == 1 && !is_in_segs(info, paddr + info->page_size))
+ while (!is_in_segs(info, paddr + page_mem_size))
+ page_mem_size--;
+
+ /*
* Set the 1st-bitmap.
* val 1: not memory hole
* 0: memory hole
@@ -3223,13 +3232,13 @@ create_dump_bitmap(struct DumpInfo *info
info->name_memory, strerror(errno));
goto out;
}
- if (read(info->fd_memory, buf, info->page_size)
- != info->page_size) {
+ if (read(info->fd_memory, buf, page_mem_size)
+ != page_mem_size) {
ERRMSG("Can't read the dump memory(%s). %s\n",
info->name_memory, strerror(errno));
goto out;
}
- if (is_zero_page(buf, info->page_size))
+ if (is_zero_page(buf, page_mem_size))
val = 0;
}
if ((info->dump_level <= DL_EXCLUDE_ZERO)
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next reply other threads:[~2007-05-18 10:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-18 10:50 Bernhard Walle [this message]
2007-05-23 12:38 ` [PATCH] [makedumpfile] Fix problem with `half' pages Ken'ichi Ohmichi
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=20070518105003.GE16227@suse.de \
--to=bwalle@suse.de \
--cc=kexec@lists.infradead.org \
--cc=oomichi@mxs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox