mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ravikiran G Thirumalai <kiran@scalex86.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] printk: Print cpuid along with the timestamp with CONFIG_PRINTK_TIME
Date: Thu, 18 Sep 2008 17:35:09 -0700	[thread overview]
Message-ID: <20080919003509.GB21915@localdomain> (raw)
In-Reply-To: <20080918125123.1a76978f.akpm@linux-foundation.org>

On Thu, Sep 18, 2008 at 12:51:23PM -0700, Andrew Morton wrote:
>On Thu, 18 Sep 2008 12:37:20 -0700
>Ravikiran G Thirumalai <kiran@scalex86.org> wrote:
>> 
>> Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>
>> 
>> Index: linux-git/kernel/printk.c
>> ===================================================================
>> --- linux-git.orig/kernel/printk.c	2008-09-16 15:37:48.000000000 -0700
>> +++ linux-git/kernel/printk.c	2008-09-18 12:27:10.489662938 -0700
>> @@ -739,9 +739,10 @@ asmlinkage int vprintk(const char *fmt, 
>>  
>>  				t = cpu_clock(printk_cpu);
>>  				nanosec_rem = do_div(t, 1000000000);
>> -				tlen = sprintf(tbuf, "[%5lu.%06lu] ",
>> +				tlen = sprintf(tbuf, "[%5lu.%06lu:%d] ",
>>  						(unsigned long) t,
>> -						nanosec_rem / 1000);
>> +						nanosec_rem / 1000,
>> +						printk_cpu);
>>  
>>  				for (tp = tbuf; tp < tbuf + tlen; tp++)
>>  					emit_log_char(*tp);
>
>
>Your patch illogically ties the cpu-id-printing feature to the
>printk.time feature.  I guess that's liveable with, but
>Documentation/kernel-parameters.txt should be updated.
>

Didn't realize Documentation/kernel-parameters.txt had reference and even a
runtime parameter to control this!  I always enabled CONFIG_PRINTK_TIME
to get timestamps. Here's an updated patch.

As for the cpuid with the timestamp, the timestamp that is being
is  the printed the cpu's time stamp.

---

Add cpuid information to printk if CONFIG_PRINTK_TIME is enabled.
This information is useful to debug hangs and boot issues.

Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>

Index: linux-git/kernel/printk.c
===================================================================
--- linux-git.orig/kernel/printk.c	2008-09-16 15:37:48.000000000 -0700
+++ linux-git/kernel/printk.c	2008-09-18 12:27:10.489662938 -0700
@@ -739,9 +739,10 @@ asmlinkage int vprintk(const char *fmt, 
 
 				t = cpu_clock(printk_cpu);
 				nanosec_rem = do_div(t, 1000000000);
-				tlen = sprintf(tbuf, "[%5lu.%06lu] ",
+				tlen = sprintf(tbuf, "[%5lu.%06lu:%d] ",
 						(unsigned long) t,
-						nanosec_rem / 1000);
+						nanosec_rem / 1000,
+						printk_cpu);
 
 				for (tp = tbuf; tp < tbuf + tlen; tp++)
 					emit_log_char(*tp);
Index: linux-git/Documentation/kernel-parameters.txt
===================================================================
--- linux-git.orig/Documentation/kernel-parameters.txt	2008-09-16 11:30:13.000000000 -0700
+++ linux-git/Documentation/kernel-parameters.txt	2008-09-18 17:11:35.167079714 -0700
@@ -1687,7 +1687,10 @@ and is between 256 and 4096 characters. 
 			default: off.
 
 	printk.time=	Show timing data prefixed to each printk message line
-			Format: <bool>  (1/Y/y=enable, 0/N/n=disable)
+			Format: <bool>  (1/Y/y=enable, 0/N/n=disable).
+			Per-cpu timestamps are prefixed as
+			"[sssss.uuuuuu:cpuid]" on each and every line printed,
+			if this option is enabled.
 
 	profile=	[KNL] Enable kernel profiling via /proc/profile
 			Format: [schedule,]<number>

  reply	other threads:[~2008-09-19  0:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-18 19:37 Ravikiran G Thirumalai
2008-09-18 19:51 ` Andrew Morton
2008-09-19  0:35   ` Ravikiran G Thirumalai [this message]
2008-09-19 17:15     ` Marcin Slusarz
2008-09-19 18:39       ` Ravikiran G Thirumalai

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=20080919003509.GB21915@localdomain \
    --to=kiran@scalex86.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®