From: Ben Collins <ben.collins@canonical.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Greg KH <greg@kroah.com>,
linux-kernel@vger.kernel.org, Pavel Machek <pavel@ucw.cz>,
pm list <linux-pm@lists.linux-foundation.org>
Subject: Re: [PATCH 6/7] pm: Config option to disable handling of console during suspend/resume
Date: Tue, 29 Jul 2008 17:51:50 -0400 [thread overview]
Message-ID: <1217368310.6066.56.camel@cunning> (raw)
In-Reply-To: <200807292315.36511.rjw@sisk.pl>
On Tue, 2008-07-29 at 23:15 +0200, Rafael J. Wysocki wrote:
> On Tuesday, 29 of July 2008, Greg KH wrote:
> > On Sun, Jul 20, 2008 at 09:48:28PM -0400, Ben Collins wrote:
> > > Config option allows userspace to handle console during suspend/resume
> > > instead of the kernel.
> > >
> > > Signed-off-by: Ben Collins <ben.collins@canonical.com>
> > > ---
> > > kernel/power/Kconfig | 15 +++++++++++++++
> > > kernel/power/console.c | 4 ++++
> > > 2 files changed, 19 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
> > > index b45da40..6855299 100644
> > > --- a/kernel/power/Kconfig
> > > +++ b/kernel/power/Kconfig
> > > @@ -105,6 +105,21 @@ config SUSPEND_FREEZER
> > >
> > > Turning OFF this setting is NOT recommended! If in doubt, say Y.
> > >
> > > +config PM_DISABLE_CONSOLE
> > > + bool "Disable Power Management messing with the active console"
> > > + depends on PM
> > > + default n
> > > + ---help---
> > > + By default, PM will take over the active console (generally, this means
> > > + switching to the console when suspending from X). This can at times cause
> > > + problems, especially if userspace suspend scripts try to do things with
> > > + the console before or after suspending (e.g. calling vbestate).
> > > +
> > > + To work around this, enable this option so that PM will not handle the
> > > + console.
> > > +
> > > + If unsure, say N.
> > > +
> > > config HIBERNATION
> > > bool "Hibernation (aka 'suspend to disk')"
> > > depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE
> > > diff --git a/kernel/power/console.c b/kernel/power/console.c
> > > index b8628be..8b9706f 100644
> > > --- a/kernel/power/console.c
> > > +++ b/kernel/power/console.c
> > > @@ -33,6 +33,7 @@ EXPORT_SYMBOL(pm_set_vt_switch);
> > >
> > > int pm_prepare_console(void)
> > > {
> > > +#ifndef CONFIG_PM_DISABLE_CONSOLE
> >
> > Can't you do this in a .h file instead?
> >
> > And is this really needed? Why has no other distro needed this change?
> > What is so wierd about your suspend setup to require this?
>
> Reportedly, some systems have problems with graphics restoration from user
> space if the switch is done.
>
> Anyway, I'd prefer to use the (already existing) pm_set_vt_switch() thing for
> that, maybe with the help of a command line parameter, to adding the .config
> option like this.
Ah. I didn't notice pm_set_vt_switch(). Then what I would like better is
the config option to set a default. For us, not doing the vt switch is a
good default (I don't think we have a case where suspend/resume requires
it).
Something like:
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index e7bea3e..6a042f8 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2247,6 +2247,11 @@ and is between 256 and 4096 characters. It is defined in the file
vmpoff= [KNL,S390] Perform z/VM CP command after power off.
Format: <command>
+ vt_switch= [PM] Switch vt's during suspend/resume
+ Format: { 0 | 1 }
+ Default is normally '1', but depends on value of
+ the PM_DISABLE_CONSOLE config option.
+
waveartist= [HW,OSS]
Format: <io>,<irq>,<dma>,<dma2>
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index dcd165f..202f9b3 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -116,6 +116,25 @@ config SUSPEND_FREEZER
Turning OFF this setting is NOT recommended! If in doubt, say Y.
+config PM_DISABLE_CONSOLE
+ bool "Disable Power Management messing with the active console"
+ depends on PM
+ default n
+ ---help---
+ By default, PM will take over the active console (generally, this means
+ switching to the console when suspending from X). This can at times cause
+ problems, especially if userspace suspend scripts try to do things with
+ the console before or after suspending (e.g. calling vbestate).
+
+ To work around this, enable this option so that PM will not handle the
+ console.
+
+ Note, this is the same as passing vt_switch=0 command line option, but
+ just hardcodes the default. You can still pass vt_switch=1 with this
+ option to get original behavior.
+
+ If unsure, say N.
+
config HIBERNATION
bool "Hibernation (aka 'suspend to disk')"
depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE
diff --git a/kernel/power/console.c b/kernel/power/console.c
index b8628be..db116d8 100644
--- a/kernel/power/console.c
+++ b/kernel/power/console.c
@@ -14,7 +14,11 @@
#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
static int orig_fgconsole, orig_kmsg;
+#ifdef CONFIG_PM_DISABLE_CONSOLE
+static int disable_vt_switch = 1;
+#else
static int disable_vt_switch;
+#endif
/*
* Normally during a suspend, we allocate a new console and switch to it.
@@ -80,4 +84,17 @@ void pm_restore_console(void)
release_console_sem();
kmsg_redirect = orig_kmsg;
}
+
+static int __init set_vt_switch(char *str)
+{
+ if (str[0] == '0')
+ disable_vt_switch = 1;
+ else if (str[0] == '1')
+ disable_vt_switch = 0;
+ else
+ return -EINVAL;
+
+ return 0;
+}
+__setup("vt_switch=", set_vt_switch);
#endif
next prev parent reply other threads:[~2008-07-29 21:52 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-02 15:57 [PATCH 0/7] Patches from Ubuntu kernel tree Ben Collins
2008-01-02 15:57 ` [PATCH 1/7] netfilter: Export ip6t_mh.h and xt_quota.h for iptables build Tim Gardner
2008-07-22 8:55 ` Jan Engelhardt
2008-07-22 10:45 ` Patrick McHardy
2008-01-18 18:21 ` [PATCH 2/7] ata: blacklist FUJITSU MHW2160BH PL Chuck Short
2008-07-31 5:45 ` Jeff Garzik
2008-07-20 21:08 ` [PATCH 4/7] irda: Default to dongle type 9 on IBM hardware Matthew Garrett
2008-07-21 5:29 ` Marcel Holtmann
2008-07-21 17:40 ` [PATCH 4/7] nsc-ircc: " Ben Collins
2008-07-29 2:46 ` Andrew Morton
2008-07-30 1:44 ` Matthew Garrett
2008-07-30 2:16 ` Andrew Morton
2008-07-30 5:11 ` Matthew Garrett
2008-07-30 14:17 ` Ben Collins
2008-07-20 21:44 ` [PATCH 7/7] HID: Add quirks for fourth generation MacBooks (4,1) Alexandre Karpenko
2008-07-21 1:45 ` [PATCH 3/7] bluetooth: Add quirks for a few hci_usb devices Ben Collins
2008-07-21 5:08 ` Marcel Holtmann
2008-07-21 5:54 ` Ben Collins
2008-07-21 16:00 ` Ben Collins
2008-07-21 23:30 ` Marcel Holtmann
2008-07-21 1:48 ` [PATCH 6/7] pm: Config option to disable handling of console during suspend/resume Ben Collins
2008-07-29 3:33 ` Greg KH
2008-07-29 21:15 ` Rafael J. Wysocki
2008-07-29 21:15 ` Rafael J. Wysocki
2008-07-29 21:51 ` Ben Collins [this message]
2008-07-29 22:18 ` Rafael J. Wysocki
2008-07-29 22:18 ` Rafael J. Wysocki
2008-07-30 4:47 ` Greg KH
2008-07-30 14:20 ` Ben Collins
2008-08-04 6:28 ` Pavel Machek
2008-08-04 6:28 ` Pavel Machek
2008-08-07 21:23 ` Ben Collins
2008-08-07 21:23 ` Ben Collins
2008-08-07 21:43 ` Rafael J. Wysocki
2008-08-07 21:43 ` Rafael J. Wysocki
2008-07-30 14:20 ` Ben Collins
2008-07-30 4:47 ` Greg KH
2008-07-29 21:51 ` Ben Collins
2008-07-21 1:54 ` [PATCH 5/7] [airprime] Add support for more devices Ben Collins
2008-07-29 2:58 ` Andrew Morton
2008-07-29 3:17 ` Greg KH
2008-07-29 3:30 ` Greg KH
2008-07-29 14:20 ` Ben Collins
2008-07-29 15:53 ` Kevin Lloyd
2008-07-29 3:35 ` [PATCH 0/7] Patches from Ubuntu kernel tree Greg KH
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=1217368310.6066.56.camel@cunning \
--to=ben.collins@canonical.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=pavel@ucw.cz \
--cc=rjw@sisk.pl \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.