aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kexec.h
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2007-05-08 03:28:22 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:07 -0400
commit6672f76a5a1878d42264c1deba8f1ab52b4618d9 (patch)
tree77396eefed3548183c1f0c3d1dc38f034d8fc429 /include/linux/kexec.h
parent73285082745045bcd64333c1fbaa88f8490f2626 (diff)
kdump/kexec: calculate note size at compile time
Currently the size of the per-cpu region reserved to save crash notes is set by the per-architecture value MAX_NOTE_BYTES. Which in turn is currently set to 1024 on all supported architectures. While testing ia64 I recently discovered that this value is in fact too small. The particular setup I was using actually needs 1172 bytes. This lead to very tedious failure mode where the tail of one elf note would overwrite the head of another if they ended up being alocated sequentially by kmalloc, which was often the case. It seems to me that a far better approach is to caclculate the size that the area needs to be. This patch does just that. If a simpler stop-gap patch for ia64 to be squeezed into 2.6.21(.X) is needed then this should be as easy as making MAX_NOTE_BYTES larger in arch/asm-ia64/kexec.h. Perhaps 2048 would be a good choice. However, I think that the approach in this patch is a much more robust idea. Acked-by: Vivek Goyal <vgoyal@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/kexec.h')
-rw-r--r--include/linux/kexec.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 696e5ec63f77..8c2c7fcd58ce 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -7,6 +7,8 @@
7#include <linux/linkage.h> 7#include <linux/linkage.h>
8#include <linux/compat.h> 8#include <linux/compat.h>
9#include <linux/ioport.h> 9#include <linux/ioport.h>
10#include <linux/elfcore.h>
11#include <linux/elf.h>
10#include <asm/kexec.h> 12#include <asm/kexec.h>
11 13
12/* Verify architecture specific macros are defined */ 14/* Verify architecture specific macros are defined */
@@ -31,6 +33,19 @@
31#error KEXEC_ARCH not defined 33#error KEXEC_ARCH not defined
32#endif 34#endif
33 35
36#define KEXEC_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4)
37#define KEXEC_CORE_NOTE_NAME "CORE"
38#define KEXEC_CORE_NOTE_NAME_BYTES ALIGN(sizeof(KEXEC_CORE_NOTE_NAME), 4)
39#define KEXEC_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_prstatus), 4)
40/*
41 * The per-cpu notes area is a list of notes terminated by a "NULL"
42 * note header. For kdump, the code in vmcore.c runs in the context
43 * of the second kernel to combine them into one note.
44 */
45#define KEXEC_NOTE_BYTES ( (KEXEC_NOTE_HEAD_BYTES * 2) + \
46 KEXEC_CORE_NOTE_NAME_BYTES + \
47 KEXEC_CORE_NOTE_DESC_BYTES )
48
34/* 49/*
35 * This structure is used to hold the arguments that are used when loading 50 * This structure is used to hold the arguments that are used when loading
36 * kernel binaries. 51 * kernel binaries.
@@ -136,7 +151,7 @@ extern struct kimage *kexec_crash_image;
136/* Location of a reserved region to hold the crash kernel. 151/* Location of a reserved region to hold the crash kernel.
137 */ 152 */
138extern struct resource crashk_res; 153extern struct resource crashk_res;
139typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; 154typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4];
140extern note_buf_t *crash_notes; 155extern note_buf_t *crash_notes;
141 156
142 157