From: "Sachin P. Sant" <sachinp@in.ibm.com>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH] powerpc: Fix /dev/oldmem for kdump
Date: Thu, 26 Jun 2008 16:25:16 +0530 [thread overview]
Message-ID: <48637594.5040709@in.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 226 bytes --]
This one has been pending for a long time. Somehow never
made it upstream.
Resending the patch which fixes /dev/oldmem interface for kdump.
Tested with 2.6.26-rc8.
Signed-off-by : Michael Ellerman <michael@ellerman.id.au>
[-- Attachment #2: fix-oldmem-interface-for-kdump --]
[-- Type: text/plain, Size: 1847 bytes --]
Fix /dev/oldmem for kdump
A change to __ioremap() broke reading /dev/oldmem because we're no
longer able to ioremap pfn 0 (d177c207ba16b1db31283e2d1fee7ad4a863584b).
We actually don't need to ioremap for anything that's part of the linear
mapping, so just read it directly.
Also make sure we're only reading one page or less at a time.
Signed-off-by : Michael Ellerman <michael@ellerman.id.au>
---
diff -Naurp old/arch/powerpc/kernel/crash_dump.c new/arch/powerpc/kernel/crash_dump.c
--- old/arch/powerpc/kernel/crash_dump.c 2008-06-25 07:28:20.000000000 +0530
+++ new/arch/powerpc/kernel/crash_dump.c 2008-06-26 14:46:17.000000000 +0530
@@ -83,6 +83,19 @@ static int __init parse_savemaxmem(char
}
__setup("savemaxmem=", parse_savemaxmem);
+
+static size_t copy_oldmem_vaddr(void *vaddr, char *buf, size_t csize,
+ unsigned long offset, int userbuf)
+{
+ if (userbuf) {
+ if (copy_to_user((char __user *)buf, (vaddr + offset), csize))
+ return -EFAULT;
+ } else
+ memcpy(buf, (vaddr + offset), csize);
+
+ return csize;
+}
+
/**
* copy_oldmem_page - copy one page from "oldmem"
* @pfn: page frame number to be copied
@@ -104,16 +117,16 @@ ssize_t copy_oldmem_page(unsigned long p
if (!csize)
return 0;
- vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0);
+ csize = min(csize, PAGE_SIZE);
- if (userbuf) {
- if (copy_to_user((char __user *)buf, (vaddr + offset), csize)) {
- iounmap(vaddr);
- return -EFAULT;
- }
- } else
- memcpy(buf, (vaddr + offset), csize);
+ if (pfn < max_pfn) {
+ vaddr = __va(pfn << PAGE_SHIFT);
+ csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
+ } else {
+ vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0);
+ csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
+ iounmap(vaddr);
+ }
- iounmap(vaddr);
return csize;
}
next reply other threads:[~2008-06-26 11:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-26 10:55 Sachin P. Sant [this message]
2008-07-03 6:15 ` [PATCH] powerpc: Fix /dev/oldmem for kdump Michael Ellerman
2008-07-03 6:32 ` Sachin P. Sant
2008-07-03 6:36 ` Michael Ellerman
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=48637594.5040709@in.ibm.com \
--to=sachinp@in.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
/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.