Commit 04d491ab authored by Neil Horman's avatar Neil Horman Committed by Linus Torvalds
Browse files

kexec: add dmesg log symbols to /proc/vmcoreinfo lists

It would be nice to be able to extract the dmesg log from a vmcore file
without needing to keep the debug symbols for the running kernel handy all
the time.  We have a facility to do this in /proc/vmcore.  This patch adds
the log_buf and log_end symbols to the vmcoreinfo area so that tools (like
makedumpfile) can easily extract the dmesg logs from a vmcore image.

[ several fixes and cleanups]
[ fix unused log_buf_kexec_setup()]
[ build fix]
Signed-off-by: default avatarNeil Horman <>
Cc: Simon Horman <>
Acked-by: default avatarVivek Goyal <>
Cc: Neil Horman <>
Cc: Simon Horman <>
Cc: Vivek Goyal <>
Cc: Randy Dunlap <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 23c36c1a
......@@ -242,6 +242,7 @@ extern struct ratelimit_state printk_ratelimit_state;
extern int printk_ratelimit(void);
extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
unsigned int interval_msec);
void log_buf_kexec_setup(void);
static inline int vprintk(const char *s, va_list args)
__attribute__ ((format (printf, 1, 0)));
......@@ -253,6 +254,9 @@ static inline int printk_ratelimit(void) { return 0; }
static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \
unsigned int interval_msec) \
{ return false; }
static inline void log_buf_kexec_setup(void)
extern int printk_needs_cpu(int cpu);
......@@ -1409,6 +1409,7 @@ static int __init crash_save_vmcoreinfo_init(void)
VMCOREINFO_OFFSET(list_head, prev);
VMCOREINFO_OFFSET(vm_struct, addr);
......@@ -32,6 +32,7 @@
#include <linux/security.h>
#include <linux/bootmem.h>
#include <linux/syscalls.h>
#include <linux/kexec.h>
#include <asm/uaccess.h>
......@@ -135,6 +136,24 @@ static char *log_buf = __log_buf;
static int log_buf_len = __LOG_BUF_LEN;
static unsigned logged_chars; /* Number of chars produced since last read+clear operation */
* This appends the listed symbols to /proc/vmcoreinfo
* /proc/vmcoreinfo is used by various utiilties, like crash and makedumpfile to
* obtain access to symbols that are otherwise very difficult to locate. These
* symbols are specifically used so that utilities can access and extract the
* dmesg log from a vmcore file after a crash.
void log_buf_kexec_setup(void)
static int __init log_buf_len_setup(char *str)
unsigned size = memparse(str, &str);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment