Commit f468908b authored by Ivan Delalande's avatar Ivan Delalande Committed by Linus Torvalds
Browse files

printk: add clear_idx symbol to vmcoreinfo

This allows us to extract from the vmcore only the messages emitted
since the last time the ring buffer was cleared.  We just have to make
sure its value is always up-to-date, when old messages are discarded to
free space in log_make_free_space() for example.
Signed-off-by: default avatarZeyu Zhao <>
Signed-off-by: default avatarIvan Delalande <>
Cc: Kay Sievers <>
Cc: Neil Horman <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent adaf6590
......@@ -367,16 +367,20 @@ static int logbuf_has_space(u32 msg_size, bool empty)
static int log_make_free_space(u32 msg_size)
while (log_first_seq < log_next_seq) {
if (logbuf_has_space(msg_size, false))
return 0;
while (log_first_seq < log_next_seq &&
!logbuf_has_space(msg_size, false)) {
/* drop old messages until we have enough contiguous space */
log_first_idx = log_next(log_first_idx);
if (clear_seq < log_first_seq) {
clear_seq = log_first_seq;
clear_idx = log_first_idx;
/* sequence numbers are equal, so the log buffer is empty */
if (logbuf_has_space(msg_size, true))
if (logbuf_has_space(msg_size, log_first_seq == log_next_seq))
return 0;
return -ENOMEM;
......@@ -854,6 +858,7 @@ void log_buf_kexec_setup(void)
* Export struct printk_log size and field offsets. User space tools can
......@@ -1216,12 +1221,6 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
u32 idx;
enum log_flags prev;
if (clear_seq < log_first_seq) {
/* messages are gone, move to first available one */
clear_seq = log_first_seq;
clear_idx = log_first_idx;
* Find first record that fits, including all following records,
* into the user-provided buffer for this dump.
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