From: Neil Horman <nhorman@redhat.com> Date: Mon, 23 Feb 2009 14:36:38 -0500 Subject: [kexec] add ability to dump log from vmcore file Message-id: 20090223193638.GC13120@shamino.rdu.redhat.com O-Subject: [RHEL 5.4 PATCH] kexec: add ability to dump log from vmcore file (bz 485308) Bugzilla: 485308 RH-Acked-by: Dave Anderson <anderson@redhat.com> Hey all- This is a kernel patch to add needed symbols to implement this dump_dmesg feature we recently implemented in makedumpfile. This was in fact the patch that I was asking about previously regarding the bizzare ABI breakage. It tunred out I was wrong when I responded to Petes suggestion that there were some resoved forward declarations that came with the inclusion of kexec.h. It turns out you were right pete. I didn't follow it all the way to the end, but it became pretty clear that there were some resolved declarations through a fairly convoluted path through the asm/kexec.h->page.h header files. Sufficie it to say, I did something silly in my previous testing, as a subsequent test showed that doing a __GENKYSYMS__ on kexec.h fixed it right up, as did moving the include and the new function ot the end of the file. Brew build here: https://brewweb.devel.redhat.com/taskinfo?taskID=1696991 This is a backport of the same patch which is sitting in -mm and resolves bz 485308 diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 63f688d..fbbdf8f 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -157,6 +157,7 @@ asmlinkage int vprintk(const char *fmt, va_list args) __attribute__ ((format (printf, 1, 0))); asmlinkage int printk(const char * fmt, ...) __attribute__ ((format (printf, 1, 2))); +extern void log_buf_kexec_setup(void); #else static inline int vprintk(const char *s, va_list args) __attribute__ ((format (printf, 1, 0))); diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 2e1deb2..24ae9f0 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -197,5 +197,6 @@ struct pt_regs; struct task_struct; static inline void crash_kexec(struct pt_regs *regs) { } static inline int kexec_should_crash(struct task_struct *p) { return 0; } +#define SYMBOL(x) #endif /* CONFIG_KEXEC */ #endif /* LINUX_KEXEC_H */ diff --git a/kernel/kexec.c b/kernel/kexec.c index dbb6313..fceb1f0 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -1263,7 +1263,9 @@ static int __init crash_save_vmcoreinfo_init(void) OFFSET(list_head, next); OFFSET(list_head, prev); LENGTH(zone.free_area, MAX_ORDER); - +#ifdef CONFIG_PRINTK + log_buf_kexec_setup(); +#endif arch_crash_save_vmcoreinfo(); return 0; diff --git a/kernel/printk.c b/kernel/printk.c index d1cb5ea..4f162c0 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -35,6 +35,9 @@ #include <linux/syscalls.h> #include <asm/uaccess.h> +#ifndef __GENKSYMS__ +#include <linux/kexec.h> +#endif #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) @@ -125,6 +128,14 @@ static char *log_buf = __log_buf; static int log_buf_len = __LOG_BUF_LEN; static unsigned long logged_chars; /* Number of chars produced since last read+clear operation */ +void log_buf_kexec_setup(void) +{ + SYMBOL(log_buf); + SYMBOL(log_end); + SYMBOL(log_buf_len); + SYMBOL(logged_chars); +} + static int __init log_buf_len_setup(char *str) { unsigned long size = memparse(str, &str);