Skip to contentSkip to conversation

console: make blank timeout value a boot option

PATCH In review Daniel Mack 2 participants 6 messages Jun 2, 2009 – Jun 4, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 console: make blank timeout value a boot option

The console blank timer is currently hardcoded to 10*60 seconds which is ok for most applications but might be annoying when using the console for debugging and no userspace application was started to manually change this default behaviour.

This patch defines a core_param for the variable in charge which allows users to entirely disable the blank feature by setting it 0.

---
 Documentation/kernel-parameters.txt |    4 ++++
 drivers/char/vt.c                   |   13 +++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)
Documentation/kernel-parameters.txt +4 -0
index e87bdbf..67331e8 100644
@@ -545,6 +545,10 @@ and is between 256 and 4096 characters. It is defined in the file
 			console=brl,ttyS0
 		For now, only VisioBraille is supported.
 
+	consoleblank=	[KNL] The console blank (screen saver) timeout in
+			seconds. Defaults to 10*60 = 10mins. A value of 0
+			disables the blank timer.
+
 	coredump_filter=
 			[KNL] Change the default value for
 			/proc/<pid>/coredump_filter.
drivers/char/vt.c +7 -6
index 08151d4..85efe81 100644
@@ -172,8 +172,9 @@ int do_poke_blanked_console;
 int console_blanked;
 
 static int vesa_blank_mode; /* 0:none 1:suspendV 2:suspendH 3:powerdown */
-static int blankinterval = 10*60*HZ;
 static int vesa_off_interval;
+static int blankinterval = 10*60;
+core_param(consoleblank, blankinterval, int, 0444);
 
 static DECLARE_WORK(console_work, console_callback);
 
@@ -1486,7 +1487,7 @@ static void setterm_command(struct vc_data *vc)
 			update_attr(vc);
 			break;
 		case 9:	/* set blanking interval */
-			blankinterval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60 * HZ;
+			blankinterval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60;
 			poke_blanked_console();
 			break;
 		case 10: /* set bell frequency in Hz */
@@ -2872,7 +2873,7 @@ static int __init con_init(void)
 
 	if (blankinterval) {
 		blank_state = blank_normal_wait;
-		mod_timer(&console_timer, jiffies + blankinterval);
+		mod_timer(&console_timer, jiffies + (blankinterval * HZ));
 	}
 
 	/*
@@ -3681,7 +3682,7 @@ void do_unblank_screen(int leaving_gfx)
 		return; /* but leave console_blanked != 0 */
 
 	if (blankinterval) {
-		mod_timer(&console_timer, jiffies + blankinterval);
+		mod_timer(&console_timer, jiffies + (blankinterval * HZ));
 		blank_state = blank_normal_wait;
 	}
 
@@ -3715,7 +3716,7 @@ void unblank_screen(void)
 static void blank_screen_t(unsigned long dummy)
 {
 	if (unlikely(!keventd_up())) {
-		mod_timer(&console_timer, jiffies + blankinterval);
+		mod_timer(&console_timer, jiffies + (blankinterval * HZ));
 		return;
 	}
 	blank_timer_expired = 1;
@@ -3745,7 +3746,7 @@ void poke_blanked_console(void)
 	if (console_blanked)
 		unblank_screen();
 	else if (blankinterval) {
-		mod_timer(&console_timer, jiffies + blankinterval);
+		mod_timer(&console_timer, jiffies + (blankinterval * HZ));
 		blank_state = blank_normal_wait;
 	}
 }
Signature · 1 line
1.6.3.1
#1 lore raw
Quoted 13 lines · On Tue, 2 Jun 2009 16:46:33 +0200 Daniel Mack <[email protected]> wrote:

The console blank timer is currently hardcoded to 10*60 seconds which is ok for most applications but might be annoying when using the console for debugging and no userspace application was started to manually change this default behaviour.

This patch defines a core_param for the variable in charge which allows users to entirely disable the blank feature by setting it 0.

...

Documentation/kernel-parameters.txt and is between 256 and 4096 characters. It is defined in the file · line 551

Quoted 7 lines
Documentation/kernel-parameters.txt +4 -0
@@ -545,6 +545,10 @@ and is between 256 and 4096 characters. It is defined in the file
 			console=brl,ttyS0
 		For now, only VisioBraille is supported.
 
+	consoleblank=	[KNL] The console blank (screen saver) timeout in
+			seconds. Defaults to 10*60 = 10mins. A value of 0
+			disables the blank timer.
+

It would be better to make this alterable at runtime, rather than at boot time. Perhaps another VT ioctl.

In fact I'm rather surprised that this isn't already the case.

#2 lore raw
Quoted 6 lines · Andrew Morton
Quoted 6 lines
Documentation/kernel-parameters.txt +0 -0
@@ -545,6 +545,10 @@ and is between 256 and 4096 characters. It is defined in the file
 			console=brl,ttyS0
 		For now, only VisioBraille is supported.
 
Quoted 7 lines

Documentation/kernel-parameters.txt and is between 256 and 4096 characters. It is defined in the file · line 551

Quoted 4 lines
Documentation/kernel-parameters.txt +4 -0
+	consoleblank=	[KNL] The console blank (screen saver) timeout in
+			seconds. Defaults to 10*60 = 10mins. A value of 0
+			disables the blank timer.
+

It would be better to make this alterable at runtime, rather than at boot time. Perhaps another VT ioctl.

That's already possible - there is an ioctl for that. It's just not configurable at boot time, and that occured to be very annoying when developing systems that won't fully boot up for >10mins. You have no way to wake up the console then.

Is there any concern why that shouldn't be a kernel option?

Daniel

#3 lore raw
Quoted 15 lines · On Thu, 4 Jun 2009 09:44:09 +0200 Daniel Mack <[email protected]> wrote:
Quoted 6 lines · Andrew Morton
Quoted 6 lines
Documentation/kernel-parameters.txt +0 -0
@@ -545,6 +545,10 @@ and is between 256 and 4096 characters. It is defined in the file
 			console=brl,ttyS0
 		For now, only VisioBraille is supported.
 
Quoted 7 lines

Documentation/kernel-parameters.txt and is between 256 and 4096 characters. It is defined in the file · line 551

Quoted 4 lines
Documentation/kernel-parameters.txt +4 -0
+	consoleblank=	[KNL] The console blank (screen saver) timeout in
+			seconds. Defaults to 10*60 = 10mins. A value of 0
+			disables the blank timer.
+

It would be better to make this alterable at runtime, rather than at boot time. Perhaps another VT ioctl.

Quoted 4 lines

That's already possible - there is an ioctl for that. It's just not configurable at boot time, and that occured to be very annoying when developing systems that won't fully boot up for >10mins. You have no way to wake up the console then.

Oh. Your changelog sucked :)

Quoted 1 line

Is there any concern why that shouldn't be a kernel option?

I suppose it makes sense. You really have systems which take more than ten minutes to start running initscripts? Poor you.

Please resend with a more complete description?

#4 lore raw
Quoted 11 lines · Andrew Morton
Quoted 4 lines

That's already possible - there is an ioctl for that. It's just not configurable at boot time, and that occured to be very annoying when developing systems that won't fully boot up for >10mins. You have no way to wake up the console then.

Oh. Your changelog sucked :)

Quoted 1 line

Is there any concern why that shouldn't be a kernel option?

I suppose it makes sense. You really have systems which take more than ten minutes to start running initscripts? Poor you.

This happens during development only. Assume the system tries to mount an NFS volume for its rootfs and fails due to a broken NIC driver; you might be interessted in some debug output. Assume the kernel crashes at boot time and you happen to miss that and come back to the machine 10 minutes later; you would still like to see the Oops. Or think about situations where you forgot to add a userspace application to disable the screen saver and you still want to see kernel messages and no input device is attached to wake up the console. All possible scenarios where this option would make sense.

I'm not saying it's the most important thing to have, but it's still handy :)

Quoted 1 line

Please resend with a more complete description?

Attached. Better now?

Thanks,
Daniel

Quoted 1 line

From 9a77004367e49d41b58b81fb6a4882d0906a4743 Mon Sep 17 00:00:00 2001

From: Daniel Mack <[email protected]>
Date: Tue, 2 Jun 2009 16:38:44 +0200
Subject: [PATCH] console: make blank timeout value a boot option

The console blank timer is currently hardcoded to 10*60 seconds which might be annoying on systems with no input devices attached to wake up the console again. Especially during development, disabling the screen saver can be handy - for example when debugging the root fs mount mechanism or other scenarios where no userspace program could be started to do that at runtime from userspace.

This patch defines a core_param for the variable in charge which allows users to entirely disable the blank feature at boot time by setting it
0. The value can still be overwritten at runtime using the standard ioctl call - this just allows to conditionally change the default.

---
 Documentation/kernel-parameters.txt |    4 ++++
 drivers/char/vt.c                   |   13 +++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)
Documentation/kernel-parameters.txt +4 -0
index e87bdbf..67331e8 100644
@@ -545,6 +545,10 @@ and is between 256 and 4096 characters. It is defined in the file
 			console=brl,ttyS0
 		For now, only VisioBraille is supported.
 
+	consoleblank=	[KNL] The console blank (screen saver) timeout in
+			seconds. Defaults to 10*60 = 10mins. A value of 0
+			disables the blank timer.
+
 	coredump_filter=
 			[KNL] Change the default value for
 			/proc/<pid>/coredump_filter.
drivers/char/vt.c +7 -6
index 08151d4..85efe81 100644
@@ -172,8 +172,9 @@ int do_poke_blanked_console;
 int console_blanked;
 
 static int vesa_blank_mode; /* 0:none 1:suspendV 2:suspendH 3:powerdown */
-static int blankinterval = 10*60*HZ;
 static int vesa_off_interval;
+static int blankinterval = 10*60;
+core_param(consoleblank, blankinterval, int, 0444);
 
 static DECLARE_WORK(console_work, console_callback);
 
@@ -1486,7 +1487,7 @@ static void setterm_command(struct vc_data *vc)
 			update_attr(vc);
 			break;
 		case 9:	/* set blanking interval */
-			blankinterval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60 * HZ;
+			blankinterval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60;
 			poke_blanked_console();
 			break;
 		case 10: /* set bell frequency in Hz */
@@ -2872,7 +2873,7 @@ static int __init con_init(void)
 
 	if (blankinterval) {
 		blank_state = blank_normal_wait;
-		mod_timer(&console_timer, jiffies + blankinterval);
+		mod_timer(&console_timer, jiffies + (blankinterval * HZ));
 	}
 
 	/*
@@ -3681,7 +3682,7 @@ void do_unblank_screen(int leaving_gfx)
 		return; /* but leave console_blanked != 0 */
 
 	if (blankinterval) {
-		mod_timer(&console_timer, jiffies + blankinterval);
+		mod_timer(&console_timer, jiffies + (blankinterval * HZ));
 		blank_state = blank_normal_wait;
 	}
 
@@ -3715,7 +3716,7 @@ void unblank_screen(void)
 static void blank_screen_t(unsigned long dummy)
 {
 	if (unlikely(!keventd_up())) {
-		mod_timer(&console_timer, jiffies + blankinterval);
+		mod_timer(&console_timer, jiffies + (blankinterval * HZ));
 		return;
 	}
 	blank_timer_expired = 1;
@@ -3745,7 +3746,7 @@ void poke_blanked_console(void)
 	if (console_blanked)
 		unblank_screen();
 	else if (blankinterval) {
-		mod_timer(&console_timer, jiffies + blankinterval);
+		mod_timer(&console_timer, jiffies + (blankinterval * HZ));
 		blank_state = blank_normal_wait;
 	}
 }
Signature · 1 line
1.6.3.1
#5 lore raw
Quoted 13 lines · On Thu, 4 Jun 2009 10:37:27 +0200 Daniel Mack <[email protected]> wrote:
Quoted 11 lines · Andrew Morton
Quoted 4 lines

That's already possible - there is an ioctl for that. It's just not configurable at boot time, and that occured to be very annoying when developing systems that won't fully boot up for >10mins. You have no way to wake up the console then.

Oh. Your changelog sucked :)

Quoted 1 line

Is there any concern why that shouldn't be a kernel option?

I suppose it makes sense. You really have systems which take more than ten minutes to start running initscripts? Poor you.

Quoted 10 lines

This happens during development only. Assume the system tries to mount an NFS volume for its rootfs and fails due to a broken NIC driver; you might be interessted in some debug output. Assume the kernel crashes at boot time and you happen to miss that and come back to the machine 10 minutes later; you would still like to see the Oops. Or think about situations where you forgot to add a userspace application to disable the screen saver and you still want to see kernel messages and no input device is attached to wake up the console. All possible scenarios where this option would make sense.

OK, that would be irritating.

Quoted 5 lines
Quoted 2 lines

Please resend with a more complete description?

Attached. Better now?

yep ;)

Quoted 20 lines
Quoted 2 lines

From 9a77004367e49d41b58b81fb6a4882d0906a4743 Mon Sep 17 00:00:00 2001

From: Daniel Mack <[email protected]>
Date: Tue, 2 Jun 2009 16:38:44 +0200
Subject: [PATCH] console: make blank timeout value a boot option

The console blank timer is currently hardcoded to 10*60 seconds which might be annoying on systems with no input devices attached to wake up the console again. Especially during development, disabling the screen saver can be handy - for example when debugging the root fs mount mechanism or other scenarios where no userspace program could be started to do that at runtime from userspace.

This patch defines a core_param for the variable in charge which allows users to entirely disable the blank feature at boot time by setting it
0. The value can still be overwritten at runtime using the standard ioctl call - this just allows to conditionally change the default.

...

drivers/char/vt.c int do_poke_blanked_console;

Quoted 7 lines
drivers/char/vt.c +3 -1
+static int blankinterval = 10*60;
+core_param(consoleblank, blankinterval, int, 0444);
 
...
 
-		mod_timer(&console_timer, jiffies + blankinterval);
+		mod_timer(&console_timer, jiffies + (blankinterval * HZ));

although one would prefer that the *HZ be done a single time at a single callsite. But that's hard when core_param() is used.