diff options
Diffstat (limited to 'kernel/printk.c')
-rw-r--r-- | kernel/printk.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index e3602d0755b0..5052b5497c67 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/security.h> | 32 | #include <linux/security.h> |
33 | #include <linux/bootmem.h> | 33 | #include <linux/bootmem.h> |
34 | #include <linux/syscalls.h> | 34 | #include <linux/syscalls.h> |
35 | #include <linux/kexec.h> | ||
35 | 36 | ||
36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
37 | 38 | ||
@@ -135,6 +136,24 @@ static char *log_buf = __log_buf; | |||
135 | static int log_buf_len = __LOG_BUF_LEN; | 136 | static int log_buf_len = __LOG_BUF_LEN; |
136 | static unsigned logged_chars; /* Number of chars produced since last read+clear operation */ | 137 | static unsigned logged_chars; /* Number of chars produced since last read+clear operation */ |
137 | 138 | ||
139 | #ifdef CONFIG_KEXEC | ||
140 | /* | ||
141 | * This appends the listed symbols to /proc/vmcoreinfo | ||
142 | * | ||
143 | * /proc/vmcoreinfo is used by various utiilties, like crash and makedumpfile to | ||
144 | * obtain access to symbols that are otherwise very difficult to locate. These | ||
145 | * symbols are specifically used so that utilities can access and extract the | ||
146 | * dmesg log from a vmcore file after a crash. | ||
147 | */ | ||
148 | void log_buf_kexec_setup(void) | ||
149 | { | ||
150 | VMCOREINFO_SYMBOL(log_buf); | ||
151 | VMCOREINFO_SYMBOL(log_end); | ||
152 | VMCOREINFO_SYMBOL(log_buf_len); | ||
153 | VMCOREINFO_SYMBOL(logged_chars); | ||
154 | } | ||
155 | #endif | ||
156 | |||
138 | static int __init log_buf_len_setup(char *str) | 157 | static int __init log_buf_len_setup(char *str) |
139 | { | 158 | { |
140 | unsigned size = memparse(str, &str); | 159 | unsigned size = memparse(str, &str); |
@@ -1292,8 +1311,11 @@ EXPORT_SYMBOL(printk_ratelimit); | |||
1292 | bool printk_timed_ratelimit(unsigned long *caller_jiffies, | 1311 | bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
1293 | unsigned int interval_msecs) | 1312 | unsigned int interval_msecs) |
1294 | { | 1313 | { |
1295 | if (*caller_jiffies == 0 || time_after(jiffies, *caller_jiffies)) { | 1314 | if (*caller_jiffies == 0 |
1296 | *caller_jiffies = jiffies + msecs_to_jiffies(interval_msecs); | 1315 | || !time_in_range(jiffies, *caller_jiffies, |
1316 | *caller_jiffies | ||
1317 | + msecs_to_jiffies(interval_msecs))) { | ||
1318 | *caller_jiffies = jiffies; | ||
1297 | return true; | 1319 | return true; |
1298 | } | 1320 | } |
1299 | return false; | 1321 | return false; |