Skip to contentSkip to conversation

Suspend: More cleanups

PATCH Applied Rafael J. Wysocki 3 participants 7 messages Dec 16, 2007 – Jan 16, 2008

Subsystems (5)
x86 PowerPC ACPI Suspend to RAM +1 more subsystems
lore
Share & tools
lore
#0 lore raw

cover Suspend: More cleanups

Hi,

The following two patches are targeted for 2.6.25.

The first one fixes a comment in x86-64 low-level suspend code.

The other one adds a config option allowing to drop the freezer from the suspend (ie. STR / standby) code path.

Please add to the suspend branch.

Thanks,
Rafael

Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
#1 lore raw

PATCH 1/2 Suspend: Clean up suspend_64.c

From: Borislav Petkov <[email protected]>

There's a freakishly long comment in suspend_64.c, shorten it.

---
 arch/x86/kernel/suspend_64.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
arch/x86/kernel/suspend_64.c +6 -2
Index: linux-2.6/arch/x86/kernel/suspend_64.c
===================================================================
@@ -118,7 +118,12 @@ void fix_processor_context(void)
 	int cpu = smp_processor_id();
 	struct tss_struct *t = &per_cpu(init_tss, cpu);
 
-	set_tss_desc(cpu,t);	/* This just modifies memory; should not be necessary. But... This is necessary, because 386 hardware has concept of busy TSS or some similar stupidity. */
+	/*
+	 * This just modifies memory; should not be necessary. But... This
+	 * is necessary, because 386 hardware has concept of busy TSS or some
+	 * similar stupidity.
+	 */
+	set_tss_desc(cpu, t);
 
 	cpu_gdt(cpu)[GDT_ENTRY_TSS].type = 9;
 
@@ -138,7 +143,6 @@ void fix_processor_context(void)
                 loaddebug(&current->thread, 6);
                 loaddebug(&current->thread, 7);
 	}
-
 }
 
 #ifdef CONFIG_HIBERNATION
#2 lore raw

Re: [PATCH 1/2] Suspend: Clean up suspend_64.c

Quoted 7 lines · Rafael J. Wysocki

From: Borislav Petkov <[email protected]>

There's a freakishly long comment in suspend_64.c, shorten it.

ACK.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#4 lore raw

PATCH 2/2 Suspend: Add config option to disable the freezer if architecture wants that

In reply to Rafael J. Wysocki

From: Johannes Berg <[email protected]>

This patch makes the freezer optional for suspend to allow the system to work (or not work) like the original PMU suspend.

---
In a quick test, playing sound across suspend failed to work, it usually works when the freezer is enabled (unless you use gstreamer.)

 arch/powerpc/Kconfig |    4 ++++
 kernel/power/Kconfig |   11 +++++++++++
 kernel/power/main.c  |    6 +++---
 kernel/power/power.h |   22 ++++++++++++++++++++++
 4 files changed, 40 insertions(+), 3 deletions(-)
kernel/power/main.c +3 -3
Index: linux-2.6/kernel/power/main.c
===================================================================
@@ -176,7 +176,7 @@ static int suspend_prepare(void)
 
 	pm_prepare_console();
 
-	if (freeze_processes()) {
+	if (suspend_freeze_processes()) {
 		error = -EAGAIN;
 		goto Thaw;
 	}
@@ -194,7 +194,7 @@ static int suspend_prepare(void)
 		return 0;
 
  Thaw:
-	thaw_processes();
+	suspend_thaw_processes();
 	pm_restore_console();
  Finish:
 	pm_notifier_call_chain(PM_POST_SUSPEND);
@@ -300,7 +300,7 @@ int suspend_devices_and_enter(suspend_st
  */
 static void suspend_finish(void)
 {
-	thaw_processes();
+	suspend_thaw_processes();
 	pm_restore_console();
 	pm_notifier_call_chain(PM_POST_SUSPEND);
 }
kernel/power/Kconfig +11 -0
Index: linux-2.6/kernel/power/Kconfig
===================================================================
@@ -104,6 +104,17 @@ config SUSPEND
 	  powered and thus its contents are preserved, such as the
 	  suspend-to-RAM state (e.g. the ACPI S3 state).
 
+config SUSPEND_FREEZER
+	bool "Enable freezer for suspend to RAM/standby" \
+		if ARCH_WANTS_FREEZER_CONTROL || BROKEN
+	depends on SUSPEND
+	default y
+	help
+	  This allows you to turn off the freezer for suspend. If this is
+	  done, no tasks are frozen for suspend to RAM/standby.
+
+	  Turning OFF this setting is NOT recommended! If in doubt, say Y.
+
 config HIBERNATION
 	bool "Hibernation (aka 'suspend to disk')"
 	depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE
arch/powerpc/Kconfig +4 -0
Index: linux-2.6/arch/powerpc/Kconfig
===================================================================
@@ -384,6 +384,10 @@ config CMDLINE
 	  most cases you will need to specify the root device here.
 
 if !44x || BROKEN
+config ARCH_WANTS_FREEZER_CONTROL
+	def_bool y
+	depends on ADB_PMU
+
 source kernel/power/Kconfig
 endif
 
kernel/power/power.h +22 -0
Index: linux-2.6/kernel/power/power.h
===================================================================
@@ -1,6 +1,7 @@
 #include <linux/suspend.h>
 #include <linux/suspend_ioctls.h>
 #include <linux/utsname.h>
+#include <linux/freezer.h>
 
 struct swsusp_info {
 	struct new_utsname	uts;
@@ -205,3 +206,24 @@ enum {
 #define TEST_MAX	(__TEST_AFTER_LAST - 1)
 
 extern int pm_test_level;
+
+#ifdef CONFIG_SUSPEND_FREEZER
+static inline int suspend_freeze_processes(void)
+{
+	return freeze_processes();
+}
+
+static inline void suspend_thaw_processes(void)
+{
+	thaw_processes();
+}
+#else
+static inline int suspend_freeze_processes(void)
+{
+	return 0;
+}
+
+static inline void suspend_thaw_processes(void)
+{
+}
+#endif
#5 lore raw

Re: [PATCH 2/2] Suspend: Add config option to disable the freezer if architecture wants that

Quoted 8 lines · Rafael J. Wysocki

From: Johannes Berg <[email protected]>

This patch makes the freezer optional for suspend to allow the system to work (or not work) like the original PMU suspend.

ACK.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
reviewer Applied
#6 lore raw

Re: [PATCH 2/2] Suspend: Add config option to disable the freezer if architecture wants that

Applied.

thanks,
-Len

Quoted 12 lines · Pavel Machek
Quoted 8 lines · Rafael J. Wysocki

From: Johannes Berg <[email protected]>

This patch makes the freezer optional for suspend to allow the system to work (or not work) like the original PMU suspend.

ACK.
Pavel