From: akpm@linux-foundation.org Subject: + printk-report-dropping-of-messages-from-logbuf.patch added to -mm tree Date: Fri, 02 May 2014 14:22:21 -0700 Message-ID: <53640c8d.Z9EILRhjDc7p0jF/%akpm@linux-foundation.org> Reply-To: linux-kernel@vger.kernel.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from mail.linuxfoundation.org ([140.211.169.12]:47968 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752719AbaEBVWW (ORCPT ); Fri, 2 May 2014 17:22:22 -0400 Sender: mm-commits-owner@vger.kernel.org List-Id: mm-commits@vger.kernel.org To: mm-commits@vger.kernel.org, peterz@infradead.org, kay@vrfy.org, jack@suse.cz, will.deacon@arm.com Subject: + printk-report-dropping-of-messages-from-logbuf.patch added to -mm tree To: will.deacon@arm.com,jack@suse.cz,kay@vrfy.org,peterz@infradead.org From: akpm@linux-foundation.org Date: Fri, 02 May 2014 14:22:21 -0700 The patch titled Subject: printk: report dropping of messages from logbuf has been added to the -mm tree. Its filename is printk-report-dropping-of-messages-from-logbuf.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/printk-report-dropping-of-messages-from-logbuf.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/printk-report-dropping-of-messages-from-logbuf.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Will Deacon 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. Signed-off-by: Will Deacon Acked-by: Peter Zijlstra Cc: Kay Sievers Cc: Jan Kara Signed-off-by: Andrew Morton --- kernel/printk/printk.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff -puN kernel/printk/printk.c~printk-report-dropping-of-messages-from-logbuf kernel/printk/printk.c --- a/kernel/printk/printk.c~printk-report-dropping-of-messages-from-logbuf +++ a/kernel/printk/printk.c @@ -2160,10 +2160,15 @@ again_noirq: } 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) @@ -2188,8 +2193,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 will.deacon@arm.com are origin.patch printk-print-initial-logbuf-contents-before-re-enabling-interrupts.patch printk-report-dropping-of-messages-from-logbuf.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