* [PATCH] printk: Warn about dropped messages also on extended consoles
@ 2015-07-30 11:28 Petr Mladek
2015-07-30 12:10 ` Joe Perches
2015-07-30 13:39 ` Tejun Heo
0 siblings, 2 replies; 4+ messages in thread
From: Petr Mladek @ 2015-07-30 11:28 UTC (permalink / raw)
To: akpm, Tejun Heo; +Cc: davem, linux-kernel, netdev, Petr Mladek
The commit #6fe29354befe4c ("printk: implement support for extended console
drivers") added an extra buffer to format messages for extended consoles.
We need to put there also the warning about dropped messages, so it appears
on these consoles.
Signed-off-by: Petr Mladek <pmladek@suse.com>
---
kernel/printk/printk.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index cf8c24203368..77d3d3698283 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2254,8 +2254,15 @@ again:
}
if (console_seq < log_first_seq) {
- len = sprintf(text, "** %u printk messages dropped ** ",
- (unsigned)(log_first_seq - console_seq));
+ static const char dropped_msg[] =
+ "** %u printk messages dropped ** ";
+ unsigned int dropped_count =
+ (unsigned int)(log_first_seq - console_seq);
+
+ len = sprintf(text, dropped_msg, dropped_count);
+ if (nr_ext_console_drivers)
+ ext_len = sprintf(ext_text, dropped_msg,
+ dropped_count);
/* messages are gone, move to first one */
console_seq = log_first_seq;
@@ -2290,8 +2297,8 @@ skip:
len += msg_print_text(msg, console_prev, false,
text + len, sizeof(text) - len);
if (nr_ext_console_drivers) {
- ext_len = msg_print_ext_header(ext_text,
- sizeof(ext_text),
+ ext_len += msg_print_ext_header(ext_text + ext_len,
+ sizeof(ext_text) - ext_len,
msg, console_seq, console_prev);
ext_len += msg_print_ext_body(ext_text + ext_len,
sizeof(ext_text) - ext_len,
--
1.8.5.6
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] printk: Warn about dropped messages also on extended consoles
2015-07-30 11:28 [PATCH] printk: Warn about dropped messages also on extended consoles Petr Mladek
@ 2015-07-30 12:10 ` Joe Perches
2015-07-30 13:39 ` Tejun Heo
1 sibling, 0 replies; 4+ messages in thread
From: Joe Perches @ 2015-07-30 12:10 UTC (permalink / raw)
To: Petr Mladek; +Cc: akpm, Tejun Heo, davem, linux-kernel, netdev
On Thu, 2015-07-30 at 13:28 +0200, Petr Mladek wrote:
> The commit #6fe29354befe4c ("printk: implement support for extended console
> drivers") added an extra buffer to format messages for extended consoles.
> We need to put there also the warning about dropped messages, so it appears
> on these consoles.
[]
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
[]
> @@ -2254,8 +2254,15 @@ again:
> }
>
> if (console_seq < log_first_seq) {
> - len = sprintf(text, "** %u printk messages dropped ** ",
> - (unsigned)(log_first_seq - console_seq));
> + static const char dropped_msg[] =
> + "** %u printk messages dropped ** ";
I don't see any value in dropped_msg as a
const char array instead of just using it directly
as a format in sprintf. The linker will still use
a single format string in any case.
memcpy might be faster.
if (nr_ext_console_drivers)
memcpy(ext_text, text, len + 1);
> + unsigned int dropped_count =
> + (unsigned int)(log_first_seq - console_seq);
> +
> + len = sprintf(text, dropped_msg, dropped_count);
> + if (nr_ext_console_drivers)
> + ext_len = sprintf(ext_text, dropped_msg,
> + dropped_count);
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] printk: Warn about dropped messages also on extended consoles
2015-07-30 11:28 [PATCH] printk: Warn about dropped messages also on extended consoles Petr Mladek
2015-07-30 12:10 ` Joe Perches
@ 2015-07-30 13:39 ` Tejun Heo
2015-07-30 15:02 ` Petr Mladek
1 sibling, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2015-07-30 13:39 UTC (permalink / raw)
To: Petr Mladek; +Cc: akpm, davem, linux-kernel, netdev
Hello,
On Thu, Jul 30, 2015 at 01:28:52PM +0200, Petr Mladek wrote:
> The commit #6fe29354befe4c ("printk: implement support for extended console
> drivers") added an extra buffer to format messages for extended consoles.
> We need to put there also the warning about dropped messages, so it appears
> on these consoles.
I don't get it. Extended messages are all stamped with sequence
number and the gap in sequence number is a clear sign of missing
messages.
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index cf8c24203368..77d3d3698283 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -2254,8 +2254,15 @@ again:
> }
>
> if (console_seq < log_first_seq) {
> - len = sprintf(text, "** %u printk messages dropped ** ",
> - (unsigned)(log_first_seq - console_seq));
> + static const char dropped_msg[] =
> + "** %u printk messages dropped ** ";
> + unsigned int dropped_count =
> + (unsigned int)(log_first_seq - console_seq);
> +
> + len = sprintf(text, dropped_msg, dropped_count);
> + if (nr_ext_console_drivers)
> + ext_len = sprintf(ext_text, dropped_msg,
> + dropped_count);
And you can't shove random message in front of the header.
Nacked-by: Tejun Heo <tj@kernel.org>
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] printk: Warn about dropped messages also on extended consoles
2015-07-30 13:39 ` Tejun Heo
@ 2015-07-30 15:02 ` Petr Mladek
0 siblings, 0 replies; 4+ messages in thread
From: Petr Mladek @ 2015-07-30 15:02 UTC (permalink / raw)
To: Tejun Heo; +Cc: akpm, davem, linux-kernel, netdev
On Thu 2015-07-30 09:39:01, Tejun Heo wrote:
> Hello,
>
> On Thu, Jul 30, 2015 at 01:28:52PM +0200, Petr Mladek wrote:
> > The commit #6fe29354befe4c ("printk: implement support for extended console
> > drivers") added an extra buffer to format messages for extended consoles.
> > We need to put there also the warning about dropped messages, so it appears
> > on these consoles.
>
> I don't get it. Extended messages are all stamped with sequence
> number and the gap in sequence number is a clear sign of missing
> messages.
Grr, I misconfigured netconsole and did not see the extended
information. You are right, the patch is not needed.
Best Regards,
Petr
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-07-30 15:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-30 11:28 [PATCH] printk: Warn about dropped messages also on extended consoles Petr Mladek
2015-07-30 12:10 ` Joe Perches
2015-07-30 13:39 ` Tejun Heo
2015-07-30 15:02 ` Petr Mladek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).