Skip to contentSkip to conversation

add "notime" boot option

PATCH In review Randy Dunlap 6 participants 18 messages May 22, 2007 – May 30, 2007 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add "notime" boot option

From: Randy Dunlap <[email protected]>

Add "notime" boot option to prevent timing data from being printed on each printk message line.

We've seen a few cases of 'time' data locking problems (possibly involving netconsole or net drivers). If a kernel is built with CONFIG_PRINTK_TIME=y, it may have a boot locking hang. Booting with "notime" may (i.e., could) prevent the lock hang and allow the kernel to boot successfully, without requiring a kernel rebuild.

---
 Documentation/kernel-parameters.txt |    2 ++
 kernel/printk.c                     |   10 +++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
Documentation/kernel-parameters.txt +2 -0
@@ -1227,6 +1227,8 @@ and is between 256 and 4096 characters. 
 
 	nosync		[HW,M68K] Disables sync negotiation for all devices.
 
+	notime		Do not print timing data on each printk message line.
+
 	notsc		[BUGS=IA-32] Disable Time Stamp Counter
 
 	nousb		[USB] Disable the USB subsystem
kernel/printk.c +9 -1
@@ -458,9 +458,17 @@ static int __init printk_time_setup(char
 	printk_time = 1;
 	return 1;
 }
-
 __setup("time", printk_time_setup);
 
+static int __init printk_notime_setup(char *str)
+{
+	if (*str)
+		return 0;
+	printk_time = 0;
+	return 1;
+}
+__setup("notime", printk_notime_setup);
+
 __attribute__((weak)) unsigned long long printk_clock(void)
 {
 	return sched_clock();
#1 lore raw
Quoted 11 lines · Randy Dunlap
kernel/printk.c +2 -1
@@ -458,9 +458,17 @@ static int __init printk_time_setup(char
 	printk_time = 1;
 	return 1;
 }
-
 __setup("time", printk_time_setup);
 
+static int __init printk_notime_setup(char *str)
+{

kernel/printk.c static int __init printk_time_setup(char · line 474

Quoted 10 lines
kernel/printk.c +7 -0
+	if (*str)
+		return 0;
+	printk_time = 0;
+	return 1;
+}
+__setup("notime", printk_notime_setup);
+
 __attribute__((weak)) unsigned long long printk_clock(void)
 {
 	return sched_clock();

Not disagreeing with the patch, but I wonder if it'd be a net win if we had a helper that would replace the zillion instances of "set this variable to a 0/1 depending if its prefixed with 'no'" with 1-2 lines.

Dave

Signature · 1 line
http://www.codemonkey.org.uk
#2 lore raw
Quoted 4 lines · On Tue, 22 May 2007 15:40:30 -0400 Dave Jones wrote:

Not disagreeing with the patch, but I wonder if it'd be a net win if we had a helper that would replace the zillion instances of "set this variable to a 0/1 depending if its prefixed with 'no'" with 1-2 lines.

I don't know about that, but I had another version of this patch that removed the use of __setup() and just used the module_param() that is already there (but with the param renamed to "time" and changed to a bool), so that the usage on the command line is:
linux printk.time=<bool>

I like this alternate version pretty well, but it causes more change and a usage that is not well-known. Patch is below. The __setup() declaration and its function helper are not removed yet, but they could be, and just leave the value-setting job to the module_param() code. All tested.

---

From: Randy Dunlap <[email protected]>

Allow printk_time to be enabled or disabled at boot time. Previously it could be enabled only, but not disabled.

Change printk_time from an int to a bool since that's what it is. Make its logical (exposed) name just be "time".

Note: Changes kernel boot option syntax from "time" to "time=value".

Since printk_time is declared as a module_param, it can also be changed at run-time by modifying
/sys/module/printk/parameters/time
to a value of 1/Y/y to enabled it or 0/N/n to disable it.

Since printk_time is declared as a module_param, its value can also be set at boot-time by using
linux printk.time=<bool>

If we are willing to drop the shorter "time=value" syntax, we could also drop the entire printk_time_setup() function and the __setup() for it.

---
 Documentation/kernel-parameters.txt |    5 ++++-
 kernel/printk.c                     |   12 +++++++-----
 2 files changed, 11 insertions(+), 6 deletions(-)
Documentation/kernel-parameters.txt +4 -1
@@ -1824,7 +1824,10 @@ and is between 256 and 4096 characters. 
 	thash_entries=	[KNL,NET]
 			Set number of hash buckets for TCP connection
 
-	time		Show timing data prefixed to each printk message line
+	time=		Show timing data prefixed to each printk message line
+			Format: <bool>  (1=enable, 0=disable)
+or	printk.time=	Show timing data prefixed to each printk message line
+			Format: <bool>  (1/Y/y=enable, 0/N/n=disable)
 
 	tipar.timeout=	[HW,PPT]
 			Set communications timeout in tenths of a second
kernel/printk.c +7 -5
@@ -449,17 +449,19 @@ static int printk_time = 1;
 #else
 static int printk_time = 0;
 #endif
-module_param(printk_time, int, S_IRUGO | S_IWUSR);
+module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
 
 static int __init printk_time_setup(char *str)
 {
-	if (*str)
+	if (!*str)
 		return 0;
-	printk_time = 1;
+	if (*str == '1')
+		printk_time = 1;
+	else if (*str == '0')
+		printk_time = 0;
 	return 1;
 }
-
-__setup("time", printk_time_setup);
+__setup("time=", printk_time_setup);
 
 __attribute__((weak)) unsigned long long printk_clock(void)
 {
#3 lore raw
In reply to Randy Dunlap
Quoted 3 lines · Randy Dunlap

Add "notime" boot option to prevent timing data from being printed on each printk message line.

That's a good source of confusion. To me, "notime" means something like "don't bother calculating time", instead of the proposed behavior. Can't it be something like 'nologts' (no log timestamps) or nots or notimestamps or nologtime instead?

/mjt

#4 lore raw
Quoted 9 lines · On Wed, 23 May 2007 15:03:01 +0400 Michael Tokarev wrote:
Quoted 3 lines · Randy Dunlap

Add "notime" boot option to prevent timing data from being printed on each printk message line.

That's a good source of confusion. To me, "notime" means something like "don't bother calculating time", instead of the proposed behavior. Can't it be something like 'nologts' (no log timestamps) or nots or notimestamps or nologtime instead?

"nologtime" is OK with me. or does it confuse people in a different way? Anyone else?

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

#5 lore raw
Quoted 7 lines · Randy Dunlap
Quoted 4 lines

That's a good source of confusion. To me, "notime" means something like "don't bother calculating time", instead of the proposed behavior. Can't it be something like 'nologts' (no log timestamps) or nots or notimestamps or nologtime instead?

"nologtime" is OK with me. or does it confuse people in a different way? Anyone else?

The CONFIG option is called CONFIG_PRINTK_TIME. How about "noprintktime"? At least nicely to the point...

Rene.

#6 lore raw
Quoted 7 lines · On Wed, 23 May 2007 21:15:20 +0200 Rene Herman wrote:
Quoted 5 lines · Randy Dunlap
Quoted 4 lines

That's a good source of confusion. To me, "notime" means something like "don't bother calculating time", instead of the proposed behavior. Can't it be something like 'nologts' (no log timestamps) or nots or notimestamps or nologtime instead?

Quoted 5 lines
Quoted 2 lines

"nologtime" is OK with me. or does it confuse people in a different way? Anyone else?

The CONFIG option is called CONFIG_PRINTK_TIME. How about "noprintktime"? At least nicely to the point...

Actually I'm concerned about total kernel command line length, so using option names that are "long" when short will do is not good IMO.

I.e., I can easily overflow a 255-byte command line length buffer, so Shorter is Better.

However, "when short will do" does not mean making them unreadable or like they mean something else, like "nopkt".

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

#7 lore raw
Quoted 8 lines · Randy Dunlap
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

That's a good source of confusion. To me, "notime" means something
like "don't bother calculating time", instead of the proposed
behavior. Can't it be something like 'nologts' (no log timestamps)
or nots or notimestamps or nologtime instead

"nologtime" is OK with me. or does it confuse people in a different way? Anyone else?

Quoted 7 lines
Quoted 1 line

The CONFIG option is called CONFIG_PRINTK_TIME. How about "noprintktime"? At least nicely to the point...

Actually I'm concerned about total kernel command line length, so using option names that are "long" when short will do is not good IMO.

I.e., I can easily overflow a 255-byte command line length buffer, so Shorter is Better.

Okay. I would by the way not be against turning the timestamping off by default and turning it _on_ with a "timestamps" or "logtime" or whatever option. The information is sometimes handy for seeing the (clustering of) event times so I've been compiling it in for a while on some boxes but in the majority case for me it's noise taking up printk real estate...

Rene.

#8 lore raw
Quoted 12 lines · Rene Herman
Quoted 10 lines · Randy Dunlap
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

That's a good source of confusion. To me, "notime" means something
like "don't bother calculating time", instead of the proposed
behavior. Can't it be something like 'nologts' (no log timestamps)
or nots or notimestamps or nologtime instead

"nologtime" is OK with me. or does it confuse people in a different way? Anyone else?

The CONFIG option is called CONFIG_PRINTK_TIME. How about "noprintktime"? At least nicely to the point...

Quoted 7 lines
Quoted 5 lines

Actually I'm concerned about total kernel command line length, so using option names that are "long" when short will do is not good IMO.

I.e., I can easily overflow a 255-byte command line length buffer, so Shorter is Better.

Okay. I would by the way not be against turning the timestamping off by default and turning it _on_ with a "timestamps" or "logtime" or whatever option. The information is sometimes handy for seeing the (clustering of) event times so I've been compiling it in for a while on some boxes but in the majority case for me it's noise taking up printk real estate...

But CONFIG_PRINTK_TIME is what controls its "default" (build-time) value. I.e., users can control that.

I would be OK with removing that config option and only being able to enable it, but I doubt that this would have much support. ;)

Signature · 2 lines
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
#9 lore raw
Quoted 9 lines · Randy Dunlap
Quoted 4 lines · Rene Herman

Okay. I would by the way not be against turning the timestamping off by
default and turning it _on_ with a "timestamps" or "logtime" or whatever option. The information is sometimes handy for seeing the (clustering of) event times so I've been compiling it in for a while on some boxes but in the majority case for me it's noise taking up printk
real estate...

But CONFIG_PRINTK_TIME is what controls its "default" (build-time) value.
I.e., users can control that.

Yes, but a (full) kernel recompile is a bit of a hard-hitting switch, certainly on the older machines where I actually have it enabled...

Quoted 2 lines

I would be OK with removing that config option and only being able to enable it, but I doubt that this would have much support. ;)

Fine by me.

Rene.

#10 lore raw
Quoted 2 lines · Rene Herman
Quoted 2 lines
Quoted 2 lines

Okay. I would by the way not be against turning the timestamping off by default and turning it _on_ with a "timestamps" or "logtime" or whatever option.

Yes I only now looked. Sorry, didn't realise that was how it already worked. CONFIG_PRINTK_TIME seems a little silly in that case but _someone_ thought it was worth spending an option on, so hey...

Rene.

#11 lore raw
In reply to Randy Dunlap
Quoted 10 lines · Randy Dunlap

From: Randy Dunlap <[email protected]>

Add "notime" boot option to prevent timing data from being printed on each printk message line.

We've seen a few cases of 'time' data locking problems (possibly involving netconsole or net drivers). If a kernel is built with CONFIG_PRINTK_TIME=y, it may have a boot locking hang. Booting with "notime" may (i.e., could) prevent the lock hang and allow the kernel to boot successfully, without requiring a kernel rebuild.

Wonderful, now we have _three_ options to control time...

	time=<bool>
	printk.time=<bool>
	notime=<bool>


	Jan
#12 lore raw
Quoted 12 lines · Jan Engelhardt
Quoted 10 lines · Randy Dunlap

From: Randy Dunlap <[email protected]>

Add "notime" boot option to prevent timing data from being printed on each printk message line.

We've seen a few cases of 'time' data locking problems (possibly involving netconsole or net drivers). If a kernel is built with CONFIG_PRINTK_TIME=y, it may have a boot locking hang. Booting with "notime" may (i.e., could) prevent the lock hang and allow the kernel to boot successfully, without requiring a kernel rebuild.

Quoted 5 lines

Wonderful, now we have _three_ options to control time...

	time=<bool>
	printk.time=<bool>
	notime=<bool>

Currently the middle one is "printk.printk_time".
And the first and last are just "time" and "notime", without a bool value.

And as I wrote later, I'd be happy to remove #s 1 and 3 and use only the middle one, renaming the param so that it _is_ printk.time.

Signature · 2 lines
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
#13 lore raw
Quoted 7 lines · Randy Dunlap
Quoted 6 lines

Wonderful, now we have _three_ options to control time...

time=<bool>
printk.time=<bool>
notime=<bool>

Quoted 5 lines

Currently the middle one is "printk.printk_time".
And the first and last are just "time" and "notime", without a bool value.

And as I wrote later, I'd be happy to remove #s 1 and 3 and use only the middle one, renaming the param so that it _is_ printk.time.

You get my (+) vote for that.

Jan

#14 lore raw

PATCH 1/1 use printk.time option, drop time/notime

From: Randy Dunlap <[email protected]>

Andrew, please drop add-notime-boot-option.patch
and use this patch instead...

Allow printk_time to be enabled or disabled at boot time. Previously it could be enabled only, but not disabled.

Change printk_time from an int to a bool since that's what it is. Make its logical (exposed) name just be "time" (was "printk_time").

Note: Changes kernel boot option syntax from "time" to "printk.time=value".

Since printk_time is declared as a module_param, it can also be changed at run-time by modifying
/sys/module/printk/parameters/time
to a value of 1/Y/y to enabled it or 0/N/n to disable it.

Since printk_time is declared as a module_param, its value can also be set at boot-time by using
linux printk.time=<bool>

Drop the "time" boot option and its __setup() functions.

---
 Documentation/kernel-parameters.txt |    5 +++--
 kernel/printk.c                     |   12 +-----------
 2 files changed, 4 insertions(+), 13 deletions(-)
Documentation/kernel-parameters.txt +3 -2
@@ -1406,6 +1406,9 @@ and is between 256 and 4096 characters. 
 			autoconfiguration.
 			Ranges are in pairs (memory base and size).
 
+	printk.time=	Show timing data prefixed to each printk message line
+			Format: <bool>  (1/Y/y=enable, 0/N/n=disable)
+
 	profile=	[KNL] Enable kernel profiling via /proc/profile
 			Format: [schedule,]<number>
 			Param: "schedule" - profile schedule points.
@@ -1805,8 +1808,6 @@ and is between 256 and 4096 characters. 
 	thash_entries=	[KNL,NET]
 			Set number of hash buckets for TCP connection
 
-	time		Show timing data prefixed to each printk message line
-
 	clocksource=	[GENERIC_TIME] Override the default clocksource
 			Override the default clocksource and use the clocksource
 			with the name specified.
kernel/printk.c +1 -11
@@ -449,17 +449,7 @@ static int printk_time = 1;
 #else
 static int printk_time = 0;
 #endif
-module_param(printk_time, int, S_IRUGO | S_IWUSR);
-
-static int __init printk_time_setup(char *str)
-{
-	if (*str)
-		return 0;
-	printk_time = 1;
-	return 1;
-}
-
-__setup("time", printk_time_setup);
+module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
 
 __attribute__((weak)) unsigned long long printk_clock(void)
 {
#15 lore raw

Re: [PATCH] use printk.time option, drop time/notime

Quoted 7 lines · On Thu, 24 May 2007 17:15:35 -0700 Randy Dunlap <[email protected]> wrote:

Allow printk_time to be enabled or disabled at boot time. Previously it could be enabled only, but not disabled.

Change printk_time from an int to a bool since that's what it is. Make its logical (exposed) name just be "time" (was "printk_time").

Note: Changes kernel boot option syntax from "time" to "printk.time=value".

That's going to break a *lot* of people's setups - timestamping appears to be very popular. We will get sad emails from people.

If we're going to do this then I'm afraid we should retain the `time=' thing for a while and add a this-is-going-away printk to it.

#16 lore raw

Re: [PATCH] use printk.time option, drop time/notime

Quoted 7 lines · Andrew Morton
Quoted 7 lines

Allow printk_time to be enabled or disabled at boot time. Previously it could be enabled only, but not disabled.

Change printk_time from an int to a bool since that's what it is. Make its logical (exposed) name just be "time" (was "printk_time").

Quoted 8 lines
Quoted 1 line

Note: Changes kernel boot option syntax from "time" to "printk.time=value".

That's going to break a *lot* of people's setups - timestamping appears to be very popular. We will get sad emails from people.

If we're going to do this then I'm afraid we should retain the `time=' thing for a while and add a this-is-going-away printk to it.

Reminds me of http://lkml.org/lkml/2007/5/1/163 (minus the ANSI sequences, though that WOULD have gotten their attention)...

Jan

#17 lore raw

PATCH v3 1/1 add printk.time option, deprecate 'time'

In reply to Andrew Morton
Quoted 5 lines · On Tue, 29 May 2007 13:07:05 -0700 Andrew Morton wrote:

That's going to break a *lot* of people's setups - timestamping appears to be very popular. We will get sad emails from people.

If we're going to do this then I'm afraid we should retain the `time=' thing for a while and add a this-is-going-away printk to it.

[$ checkpatch-v2.pl ~/patch/printk-time-onoff.patch
Your patch has no obvious style problems and is ready for submission.]

From: Randy Dunlap <[email protected]>

Allow printk_time to be enabled or disabled at boot time. Previously it could be enabled only, but not disabled.

Change printk_time from an int to a bool since that's what it is. Make its logical (exposed) name just be "time" (was "printk_time").

Note: Changes kernel boot option syntax from "time" to "printk.time=value".

Since printk_time is declared as a module_param, it can also be changed at run-time by modifying
/sys/module/printk/parameters/time
to a value of 1/Y/y to enabled it or 0/N/n to disable it.

Since printk_time is declared as a module_param, its value can also be set at boot-time by using
linux printk.time=<bool>

If the "time" boot option is used, print a message that it is deprecated and will be removed.
Note its planned removal in feature-removal-schedule.txt.

---
 Documentation/feature-removal-schedule.txt |    7 +++++++
 Documentation/kernel-parameters.txt        |    4 ++++
 kernel/printk.c                            |    5 ++++-
 3 files changed, 15 insertions(+), 1 deletion(-)
Documentation/kernel-parameters.txt +4 -0
@@ -1426,6 +1426,9 @@ and is between 256 and 4096 characters. 
 			autoconfiguration.
 			Ranges are in pairs (memory base and size).
 
+	printk.time=	Show timing data prefixed to each printk message line
+			Format: <bool>  (1/Y/y=enable, 0/N/n=disable)
+
 	profile=	[KNL] Enable kernel profiling via /proc/profile
 			Format: [schedule,]<number>
 			Param: "schedule" - profile schedule points.
@@ -1826,6 +1829,7 @@ and is between 256 and 4096 characters. 
 			Set number of hash buckets for TCP connection
 
 	time		Show timing data prefixed to each printk message line
+			[deprecated, see 'printk.time']
 
 	tipar.timeout=	[HW,PPT]
 			Set communications timeout in tenths of a second
kernel/printk.c +4 -1
@@ -449,13 +449,16 @@ static int printk_time = 1;
 #else
 static int printk_time = 0;
 #endif
-module_param(printk_time, int, S_IRUGO | S_IWUSR);
+module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
 
 static int __init printk_time_setup(char *str)
 {
 	if (*str)
 		return 0;
 	printk_time = 1;
+	printk(KERN_NOTICE "The 'time' option is deprecated and "
+		"is scheduled for removal in early 2008\n");
+	printk(KERN_NOTICE "Use 'printk.time=<value>' instead\n");
 	return 1;
 }
 
Documentation/feature-removal-schedule.txt +7 -0
@@ -346,3 +346,10 @@ Who:  Tejun Heo <[email protected]>
 
 ---------------------------
 
+What:	'time' kernel boot parameter
+When:	January 2008
+Why:	replaced by 'printk.time=<value>' so that printk timestamps can be
+	enabled or disabled as needed
+Who:	Randy Dunlap <[email protected]>
+
+---------------------------