[2.6 patch] SOFTWARE_SUSPEND: handle HOTPLUG_CPU automatically

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linus Torvalds <torvalds@...>
Cc: Rafael J. Wysocki <rjw@...>, Len Brown <lenb@...>, <david@...>, Andrew Morton <akpm@...>, <linux-acpi@...>, <linux-kernel@...>, Pavel Machek <pavel@...>, Stefan Richter <stefanr@...>
Date: Saturday, July 28, 2007 - 12:52 am

On Fri, Jul 27, 2007 at 03:57:39PM -0700, Linus Torvalds wrote:

Sounds good.


IMHO not required:

config SOFTWARE_SUSPEND
	bool "Software Suspend (Hibernation)"
	depends on PM && SWAP
	depends on SUSPEND_UP_POSSIBLE || SUSPEND_SMP_POSSIBLE


This would give you "trying to assign nonexistent symbol SUSPEND_POSSIBLE"
kconfig warnings on architectures without SUSPEND_POSSIBLE.

(And you missed the UP case in your example.)


Patch below.


cu
Adrian


<--  snip  -->


An implementation detail of the suspend code that is not intuitive for 
the user is the HOTPLUG_CPU dependency of SOFTWARE_SUSPEND if SMP.

This patch handles the dependency of SOFTWARE_SUSPEND on HOTPLUG_CPU 
automatically without the user requiring to know about it.

Thanks to Stefan Richter and Linus Torvalds for valuable feedback.

Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 arch/i386/Kconfig    |   16 +++++++++++-----
 arch/powerpc/Kconfig |   11 +++++++++--
 arch/x86_64/Kconfig  |   19 ++++++++++++-------
 kernel/power/Kconfig |   23 +++++++++++++++++------
 4 files changed, 49 insertions(+), 20 deletions(-)

commit bb14e6721dc4e1a97efbfa5398d6021b321af52d
Author: Adrian Bunk <bunk@stusta.de>
Date:   Sat Jul 28 06:47:03 2007 +0200

    asdf

diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index abb582b..eb00a12 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -903,13 +903,19 @@ config PHYSICAL_ALIGN
 
 	  Don't change this unless you know what you are doing.
 
-config HOTPLUG_CPU
-	bool "Support for suspend on SMP and hot-pluggable CPUs (EXPERIMENTAL)"
+config HOTPLUG_CPU_POSSIBLE
+	bool
 	depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER
+	select SUSPEND_SMP_POSSIBLE
+	default y
+
+config HOTPLUG_CPU
+	bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" if !SUSPEND_SMP
+	depends on HOTPLUG_CPU_POSSIBLE
+	default y if SUSPEND_SMP
 	---help---
-	  Say Y here to experiment with turning CPUs off and on, and to
-	  enable suspend on SMP systems. CPUs can be controlled through
-	  /sys/devices/system/cpu.
+	  Say Y here to experiment with turning CPUs off and on.
+	  CPUs can be controlled through /sys/devices/system/cpu.
 
 config COMPAT_VDSO
 	bool "Compat VDSO support"
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 00099ef..950be0b 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -192,9 +192,16 @@ config IOMMU_VMERGE
 	  from *_map_sg(). Say Y if you know the drivers you are using are
 	  properly handling this case.
 
-config HOTPLUG_CPU
-	bool "Support for enabling/disabling CPUs"
+config HOTPLUG_CPU_POSSIBLE
+	bool
 	depends on SMP && HOTPLUG && EXPERIMENTAL && (PPC_PSERIES || PPC_PMAC)
+	select SUSPEND_SMP_POSSIBLE if PPC64
+	default y
+
+config HOTPLUG_CPU
+	bool "Support for enabling/disabling CPUs (EXPERIMENTAL)" if !SUSPEND_SMP
+	depends on HOTPLUG_CPU_POSSIBLE
+	default y if SUSPEND_SMP
 	---help---
 	  Say Y here to be able to disable and re-enable individual
 	  CPUs at runtime on SMP machines.
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 45f82ae..810ed4b 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -443,16 +443,21 @@ config PHYSICAL_ALIGN
 	hex
 	default "0x200000"
 
-config HOTPLUG_CPU
-	bool "Support for suspend on SMP and hot-pluggable CPUs (EXPERIMENTAL)"
+config HOTPLUG_CPU_POSSIBLE
+	bool
 	depends on SMP && HOTPLUG && EXPERIMENTAL
+	select SUSPEND_SMP_POSSIBLE
+	default y
+
+config HOTPLUG_CPU
+	bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" if !SUSPEND_SMP
+	depends on HOTPLUG_CPU_POSSIBLE
+	default y if SUSPEND_SMP
 	help
-		Say Y here to experiment with turning CPUs off and on.  CPUs
-		can be controlled through /sys/devices/system/cpu/cpu#.
-		This is also required for suspend/hibernation on SMP systems.
+	  Say Y here to experiment with turning CPUs off and on.
+	  CPUs can be controlled through /sys/devices/system/cpu/cpu#.
 
-		Say N if you want to disable CPU hotplug and don't need to
-		suspend.
+	  If unsure, say N.
 
 config ARCH_ENABLE_MEMORY_HOTPLUG
 	def_bool y
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index c1a106d..c7f74ba 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -72,9 +72,25 @@ config PM_TRACE
 	CAUTION: this option will cause your machine's real-time clock to be
 	set to an invalid time after a resume.
 
+config SUSPEND_UP_POSSIBLE
+	bool
+	depends on FRV || PPC32 || PPC64_SWSUSP || X86
+	depends on !SMP
+	default y
+
+# select'ed from arch/<arch>/Kconfig if supported
+config SUSPEND_SMP_POSSIBLE
+	bool
+
+config SUSPEND_SMP
+	bool
+	depends on SUSPEND_SMP_POSSIBLE && SOFTWARE_SUSPEND
+	default y
+
 config SOFTWARE_SUSPEND
 	bool "Software Suspend (Hibernation)"
-	depends on PM && SWAP && (((X86 || PPC64_SWSUSP) && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP))
+	depends on PM && SWAP
+	depends on SUSPEND_UP_POSSIBLE || SUSPEND_SMP_POSSIBLE
 	---help---
 	  Enable the suspend to disk (STD) functionality, which is usually
 	  called "hibernation" in user interfaces.  STD checkpoints the
@@ -132,11 +148,6 @@ config PM_STD_PARTITION
 	  suspended image to. It will simply pick the first available swap 
 	  device.
 
-config SUSPEND_SMP
-	bool
-	depends on HOTPLUG_CPU && (X86 || PPC64) && PM
-	default y
-
 config APM_EMULATION
 	tristate "Advanced Power Management Emulation"
 	depends on PM && SYS_SUPPORTS_APM_EMULATION

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[GIT PATCH] ACPI patches for 2.6.23-rc1, Len Brown, (Wed Jul 25, 12:38 pm)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Linus Torvalds, (Wed Jul 25, 2:48 pm)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Len Brown, (Wed Jul 25, 6:51 pm)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Len Brown, (Thu Jul 26, 12:26 am)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Linus Torvalds, (Thu Jul 26, 2:55 am)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Len Brown, (Thu Jul 26, 1:45 pm)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Linus Torvalds, (Thu Jul 26, 2:16 pm)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Jeff Garzik, (Thu Jul 26, 2:27 pm)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Len Brown, (Thu Jul 26, 2:18 pm)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Linus Torvalds, (Thu Jul 26, 2:01 pm)
CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.2..., Rafael J. Wysocki, (Thu Jul 26, 3:17 pm)
Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2..., Rafael J. Wysocki, (Thu Jul 26, 4:48 pm)
Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2..., Rafael J. Wysocki, (Sat Jul 28, 2:29 pm)
[PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND ..., Rafael J. Wysocki, (Sun Jul 29, 6:20 am)
[PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND ..., Rafael J. Wysocki, (Sun Jul 29, 5:23 pm)
Re: [PATCH] ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again), Rafael J. Wysocki, (Wed Aug 1, 6:24 am)
[PATCH] create CONFIG_SUSPEND_UP_POSSIBLE, Len Brown, (Mon Jul 30, 11:54 pm)
Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE, Pavel Machek, (Tue Jul 31, 2:38 am)
Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE, Len Brown, (Fri Aug 3, 3:23 pm)
Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE, Pavel Machek, (Sun Aug 5, 2:36 pm)
Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE, Rafael J. Wysocki, (Tue Jul 31, 5:33 am)
Re: [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSP..., Rafael J. Wysocki, (Mon Jul 30, 3:25 am)
[PATCH 2/2] Introduce CONFIG_SUSPEND (updated), Rafael J. Wysocki, (Sun Jul 29, 5:27 pm)
Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated), Len Brown, (Tue Jul 31, 12:59 am)
Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated), Rafael J. Wysocki, (Tue Jul 31, 5:15 am)
Re: [linux-pm] Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (upd..., Rafael J. Wysocki, (Tue Jul 31, 6:01 am)
[PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBE..., Rafael J. Wysocki, (Sun Jul 29, 5:24 pm)
[PATCH 2/2] Introduce CONFIG_SUSPEND, Rafael J. Wysocki, (Sun Jul 29, 8:38 am)
Re: [PATCH 2/2] Introduce CONFIG_SUSPEND, Adrian Bunk, (Sun Jul 29, 4:40 pm)
Re: [PATCH 2/2] Introduce CONFIG_SUSPEND, Rafael J. Wysocki, (Sun Jul 29, 5:17 pm)
Re: [PATCH 2/2] Introduce CONFIG_SUSPEND, Adrian Bunk, (Sun Jul 29, 5:18 pm)
Re: [PATCH 2/2] Introduce CONFIG_SUSPEND, Rafael J. Wysocki, (Sun Jul 29, 5:36 pm)
Re: [PATCH 2/2] Introduce CONFIG_SUSPEND, Richard Hughes, (Sun Jul 29, 5:30 pm)
Re: [PATCH 2/2] Introduce CONFIG_SUSPEND, Kyle Moffett, (Sun Jul 29, 10:47 pm)
Re: [PATCH 2/2] Introduce CONFIG_SUSPEND, Rafael J. Wysocki, (Sun Jul 29, 6:22 pm)
Re: [PATCH 2/2] Introduce CONFIG_SUSPEND, Pavel Machek, (Mon Jul 30, 5:26 pm)
[PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBE..., Rafael J. Wysocki, (Sun Jul 29, 6:21 am)
[PATCH] ACPI: restore CONFIG_ACPI_SLEEP, Len Brown, (Sat Jul 28, 3:33 am)
[2.6 patch] let SUSPEND select HOTPLUG_CPU, Adrian Bunk, (Fri Jul 27, 6:25 pm)
Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU, Linus Torvalds, (Fri Jul 27, 6:57 pm)
[2.6 patch] SOFTWARE_SUSPEND: handle HOTPLUG_CPU automatically, Adrian Bunk, (Sat Jul 28, 12:52 am)
Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU, Stefan Richter, (Fri Jul 27, 6:47 pm)
Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU, Adrian Bunk, (Fri Jul 27, 7:03 pm)
Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU, Pavel Machek, (Mon Jul 30, 5:18 pm)
Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU, Stefan Richter, (Sat Jul 28, 4:42 am)
Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU, Sergio Monteiro Basto, (Sat Jul 28, 10:44 am)
Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU, Rafael J. Wysocki, (Sat Jul 28, 2:30 pm)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Gabriel C, (Thu Jul 26, 6:07 am)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Len Brown, (Thu Jul 26, 2:05 pm)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Linus Torvalds, (Thu Jul 26, 2:18 pm)
Re: defconfig , ACPI=n compile error, Gabriel C, (Thu Jul 26, 2:53 pm)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Gabriel C, (Thu Jul 26, 2:38 pm)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Linus Torvalds, (Thu Jul 26, 3:02 am)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Jan Dittmer, (Fri Jul 27, 2:26 am)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Andreas Schwab, (Fri Jul 27, 7:50 pm)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Jan Dittmer, (Sat Jul 28, 3:58 am)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Yasha Okshtein, (Tue Jul 31, 9:34 pm)
Re: [GIT PATCH] ACPI patches for 2.6.23-rc1, Thomas Renninger, (Fri Jul 27, 12:25 pm)