mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Pavel Machek <pavel@ucw.cz>
Cc: Andres Salomon <dilinger@queued.net>,
	akpm@linux-foundation.org,
	kernel list <linux-kernel@vger.kernel.org>
Subject: Re: + serial-turn-serial-console-suspend-a-boot-rather-than-compile-time-option.patch added to -mm tree
Date: Tue, 14 Aug 2007 20:23:23 +0200	[thread overview]
Message-ID: <200708142023.23994.rjw@sisk.pl> (raw)
In-Reply-To: <20070814103939.GJ2900@elf.ucw.cz>

On Tuesday, 14 August 2007 12:39, Pavel Machek wrote:
> Hi!
> 
> > Thanks, updated below!
> > 
> > 
> > 
> > serial: turn serial console suspend a boot rather than compile time option
> > 
> > From: Andres Salomon <dilinger@debian.org>
> > 
> > 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
> 
> Actually, this should not be configurable. We should simply enable
> console during suspend for consoles that can handle this,
> automatically.... this patch does just that. I hope I separated it
> correctly.
> 
> It may be that something else than netconsole is broken during
> suspend... but it should not be, we were running without suspending
> consoles for quite long; we can always fix it when we hit the bug.
> 
> Signed-off-by: Pavel Machek <pavel@suse.cz>
> 

Well, my box used to hang on suspend when the framebuffer console was enabled.

It doesn't do that any more, though, so it may be safe.

I think we can do this, but I expect some bug reports to show up as a result.

Greetings,
Rafael


> diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
> index 69233f6..7f7c2ce 100644
> --- a/drivers/net/netconsole.c
> +++ b/drivers/net/netconsole.c
> @@ -115,6 +115,7 @@ static int init_netconsole(void)
>  	if (err)
>  		return err;
>  
> +	disable_console_on_suspend++;
>  	register_console(&netconsole);
>  	printk(KERN_INFO "netconsole: network logging started\n");
>  	return 0;
> @@ -123,6 +124,7 @@ static int init_netconsole(void)
>  static void cleanup_netconsole(void)
>  {
>  	unregister_console(&netconsole);
> +	disable_console_on_suspend--;
>  	netpoll_cleanup(&np);
>  }
>  
> diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
> index 030a606..426c3d6 100644
> --- a/drivers/serial/serial_core.c
> +++ b/drivers/serial/serial_core.c
> @@ -1941,12 +1941,10 @@ int uart_suspend_port(struct uart_driver
>  
>  	mutex_lock(&state->mutex);
>  
> -#ifdef CONFIG_DISABLE_CONSOLE_SUSPEND
>  	if (uart_console(port)) {
>  		mutex_unlock(&state->mutex);
>  		return 0;
>  	}
> -#endif
>  
>  	if (state->info && state->info->flags & UIF_INITIALIZED) {
>  		const struct uart_ops *ops = port->ops;
> @@ -1989,12 +1987,10 @@ int uart_resume_port(struct uart_driver 
>  
>  	mutex_lock(&state->mutex);
>  
> -#ifdef CONFIG_DISABLE_CONSOLE_SUSPEND
>  	if (uart_console(port)) {
>  		mutex_unlock(&state->mutex);
>  		return 0;
>  	}
> -#endif
>  
>  	uart_change_pm(state, 0);
>  
> diff --git a/include/linux/console.h b/include/linux/console.h
> index 56a7bcd..2e2b9bc 100644
> --- a/include/linux/console.h
> +++ b/include/linux/console.h
> @@ -121,14 +121,11 @@ extern void console_stop(struct console 
>  extern void console_start(struct console *);
>  extern int is_console_locked(void);
>  
> -#ifndef CONFIG_DISABLE_CONSOLE_SUSPEND
> +extern int disable_console_on_suspend;
> +
>  /* Suspend and resume console messages over PM events */
>  extern void suspend_console(void);
>  extern void resume_console(void);
> -#else
> -static inline void suspend_console(void) {}
> -static inline void resume_console(void) {}
> -#endif /* CONFIG_DISABLE_CONSOLE_SUSPEND */
>  
>  int mda_console_init(void);
>  void prom_con_init(void);
> diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
> index 412859f..a68e841 100644
> --- a/kernel/power/Kconfig
> +++ b/kernel/power/Kconfig
> @@ -44,17 +44,6 @@ config PM_VERBOSE
>  	---help---
>  	This option enables verbose messages from the Power Management code.
>  
> -config DISABLE_CONSOLE_SUSPEND
> -	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 bd2cd06..5a2d6c0 100644
> --- a/kernel/printk.c
> +++ b/kernel/printk.c
> @@ -751,7 +751,9 @@ int update_console_cmdline(char *name, i
>  	return -1;
>  }
>  
> -#ifndef CONFIG_DISABLE_CONSOLE_SUSPEND
> +
> +int disable_console_on_suspend;
> +
>  /**
>   * suspend_console - suspend the console subsystem
>   *
> @@ -759,17 +761,22 @@ #ifndef CONFIG_DISABLE_CONSOLE_SUSPEND
>   */
>  void suspend_console(void)
>  {
> -	printk("Suspending console(s)\n");
> -	acquire_console_sem();
> -	console_suspended = 1;
> +	if (disable_console_on_suspend) {
> +		printk("Suspending console(s)\n");
> +		acquire_console_sem();
> +		console_suspended = 1;
> +	}
>  }
>  
>  void resume_console(void)
>  {
> -	console_suspended = 0;
> -	release_console_sem();
> +	if (console_suspended) {
> +		BUG_ON(!disable_console_on_suspend);
> +		console_suspended = 0;
> +		release_console_sem();
> +	}
>  }
> -#endif /* CONFIG_DISABLE_CONSOLE_SUSPEND */
> +
>  
>  /**
>   * acquire_console_sem - lock the console system for exclusive use.
> 

-- 
"Premature optimization is the root of all evil." - Donald Knuth

  reply	other threads:[~2007-08-14 18:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200708092026.l79KQlDX017864@imap1.linux-foundation.org>
     [not found] ` <200708092340.46523.rjw@sisk.pl>
     [not found]   ` <20070809182145.bae42748.dilinger@queued.net>
     [not found]     ` <200708101456.46102.rjw@sisk.pl>
     [not found]       ` <20070813142331.9b0774ae.dilinger@queued.net>
2007-08-14 10:39         ` Pavel Machek
2007-08-14 18:23           ` Rafael J. Wysocki [this message]
2007-08-14 18:44             ` Andres Salomon
2007-08-14 18:58               ` Rafael J. Wysocki

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=200708142023.23994.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=akpm@linux-foundation.org \
    --cc=dilinger@queued.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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®