[patch v2 02/10] kdump: Make kimage_load_crash_segment() weak

Michael Holzheu
2011-07-27T13:00:22Z

[-- Attachment #1: s390-kdump-common-load_crash_segment.patch --]
[-- Type: text/plain, Size: 1415 bytes --]

From: Michael Holzheu <holzheu@linux.vnet.ibm.com>

On s390 we do not create page tables at all for the crashkernel memory.
This requires a s390 specific version for kimage_load_crash_segment().
Therefore this patch declares this function as "__weak". The s390 version is
very simple. It just copies the kexec segment to real memory without using
page tables:

int kimage_load_crash_segment(struct kimage *image,
struct kexec_segment *segment)
{
return copy_from_user_real((void *) segment->mem, segment->buf,
segment->bufsz);
}

There are two main advantages of not creating page tables for the
crashkernel memory:

a) It saves memory. We have scenarios in mind, where crashkernel
memory can be very large and saving page table space is important.
b) We protect the crashkernel memory from being overwritten.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
---
kernel/kexec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -842,8 +842,8 @@ out:
return result;
}

-static int kimage_load_crash_segment(struct kimage *image,
- struct kexec_segment *segment)
+int __weak kimage_load_crash_segment(struct kimage *image,
+ struct kexec_segment *segment)
{
/* For crash dumps kernels we simply copy the data from
* user space to it's destination.