public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tim Bird <tim.bird@am.sony.com>
To: Tony Luck <tony.luck@intel.com>
Cc: linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] add timing information to printk messages
Date: Wed, 09 Mar 2005 15:50:52 -0800	[thread overview]
Message-ID: <422F8BDC.9000005@am.sony.com> (raw)
In-Reply-To: <200503092136.j29La5E26081@unix-os.sc.intel.com>

Tony Luck wrote:
> Setting CONFIG_PRINTK_TIME=y I see (the "<NUL>" pieces are actually
> each a single ASCII '\0' character):

Tony,

Can you try the patch below? (inspired by a patch from Tom Zanussi -
gotta give credit where credit is due... :-)

This solves the problem for me but I'd like independent confirmation.

BTW, this also fixes a problem with the return value for printk,
which is supposed to be the actual amount printed.  This was incorrect
in the printk-times=y case, but also in the '=n' case where a log-level
tag is inserted by printk automatically.  This looks like a longstanding
bug.  (Although I doubt a very important one, since no one appears
to ever look at the printk return value.)

Thanks,
 -- Tim

Fix for null character processing with printk-times option on:
---------------------------------
diff -pruN printk-1/kernel/printk.c printk-fix1/kernel/printk.c
--- printk-1/kernel/printk.c	2005-03-09 15:42:04.550944124 -0800
+++ printk-fix1/kernel/printk.c	2005-03-09 15:36:18.928567360 -0800
@@ -579,6 +579,7 @@ asmlinkage int vprintk(const char *fmt,
 				   p[1] <= '7' && p[2] == '>') {
 					loglev_char = p[1];
 					p += 3;
+					printed_len += 3;
 				} else {
 					loglev_char = default_message_loglevel
 						+ '0';
@@ -593,6 +594,7 @@ asmlinkage int vprintk(const char *fmt,

 				for (tp = tbuf; tp < tbuf + tlen; tp++)
 					emit_log_char (*tp);
+				printed_len += tlen - 3;
 			} else {
 				if (p[0] != '<' || p[1] < '0' ||
 				   p[1] > '7' || p[2] != '>') {
@@ -601,8 +603,11 @@ asmlinkage int vprintk(const char *fmt,
 						+ '0');
 					emit_log_char('>');
 				}
+				printed_len += 3;
 			}
 			log_level_unknown = 0;
+			if (!*p)
+				break;
 		}
 		emit_log_char(*p);
 		if (*p == '\n')

  parent reply	other threads:[~2005-03-09 23:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-09 21:36 [PATCH] add timing information to printk messages Tony Luck
2005-03-09 23:08 ` Tim Bird
2005-03-09 23:50 ` Tim Bird [this message]
2005-03-10  9:17   ` Valdis.Kletnieks
  -- strict thread matches above, loose matches on Subject: below --
2005-02-14 23:33 Tim Bird

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=422F8BDC.9000005@am.sony.com \
    --to=tim.bird@am.sony.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    /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