public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: printk regression?
Date: Wed, 01 Jul 2009 21:14:08 -0700	[thread overview]
Message-ID: <4A4C3410.8080704@kernel.org> (raw)

[   75.690022] <7>printing local APIC contents on CPU#0/0:
[   75.704406] ... APIC ID:      00000000 (0)
[   75.707905] ... APIC VERSION: 00060015
[   75.722551] ... APIC TASKPRI: 00000000 (00)
[   75.725473] ... APIC PROCPRI: 00000000
[   75.728592] ... APIC LDR: 00000001
[   75.742137] ... APIC SPIV: 000001ff
[   75.744101] ... APIC ISR field:
[   75.746648] 0123456789abcdef0123456789abcdef
[   75.746649] <7>00000000000000000000000000000000
[   75.774075] 00000000000000000000000000000000
[   75.784750] 00000000000000000000000000000000
[   75.795441] 00000000000000000000000000000000
[   75.805870] 00000000000000000000000000000000
[   75.817110] 00000000000000000000000000000000
[   75.827522] 00000000000000000000000000000000
[   75.836998] 00000000000000000000000000000000
[   75.848060] ... APIC TMR field:
[   75.849677] 0123456789abcdef0123456789abcdef
[   75.849678] <7>00000000000000000000000000000000
[   75.870185] 00000000000000000000000000000000
[   75.881238] 00000000000000000000000000000000
[   75.891653] 00000000000000000000000000000000
[   75.902632] 00000000000000000000000000000000
[   75.913418] 00000000000000000000000000000000
[   75.923295] 00000000000000000000000000000000
[   75.934364] 00000000000000000000000000000000
[   75.945550] ... APIC IRR field:
[   75.948346] 0123456789abcdef0123456789abcdef
[   75.948347] <7>00000000000000000000000000000000
[   75.968152] 00000000000000000000000000000000
[   75.979004] 00000000000000000000000000000000
[   75.990312] 00000000000000000000000000000000
[   76.001879] 00000000000000000000000000000000
[   76.012855] 00000000000000000000000000000000
[   76.024529] 00000000000000000000000000000000
[   76.034353] 00000000000000010000000000000000

got extra <7>

seems caused by:

commit 5fd29d6ccbc98884569d6f3105aeca70858b3e0f
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Tue Jun 16 10:57:02 2009 -0700

    printk: clean up handling of log-levels and newlines
    
    It used to be that we would only look at the log-level in a printk()
    after explicit newlines, which can cause annoying problems when the
    previous printk() did not end with a '\n'. In that case, the log-level
    marker would be just printed out in the middle of the line, and be
    seen as just noise rather than change the logging level.
    
    This changes things to always look at the log-level in the first
    bytes of the printout. If a log level marker is found, it is always
    used as the log-level. Additionally, if no newline existed, one is
    added (unless the log-level is the explicit KERN_CONT marker, to
    explicitly show that it's a continuation of a previous line).
    
    Acked-by: Arjan van de Ven <arjan@infradead.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

diff --git a/kernel/printk.c b/kernel/printk.c
index 5052b54..a87770c 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -687,20 +687,33 @@ asmlinkage int vprintk(const char *fmt, va_list args)
                                  sizeof(printk_buf) - printed_len, fmt, args);
 
 
+       p = printk_buf;
+
+       /* Do we have a loglevel in the string? */
+       if (p[0] == '<') {
+               unsigned char c = p[1];
+               if (c && p[2] == '>') {
+                       switch (c) {
+                       case '0' ... '7': /* loglevel */
+                               current_log_level = c - '0';
+                               if (!new_text_line) {
+                                       emit_log_char('\n');
+                                       new_text_line = 1;
+                               }
+                       /* Fallthrough - skip the loglevel */
+                       case 'c': /* KERN_CONT */
+                               p += 3;
+                               break;
+                       }
+               }
+       }
+
        /*
         * Copy the output into log_buf.  If the caller didn't provide
         * appropriate log level tags, we insert them here
         */
-       for (p = printk_buf; *p; p++) {
+       for ( ; *p; p++) {
                if (new_text_line) {
-                       /* If a token, set current_log_level and skip over */
-                       if (p[0] == '<' && p[1] >= '0' && p[1] <= '7' &&
-                           p[2] == '>') {
-                               current_log_level = p[1] - '0';
-                               p += 3;
-                               printed_len -= 3;
-                       }
-
                        /* Always output the token */
                        emit_log_char('<');
                        emit_log_char(current_log_level + '0');


             reply	other threads:[~2009-07-02  4:14 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-02  4:14 Yinghai Lu [this message]
2009-07-02  4:23 ` printk regression? Linus Torvalds
2009-07-02  4:28   ` Linus Torvalds
2009-07-02  5:21     ` [PATCH] x86: fix printk calling in print_local_apic Yinghai Lu
2009-07-02  6:12       ` Ingo Molnar
2009-07-02  6:28         ` [PATCH, v2] x86: Fix printk call in print_local_apic() Ingo Molnar
2009-07-02  6:39           ` Yinghai Lu
2009-07-02  6:50             ` [PATCH, v3] " Ingo Molnar
2009-07-02  6:48           ` [PATCH, v2] " Andrew Morton
2009-07-02  6:59             ` [PATCH, v4] " Ingo Molnar
2009-07-02  7:09               ` Ingo Molnar
2009-07-02  7:07       ` [tip:x86/urgent] " tip-bot for Ingo Molnar
2009-07-02  5:42   ` printk regression? Joe Perches
2009-07-02 12:29     ` Michael S. Zick
2009-07-02 15:29       ` Joe Perches
2009-07-02 17:42         ` Linus Torvalds
2009-07-02 17:27     ` Linus Torvalds
2009-07-02 17:38       ` Joe Perches
2009-07-02 17:43         ` Linus Torvalds
2009-07-06 20:05           ` [PATCH] Remove multiple KERN_ prefixes from printk formats Joe Perches
2009-07-06 20:23             ` Mike Frysinger
2009-07-06 20:29               ` Joe Perches
2009-07-06 20:33               ` Linus Torvalds
2009-07-06 20:36                 ` Mike Frysinger
2009-07-08 21:55                   ` [PATCH] arch/blackfin/kernel/traps.c: Add visually separating newlines to printks Joe Perches
2009-07-06 20:38                 ` [PATCH] Remove multiple KERN_ prefixes from printk formats Joe Perches
2009-07-08 17:11                 ` Joe Perches

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=4A4C3410.8080704@kernel.org \
    --to=yinghai@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.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