netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Petr Mladek <pmladek@suse.com>
Cc: akpm@linux-foundation.org, Tejun Heo <tj@kernel.org>,
	davem@davemloft.net, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH] printk: Warn about dropped messages also on extended consoles
Date: Thu, 30 Jul 2015 05:10:46 -0700	[thread overview]
Message-ID: <1438258246.2677.17.camel@perches.com> (raw)
In-Reply-To: <1438255732-31326-1-git-send-email-pmladek@suse.com>

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);
>  

  reply	other threads:[~2015-07-30 12:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-30 11:28 [PATCH] printk: Warn about dropped messages also on extended consoles Petr Mladek
2015-07-30 12:10 ` Joe Perches [this message]
2015-07-30 13:39 ` Tejun Heo
2015-07-30 15:02   ` Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438258246.2677.17.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).