From: Hariprasad Nellitheertha <hari@in.ibm.com>
To: akpm@osdl.org, linux-kernel@vger.kernel.org, fastboot@osdl.org
Cc: Suparna Bhattacharya <suparna@in.ibm.com>,
mbligh@aracnet.com, ebiederm@xmission.com, litke@us.ibm.com
Subject: Re: [PATCH][3/6]Routines for copying the dump pages
Date: Wed, 15 Sep 2004 18:24:22 +0530 [thread overview]
Message-ID: <20040915125422.GD15450@in.ibm.com> (raw)
In-Reply-To: <20040915125322.GC15450@in.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 108 bytes --]
Regards, Hari
--
Hariprasad Nellitheertha
Linux Technology Center
India Software Labs
IBM India, Bangalore
[-- Attachment #2: kd-copy-269rc1-mm5.patch --]
[-- Type: text/plain, Size: 3622 bytes --]
This patch provides the interfaces necessary to read the dump contents,
treating it as a high memory device.
Signed off by Hariprasad Nellitheertha <hari@in.ibm.com>
---
linux-2.6.9-rc1-hari/arch/i386/mm/highmem.c | 18 +++++++++++++
linux-2.6.9-rc1-hari/include/asm-i386/highmem.h | 1
linux-2.6.9-rc1-hari/include/linux/highmem.h | 31 ++++++++++++++++++++++++
3 files changed, 50 insertions(+)
diff -puN arch/i386/mm/highmem.c~kd-copy-269rc1-mm5 arch/i386/mm/highmem.c
--- linux-2.6.9-rc1/arch/i386/mm/highmem.c~kd-copy-269rc1-mm5 2004-09-15 17:36:33.000000000 +0530
+++ linux-2.6.9-rc1-hari/arch/i386/mm/highmem.c 2004-09-15 17:36:33.000000000 +0530
@@ -74,6 +74,24 @@ void kunmap_atomic(void *kvaddr, enum km
preempt_check_resched();
}
+/* This is the same as kmap_atomic() but can map memory that doesn't
+ * have a struct page associated with it.
+ */
+void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
+{
+ enum fixed_addresses idx;
+ unsigned long vaddr;
+
+ inc_preempt_count();
+
+ idx = type + KM_TYPE_NR*smp_processor_id();
+ vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
+ set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot));
+ __flush_tlb_one(vaddr);
+
+ return (void*) vaddr;
+}
+
struct page *kmap_atomic_to_page(void *ptr)
{
unsigned long idx, vaddr = (unsigned long)ptr;
diff -puN include/asm-i386/highmem.h~kd-copy-269rc1-mm5 include/asm-i386/highmem.h
--- linux-2.6.9-rc1/include/asm-i386/highmem.h~kd-copy-269rc1-mm5 2004-09-15 17:36:33.000000000 +0530
+++ linux-2.6.9-rc1-hari/include/asm-i386/highmem.h 2004-09-15 17:36:33.000000000 +0530
@@ -61,6 +61,7 @@ void *kmap(struct page *page);
void kunmap(struct page *page);
void *kmap_atomic(struct page *page, enum km_type type);
void kunmap_atomic(void *kvaddr, enum km_type type);
+void *kmap_atomic_pfn(unsigned long pfn, enum km_type type);
struct page *kmap_atomic_to_page(void *ptr);
#define flush_cache_kmaps() do { } while (0)
diff -puN include/linux/highmem.h~kd-copy-269rc1-mm5 include/linux/highmem.h
--- linux-2.6.9-rc1/include/linux/highmem.h~kd-copy-269rc1-mm5 2004-09-15 17:36:33.000000000 +0530
+++ linux-2.6.9-rc1-hari/include/linux/highmem.h 2004-09-15 17:36:33.000000000 +0530
@@ -6,6 +6,7 @@
#include <linux/mm.h>
#include <asm/cacheflush.h>
+#include <asm/uaccess.h>
#ifdef CONFIG_HIGHMEM
@@ -30,6 +31,7 @@ static inline void *kmap(struct page *pa
#define kmap_atomic(page, idx) page_address(page)
#define kunmap_atomic(addr, idx) do { } while (0)
+#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn))
#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
#endif /* CONFIG_HIGHMEM */
@@ -86,4 +88,33 @@ static inline void copy_highpage(struct
kunmap_atomic(vto, KM_USER1);
}
+/*
+ * Copy a page from "oldmem". For this page, there is no pte mapped
+ * in the current kernel. We stitch up a pte, similar to kmap_atomic.
+ */
+static inline ssize_t copy_oldmem_page(unsigned long pfn,
+ char *buf, size_t csize, int userbuf)
+{
+ void *page, *vaddr;
+
+ if (!csize)
+ return 0;
+
+ page = kmalloc(PAGE_SIZE, GFP_KERNEL);
+
+ vaddr = kmap_atomic_pfn(pfn, KM_PTE0);
+ copy_page(page, vaddr);
+ kunmap_atomic(vaddr, KM_PTE0);
+
+ if (userbuf) {
+ if (copy_to_user(buf, page, csize)) {
+ kfree(page);
+ return -EFAULT;
+ }
+ } else
+ memcpy(buf, page, csize);
+ kfree(page);
+
+ return 0;
+}
#endif /* _LINUX_HIGHMEM_H */
_
next prev parent reply other threads:[~2004-09-15 12:57 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-15 12:50 kexec based crash dumping Hariprasad Nellitheertha
2004-09-15 12:51 ` [PATCH][1/6]Documentation Hariprasad Nellitheertha
2004-09-15 12:53 ` [PATCH][2/6]Memory preserving reboot using kexec Hariprasad Nellitheertha
2004-09-15 12:54 ` Hariprasad Nellitheertha [this message]
2004-09-15 12:55 ` [PATCH][4/6]Register snapshotting before kexec boot Hariprasad Nellitheertha
2004-09-15 12:56 ` [PATCH][5/6]ELF format dump file access Hariprasad Nellitheertha
2004-09-15 12:57 ` [PATCH][6/6]Linear/raw " Hariprasad Nellitheertha
2004-09-15 21:28 ` [PATCH][5/6]ELF " Andrew Morton
2004-09-15 21:29 ` Andrew Morton
2004-09-15 21:31 ` Andrew Morton
2004-09-15 21:27 ` [PATCH][4/6]Register snapshotting before kexec boot Andrew Morton
2004-09-16 8:11 ` [Fastboot] " Dipankar Sarma
2004-09-17 14:53 ` Srivatsa Vaddagiri
2004-09-19 20:17 ` Eric W. Biederman
2004-09-15 21:23 ` [PATCH][3/6]Routines for copying the dump pages Andrew Morton
2004-09-15 21:22 ` [PATCH][2/6]Memory preserving reboot using kexec Andrew Morton
2004-09-19 20:37 ` [Fastboot] " Eric W. Biederman
2004-09-20 13:49 ` Hariprasad Nellitheertha
2004-09-20 19:53 ` Eric W. Biederman
2004-09-15 17:33 ` [Fastboot] kexec based crash dumping Eric W. Biederman
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=20040915125422.GD15450@in.ibm.com \
--to=hari@in.ibm.com \
--cc=akpm@osdl.org \
--cc=ebiederm@xmission.com \
--cc=fastboot@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=litke@us.ibm.com \
--cc=mbligh@aracnet.com \
--cc=suparna@in.ibm.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.