Commit:     8f4ce8c32f2dc2bc2411cafe39976fc5c0adfabf
Parent:     438e2ce68dfd4af4cfcec2f873564fb921db4bb5
Author:     Andres Salomon <[EMAIL PROTECTED]>
AuthorDate: Thu Oct 18 03:04:50 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Oct 18 14:37:19 2007 -0700

    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 <[EMAIL PROTECTED]>
    Acked-by: "Rafael J. Wysocki" <[EMAIL PROTECTED]>
    Acked-by: Pavel Machek <[EMAIL PROTECTED]>
    Cc: Nigel Cunningham <[EMAIL PROTECTED]>
    Cc: Russell King <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 Documentation/kernel-parameters.txt        |   10 ++++++++++
 Documentation/power/basic-pm-debugging.txt |    4 ++--
 arch/powerpc/configs/pmac32_defconfig      |    1 -
 drivers/serial/serial_core.c               |   10 ++++------
 include/linux/console.h                    |    7 ++-----
 kernel/power/Kconfig                       |   11 -----------
 kernel/printk.c                            |   16 ++++++++++++++--
 7 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/Documentation/kernel-parameters.txt 
index 98cf90f..189df0b 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
                        UART at the specified I/O port or MMIO address.
                        The options are the same as for ttyS, above.
+       no_console_suspend
+                       [HW] Never suspend the console
+                       Disable suspending of consoles during suspend and
+                       hibernate operations.  Once disabled, debugging
+                       messages can reach various consoles while the rest
+                       of the system is being put to sleep (ie, while
+                       debugging driver suspend/resume hooks).  This may
+                       not work reliably with all consoles, but is known
+                       to work with serial and VGA consoles.
        cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver
diff --git a/Documentation/power/basic-pm-debugging.txt 
index 1a85e2b..57aef2f 100644
--- a/Documentation/power/basic-pm-debugging.txt
+++ b/Documentation/power/basic-pm-debugging.txt
@@ -78,8 +78,8 @@ c) Advanced debugging
 In case the STD does not work on your system even in the minimal configuration
 and compiling more drivers as modules is not practical or some modules cannot
 be unloaded, you can use one of the more advanced debugging techniques to find
-the problem.  First, if there is a serial port in your box, you can set the
-CONFIG_DISABLE_CONSOLE_SUSPEND kernel configuration option and try to log 
+the problem.  First, if there is a serial port in your box, you can boot the
+kernel with the 'no_console_suspend' parameter and try to log kernel
 messages using the serial console.  This may provide you with some information
 about the reasons of the suspend (resume) failure.  Alternatively, it may be
 possible to use a FireWire port for debugging with firescope
diff --git a/arch/powerpc/configs/pmac32_defconfig 
index 95b823b..8e5988c 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_defconfig
@@ -209,7 +209,6 @@ CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_VERBOSE is not set
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 68aa4da..1031890 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)
-       if (uart_console(port)) {
+       if (!console_suspend_enabled && uart_console(port)) {
+               /* we're going to avoid suspending serial console */
                return 0;
        tty_dev = device_find_child(port->dev, &match, serial_match_port);
        if (device_may_wakeup(tty_dev)) {
@@ -2016,12 +2015,11 @@ int uart_resume_port(struct uart_driver *drv, struct 
uart_port *port)
-       if (uart_console(port)) {
+       if (!console_suspend_enabled && uart_console(port)) {
+               /* no need to resume serial console, it wasn't suspended */
                return 0;
        if (!port->suspended) {
diff --git a/include/linux/console.h b/include/linux/console.h
index 0a4542d..a5f88a6 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -122,14 +122,11 @@ extern void console_stop(struct console *);
 extern void console_start(struct console *);
 extern int is_console_locked(void);
+extern int console_suspend_enabled;
 /* Suspend and resume console messages over PM events */
 extern void suspend_console(void);
 extern void resume_console(void);
-static inline void suspend_console(void) {}
-static inline void resume_console(void) {}
 int mda_console_init(void);
 void prom_con_init(void);
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index 14b0e10..8e186c6 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -44,17 +44,6 @@ config PM_VERBOSE
        This option enables verbose messages from the Power Management code.
-       bool "Keep console(s) enabled during suspend/resume (DANGEROUS)"
-       depends on PM_DEBUG && PM_SLEEP
-       default n
-       ---help---
-       This option turns off the console suspend mechanism that prevents
-       debug messages from reaching the console during the suspend/resume
-       operations.  This may be helpful when debugging device drivers'
-       suspend/resume routines, but may itself lead to problems, for example
-       if netconsole is used.
 config PM_TRACE
        bool "Suspend/resume event tracing"
        depends on PM_DEBUG && X86 && PM_SLEEP && EXPERIMENTAL
diff --git a/kernel/printk.c b/kernel/printk.c
index 5249347..a30fe33 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
        return -1;
+int console_suspend_enabled = 1;
+static int __init console_suspend_disable(char *str)
+       console_suspend_enabled = 0;
+       return 1;
+__setup("no_console_suspend", console_suspend_disable);
  * suspend_console - suspend the console subsystem
@@ -870,6 +879,8 @@ int update_console_cmdline(char *name, int idx, char 
*name_new, int idx_new, cha
 void suspend_console(void)
+       if (!console_suspend_enabled)
+               return;
        printk("Suspending console(s)\n");
        console_suspended = 1;
@@ -877,10 +888,11 @@ void suspend_console(void)
 void resume_console(void)
+       if (!console_suspend_enabled)
+               return;
        console_suspended = 0;
  * acquire_console_sem - lock the console system for exclusive use.
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to