diff options
author | Andres Salomon <dilinger@debian.org> | 2007-10-18 06:04:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-18 17:37:19 -0400 |
commit | 8f4ce8c32f2dc2bc2411cafe39976fc5c0adfabf (patch) | |
tree | 04f9009812e13f97b3eaae6385a0bb49cc2312b1 | |
parent | 438e2ce68dfd4af4cfcec2f873564fb921db4bb5 (diff) |
serial: turn serial console suspend a boot rather than compile time option
Currently, there's a CONFIG_DISABLE_CONSOLE_SUSPEND that allows one to stop
the serial console from being suspended when the rest of the machine goes
to sleep. This is incredibly useful for debugging power management-related
things; however, having it as a compile-time option has proved to be
incredibly inconvenient for us (OLPC). There are plenty of times that we
want serial console to not suspend, but for the most part we'd like serial
console to be suspended.
This drops CONFIG_DISABLE_CONSOLE_SUSPEND, and replaces it with a kernel
boot parameter (no_console_suspend). By default, the serial console will
be suspended along with the rest of the system; by passing
'no_console_suspend' to the kernel during boot, serial console will remain
alive during suspend.
For now, this is pretty serial console specific; further fixes could be
applied to make this work for things like netconsole.
Signed-off-by: Andres Salomon <dilinger@debian.org>
Acked-by: "Rafael J. Wysocki" <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <nigel@suspend2.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | Documentation/kernel-parameters.txt | 10 | ||||
-rw-r--r-- | Documentation/power/basic-pm-debugging.txt | 4 | ||||
-rw-r--r-- | arch/powerpc/configs/pmac32_defconfig | 1 | ||||
-rw-r--r-- | drivers/serial/serial_core.c | 10 | ||||
-rw-r--r-- | include/linux/console.h | 7 | ||||
-rw-r--r-- | kernel/power/Kconfig | 11 | ||||
-rw-r--r-- | kernel/printk.c | 16 |
7 files changed, 32 insertions, 27 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 98cf90f2631d..189df0bcab99 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -479,6 +479,16 @@ and is between 256 and 4096 characters. It is defined in the file | |||
479 | UART at the specified I/O port or MMIO address. | 479 | UART at the specified I/O port or MMIO address. |
480 | The options are the same as for ttyS, above. | 480 | The options are the same as for ttyS, above. |
481 | 481 | ||
482 | no_console_suspend | ||
483 | [HW] Never suspend the console | ||
484 | Disable suspending of consoles during suspend and | ||
485 | hibernate operations. Once disabled, debugging | ||
486 | messages can reach various consoles while the rest | ||
487 | of the system is being put to sleep (ie, while | ||
488 | debugging driver suspend/resume hooks). This may | ||
489 | not work reliably with all consoles, but is known | ||
490 | to work with serial and VGA consoles. | ||
491 | |||
482 | cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver | 492 | cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver |
483 | Format: | 493 | Format: |
484 | <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>] | 494 | <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>] |
diff --git a/Documentation/power/basic-pm-debugging.txt b/Documentation/power/basic-pm-debugging.txt index 1a85e2b964dc..57aef2f6e0de 100644 --- a/Documentation/power/basic-pm-debugging.txt +++ b/Documentation/power/basic-pm-debugging.txt | |||
@@ -78,8 +78,8 @@ c) Advanced debugging | |||
78 | In case the STD does not work on your system even in the minimal configuration | 78 | In case the STD does not work on your system even in the minimal configuration |
79 | and compiling more drivers as modules is not practical or some modules cannot | 79 | and compiling more drivers as modules is not practical or some modules cannot |
80 | be unloaded, you can use one of the more advanced debugging techniques to find | 80 | be unloaded, you can use one of the more advanced debugging techniques to find |
81 | the problem. First, if there is a serial port in your box, you can set the | 81 | the problem. First, if there is a serial port in your box, you can boot the |
82 | CONFIG_DISABLE_CONSOLE_SUSPEND kernel configuration option and try to log kernel | 82 | kernel with the 'no_console_suspend' parameter and try to log kernel |
83 | messages using the serial console. This may provide you with some information | 83 | messages using the serial console. This may provide you with some information |
84 | about the reasons of the suspend (resume) failure. Alternatively, it may be | 84 | about the reasons of the suspend (resume) failure. Alternatively, it may be |
85 | possible to use a FireWire port for debugging with firescope | 85 | possible to use a FireWire port for debugging with firescope |
diff --git a/arch/powerpc/configs/pmac32_defconfig b/arch/powerpc/configs/pmac32_defconfig index 95b823b60c97..8e5988c4a164 100644 --- a/arch/powerpc/configs/pmac32_defconfig +++ b/arch/powerpc/configs/pmac32_defconfig | |||
@@ -209,7 +209,6 @@ CONFIG_PM=y | |||
209 | # CONFIG_PM_LEGACY is not set | 209 | # CONFIG_PM_LEGACY is not set |
210 | CONFIG_PM_DEBUG=y | 210 | CONFIG_PM_DEBUG=y |
211 | # CONFIG_PM_VERBOSE is not set | 211 | # CONFIG_PM_VERBOSE is not set |
212 | # CONFIG_DISABLE_CONSOLE_SUSPEND is not set | ||
213 | CONFIG_PM_SLEEP=y | 212 | CONFIG_PM_SLEEP=y |
214 | CONFIG_SUSPEND=y | 213 | CONFIG_SUSPEND=y |
215 | CONFIG_HIBERNATION=y | 214 | CONFIG_HIBERNATION=y |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 68aa4da01865..103189095c80 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -1959,12 +1959,11 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) | |||
1959 | 1959 | ||
1960 | mutex_lock(&state->mutex); | 1960 | mutex_lock(&state->mutex); |
1961 | 1961 | ||
1962 | #ifdef CONFIG_DISABLE_CONSOLE_SUSPEND | 1962 | if (!console_suspend_enabled && uart_console(port)) { |
1963 | if (uart_console(port)) { | 1963 | /* we're going to avoid suspending serial console */ |
1964 | mutex_unlock(&state->mutex); | 1964 | mutex_unlock(&state->mutex); |
1965 | return 0; | 1965 | return 0; |
1966 | } | 1966 | } |
1967 | #endif | ||
1968 | 1967 | ||
1969 | tty_dev = device_find_child(port->dev, &match, serial_match_port); | 1968 | tty_dev = device_find_child(port->dev, &match, serial_match_port); |
1970 | if (device_may_wakeup(tty_dev)) { | 1969 | if (device_may_wakeup(tty_dev)) { |
@@ -2016,12 +2015,11 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) | |||
2016 | 2015 | ||
2017 | mutex_lock(&state->mutex); | 2016 | mutex_lock(&state->mutex); |
2018 | 2017 | ||
2019 | #ifdef CONFIG_DISABLE_CONSOLE_SUSPEND | 2018 | if (!console_suspend_enabled && uart_console(port)) { |
2020 | if (uart_console(port)) { | 2019 | /* no need to resume serial console, it wasn't suspended */ |
2021 | mutex_unlock(&state->mutex); | 2020 | mutex_unlock(&state->mutex); |
2022 | return 0; | 2021 | return 0; |
2023 | } | 2022 | } |
2024 | #endif | ||
2025 | 2023 | ||
2026 | if (!port->suspended) { | 2024 | if (!port->suspended) { |
2027 | disable_irq_wake(port->irq); | 2025 | disable_irq_wake(port->irq); |
diff --git a/include/linux/console.h b/include/linux/console.h index 0a4542ddb73d..a5f88a6a259d 100644 --- a/include/linux/console.h +++ b/include/linux/console.h | |||
@@ -122,14 +122,11 @@ extern void console_stop(struct console *); | |||
122 | extern void console_start(struct console *); | 122 | extern void console_start(struct console *); |
123 | extern int is_console_locked(void); | 123 | extern int is_console_locked(void); |
124 | 124 | ||
125 | #ifndef CONFIG_DISABLE_CONSOLE_SUSPEND | 125 | extern int console_suspend_enabled; |
126 | |||
126 | /* Suspend and resume console messages over PM events */ | 127 | /* Suspend and resume console messages over PM events */ |
127 | extern void suspend_console(void); | 128 | extern void suspend_console(void); |
128 | extern void resume_console(void); | 129 | extern void resume_console(void); |
129 | #else | ||
130 | static inline void suspend_console(void) {} | ||
131 | static inline void resume_console(void) {} | ||
132 | #endif /* CONFIG_DISABLE_CONSOLE_SUSPEND */ | ||
133 | 130 | ||
134 | int mda_console_init(void); | 131 | int mda_console_init(void); |
135 | void prom_con_init(void); | 132 | void prom_con_init(void); |
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index 14b0e10dc95c..8e186c678149 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig | |||
@@ -44,17 +44,6 @@ config PM_VERBOSE | |||
44 | ---help--- | 44 | ---help--- |
45 | This option enables verbose messages from the Power Management code. | 45 | This option enables verbose messages from the Power Management code. |
46 | 46 | ||
47 | config DISABLE_CONSOLE_SUSPEND | ||
48 | bool "Keep console(s) enabled during suspend/resume (DANGEROUS)" | ||
49 | depends on PM_DEBUG && PM_SLEEP | ||
50 | default n | ||
51 | ---help--- | ||
52 | This option turns off the console suspend mechanism that prevents | ||
53 | debug messages from reaching the console during the suspend/resume | ||
54 | operations. This may be helpful when debugging device drivers' | ||
55 | suspend/resume routines, but may itself lead to problems, for example | ||
56 | if netconsole is used. | ||
57 | |||
58 | config PM_TRACE | 47 | config PM_TRACE |
59 | bool "Suspend/resume event tracing" | 48 | bool "Suspend/resume event tracing" |
60 | depends on PM_DEBUG && X86 && PM_SLEEP && EXPERIMENTAL | 49 | depends on PM_DEBUG && X86 && PM_SLEEP && EXPERIMENTAL |
diff --git a/kernel/printk.c b/kernel/printk.c index 52493474f0ab..a30fe33de395 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -862,7 +862,16 @@ int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, cha | |||
862 | return -1; | 862 | return -1; |
863 | } | 863 | } |
864 | 864 | ||
865 | #ifndef CONFIG_DISABLE_CONSOLE_SUSPEND | 865 | int console_suspend_enabled = 1; |
866 | EXPORT_SYMBOL(console_suspend_enabled); | ||
867 | |||
868 | static int __init console_suspend_disable(char *str) | ||
869 | { | ||
870 | console_suspend_enabled = 0; | ||
871 | return 1; | ||
872 | } | ||
873 | __setup("no_console_suspend", console_suspend_disable); | ||
874 | |||
866 | /** | 875 | /** |
867 | * suspend_console - suspend the console subsystem | 876 | * suspend_console - suspend the console subsystem |
868 | * | 877 | * |
@@ -870,6 +879,8 @@ int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, cha | |||
870 | */ | 879 | */ |
871 | void suspend_console(void) | 880 | void suspend_console(void) |
872 | { | 881 | { |
882 | if (!console_suspend_enabled) | ||
883 | return; | ||
873 | printk("Suspending console(s)\n"); | 884 | printk("Suspending console(s)\n"); |
874 | acquire_console_sem(); | 885 | acquire_console_sem(); |
875 | console_suspended = 1; | 886 | console_suspended = 1; |
@@ -877,10 +888,11 @@ void suspend_console(void) | |||
877 | 888 | ||
878 | void resume_console(void) | 889 | void resume_console(void) |
879 | { | 890 | { |
891 | if (!console_suspend_enabled) | ||
892 | return; | ||
880 | console_suspended = 0; | 893 | console_suspended = 0; |
881 | release_console_sem(); | 894 | release_console_sem(); |
882 | } | 895 | } |
883 | #endif /* CONFIG_DISABLE_CONSOLE_SUSPEND */ | ||
884 | 896 | ||
885 | /** | 897 | /** |
886 | * acquire_console_sem - lock the console system for exclusive use. | 898 | * acquire_console_sem - lock the console system for exclusive use. |