Skip to contentSkip to conversation

printk-report-dropping-of-messages-from-logbuf.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jun 5, 2014 Printk

lore
Share & tools
lore
#0 lore raw

Subject: [merged] printk-report-dropping-of-messages-from-logbuf.patch removed from -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Thu, 05 Jun 2014 13:05:01 -0700

The patch titled
Subject: printk: report dropping of messages from logbuf
has been removed from the -mm tree. Its filename was
printk-report-dropping-of-messages-from-logbuf.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Will Deacon <[email protected]>
Subject: printk: report dropping of messages from logbuf

If the log ring buffer becomes full, we silently overwrite old messages with new data. console_unlock will detect this case and fast-forward the console_* pointers to skip over the corrupted data, but nothing will be reported to the user.

This patch hijacks the first valid log message after detecting that we dropped messages and prefixes it with a note detailing how many messages were dropped. For long (~1000 char) messages, this will result in some truncation of the real message, but given that we're dropping things anyway, that doesn't seem to be the end of the world.

---

 kernel/printk/printk.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
kernel/printk/printk.c renamed from kernel/printk/printk.c~printk-report-dropping-of-messages-from-logbuf +7 -2
diff -puN kernel/printk/printk.c~printk-report-dropping-of-messages-from-logbuf kernel/printk/printk.c
@@ -2157,10 +2157,15 @@ again:
 		}
 
 		if (console_seq < log_first_seq) {
+			len = sprintf(text, "** %u printk messages dropped ** ",
+				      (unsigned)(log_first_seq - console_seq));
+
 			/* messages are gone, move to first one */
 			console_seq = log_first_seq;
 			console_idx = log_first_idx;
 			console_prev = 0;
+		} else {
+			len = 0;
 		}
 skip:
 		if (console_seq == log_next_seq)
@@ -2185,8 +2190,8 @@ skip:
 		}
 
 		level = msg->level;
-		len = msg_print_text(msg, console_prev, false,
-				     text, sizeof(text));
+		len += msg_print_text(msg, console_prev, false,
+				      text + len, sizeof(text) - len);
 		console_idx = log_next(console_idx);
 		console_seq++;
 		console_prev = msg->flags;

_

Patches currently in -mm which might be from [email protected] are

origin.patch documentation-devicetree-bindings-add-documentation-for-the-apm-x-gene-soc-rtc-dts-binding.patch drivers-rtc-add-apm-x-gene-soc-rtc-driver.patch arm64-add-apm-x-gene-soc-rtc-dts-entry.patch
linux-next.patch