Skip to contentSkip to conversation

ACPI patches for 2.6.23-rc1

PATCH In review Len Brown 22 participants 118 messages Jul 25, 2007 – Aug 16, 2007 1 message not in the archive

Subsystems (15)
Memory management PowerPC ACPI PCI +11 more subsystems
lore
Share & tools
lore

Len Brown

author reviewer
#0 lore raw

PATCH 1/1 ACPI patches for 2.6.23-rc1

Hi Linus,

please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git release

Fixes regressions -- a build failure, an oops, some dmesg spam. Also fixes some D-state issues and adds ACPI module auto-loading. Yes, I'd hoped to get the last two in before rc1.
I'm hopeful that a couple-days into rc2 is sufficiently early for them.

This will update the files shown below.

thanks!

-Len

ps. individual patches are available on [email protected]
and a consolidated plain patch is available here:
ftp://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/patches/release/2.6.23/acpi-release-20070126-2.6.23-rc1.diff.gz

 arch/i386/kernel/acpi/Makefile      |    2 
 arch/i386/kernel/setup.c            |    2 
 arch/i386/mm/init.c                 |    2 
 arch/ia64/kernel/acpi.c             |   19 ++
 arch/x86_64/kernel/acpi/Makefile    |    2 
 arch/x86_64/kernel/acpi/sleep.c     |    4 
 arch/x86_64/kernel/head.S           |    2 
 arch/x86_64/kernel/setup.c          |    2 
 drivers/acpi/Kconfig                |   64 +++------
 drivers/acpi/ac.c                   |    9 +
 drivers/acpi/acpi_memhotplug.c      |    8 +
 drivers/acpi/asus_acpi.c            |   11 +
 drivers/acpi/battery.c              |    9 +
 drivers/acpi/button.c               |   12 +
 drivers/acpi/container.c            |   10 +
 drivers/acpi/ec.c                   |    8 -
 drivers/acpi/events/evrgnini.c      |    2 
 drivers/acpi/fan.c                  |    8 +
 drivers/acpi/namespace/nsxfeval.c   |    2 
 drivers/acpi/pci_link.c             |    9 +
 drivers/acpi/pci_root.c             |    9 +
 drivers/acpi/power.c                |    8 +
 drivers/acpi/processor_core.c       |    8 +
 drivers/acpi/processor_throttling.c |   59 ++++++--
 drivers/acpi/sbs.c                  |   10 +
 drivers/acpi/scan.c                 |  156 ++++++++++++++++-------
 drivers/acpi/sleep/Makefile         |    4 
 drivers/acpi/sleep/main.c           |  162 +++++++++++++++++++-----
 drivers/acpi/sleep/poweroff.c       |    2 
 drivers/acpi/sleep/proc.c           |   20 ++
 drivers/acpi/sleep/wakeup.c         |    2 
 drivers/acpi/thermal.c              |    8 +
 drivers/acpi/utilities/uteval.c     |    4 
 drivers/acpi/video.c                |    8 +
 drivers/char/hpet.c                 |    8 +
 drivers/input/misc/atlas_btns.c     |    9 +
 drivers/misc/asus-laptop.c          |   41 ++++--
 drivers/misc/sony-laptop.c          |   21 ++-
 drivers/misc/thinkpad_acpi.c        |   20 ++
 drivers/misc/thinkpad_acpi.h        |    2 
 drivers/pci/pci-acpi.c              |   28 +++-
 drivers/pci/pci.c                   |    8 -
 drivers/pci/pci.h                   |    2 
 drivers/pnp/driver.c                |    5 
 drivers/pnp/pnpacpi/core.c          |   33 +++-
 include/acpi/acpi_bus.h             |    7 -
 include/acpi/acpi_drivers.h         |   25 +--
 include/acpi/actypes.h              |    6 
 include/acpi/acutils.h              |    4 
 include/asm-i386/acpi.h             |   23 +--
 include/asm-i386/suspend.h          |    2 
 include/asm-ia64/acpi.h             |    5 
 include/asm-x86_64/acpi.h           |   22 +--
 include/asm-x86_64/suspend.h        |    2 
 include/linux/acpi.h                |    1 
 include/linux/mod_devicetable.h     |    6 
 include/linux/pnp.h                 |    4 
 kernel/sysctl.c                     |    2 
 scripts/mod/file2alias.c            |   12 +
 59 files changed, 668 insertions(+), 277 deletions(-)

through these commits:

Al Viro (1):
ACPI: asus-laptop: Fix failure exits

Len Brown (5):
ACPI: Kconfig: CONFIG_ACPI_PROCFS now defaults to N
ACPI: Kconfig: fold /proc/acpi/sleep under CONFIG_ACPI_PROCFS
ACPI: Kconfig: always enable CONFIG_ACPI_SLEEP on X86
ACPI: quiet ACPI Exceptions due to no _PTC or _TSS
ACPI: Kconfig: remove CONFIG_ACPI_SLEEP from source

Luming Yu (1):
ACPI: fix oops due to typo in new throttling code

Rafael J. Wysocki (2):
ACPI: Implement the set_target() callback from pm_ops
ACPI: Remove references to ACPI_STATE_S2 from acpi_pm_enter

Shaohua Li (4):
ACPI: Add acpi_pm_device_sleep_state helper routine ACPI, PNP: hook ACPI D-state to PNP suspend/resume
ACPI: Use ACPI methods to select PCI device suspend state
ACPI: ignore _PSx method for hotplugable PCI devices

Thomas Renninger (3):
ACPI: autoload modules - ACPICA modifications
ACPI: autoload modules - Create ACPI alias interface
ACPI: autoload modules - Create __mod_acpi_device_table symbol for all ACPI drivers

with this log:

commit 323ef30af3a0da47cc761b04b262d98d0fe79126
Merge: cb3e0c1... 1ba90e3...
Author: Len Brown <[email protected]>
Date: Wed Jul 25 01:36:53 2007 -0400

Pull auto-load-modules into release branch

commit cb3e0c107bebc6cf3e7158f7aa54c32017c7d4c4
Merge: 1e1f3f2... 50ad147...
Author: Len Brown <[email protected]>
Date: Wed Jul 25 01:36:31 2007 -0400

Pull d-states into release branch

Conflicts:

drivers/acpi/sleep/main.c

commit 1e1f3f24cdbc53e67acd7b2e37e6cf0cb11bd13c
Merge: c30c620... e8b2fd0...
Author: Len Brown <[email protected]>
Date: Wed Jul 25 01:35:25 2007 -0400

Pull kconfig into release branch

commit e8b2fd01228f690c3e0cb3f14facfa8d93d4adae

Author: Len Brown <[email protected]>
Date:   Tue Jul 24 22:26:33 2007 -0400

ACPI: Kconfig: remove CONFIG_ACPI_SLEEP from source

As it was a synonym for (CONFIG_ACPI && CONFIG_X86), the ifdefs for it were more clutter than they were worth.

For ia64, just add a few stubs in anticipation of future S3 or S4 support.

commit c30c620ee1cc351bcc149c4280e1166998df0064

Author: Len Brown <[email protected]>
Date:   Wed Jul 25 00:57:46 2007 -0400

ACPI: quiet ACPI Exceptions due to no _PTC or _TSS

ACPI Exception (processor_throttling-0084): AE_NOT_FOUND, Evaluating _PTC [20070126] ACPI Exception (processor_throttling-0147): AE_NOT_FOUND, Evaluating _TSS [20070126]

These methods are optional, so Linux should not alarm users when they are not found.

http://bugzilla.kernel.org/show_bug.cgi?id=8802

commit 50ad147aa09c829cd452fae6ca99396c0b5b0695

Author: Rafael J. Wysocki <[email protected]>
Date:   Tue Jul 24 11:58:39 2007 +0200

ACPI: Remove references to ACPI_STATE_S2 from acpi_pm_enter

Remove references to ACPI_STATE_S2, introduced by acpi-implement-the-set_target-callback-from-pm_ops.patch, from acpi_pm_enter().

commit 7c5aa6642fa26641ebf286966a165aec71c91991

Author: Len Brown <[email protected]>
Date:   Tue Jul 24 02:25:03 2007 -0400

ACPI: Kconfig: always enable CONFIG_ACPI_SLEEP on X86

The SMP dependency on HOTPLUG_CPU and SUSPEND_SMP caused more harm than good -- making ACPI sleep support vanish for configs missing those options. So simply select them on the (ACPI && SMP && X86) systems that need them.

Also, remove the prompt for ACPI_SLEEP, virtually nobody (intentionally) enables ACPI without it.

commit 43532c8a46ae313c2da3baa7598a1de4d403ba83

Author: Len Brown <[email protected]>
Date:   Tue Jul 24 02:16:50 2007 -0400

ACPI: Kconfig: fold /proc/acpi/sleep under CONFIG_ACPI_PROCFS

/proc/acpi/sleep has had its own "default n" option, ACPI_SLEEP_PROC_SLEEP, for many months. Time to delete ACPI_SLEEP_PROC_SLEEP.

Users that still need /proc/acpi/sleep can still get it along with the other deprecated /proc/acpi files by enabling CONFIG_ACPI_PROCFS.

Also delete ACPI_SLEEP_PROC_FS, which was an umbrella for /proc/acpi/sleep, wakeup, alarm, because it was effectively just a synonym for ACPI_SLEEP.

commit fb804714560463534ebcb538a3b0a3c687a830ec

Author: Len Brown <[email protected]>
Date:   Tue Jul 24 01:50:46 2007 -0400

ACPI: Kconfig: CONFIG_ACPI_PROCFS now defaults to N

delete "default y" from CONFIG_ACPI_PROCFS
(effectively making the default 'N')

List exactly what /proc files this option controls, and clarify that it doesn't change non-deprecated files.

commit 1ba90e3a87c46500623afdc3898573e4a5ebb21b

Author: Thomas Renninger <[email protected]>
Date:   Mon Jul 23 14:44:41 2007 +0200

ACPI: autoload modules - Create __mod_acpi_device_table symbol for all ACPI drivers

modpost is going to use these to create e.g. acpi:ACPI0001 in modules.alias.

commit 29b71a1ca74491fab9fed09e9d835d840d042690

Author: Thomas Renninger <[email protected]>
Date:   Mon Jul 23 14:43:51 2007 +0200

ACPI: autoload modules - Create ACPI alias interface

Modify modpost (file2alias.c) to add acpi*:XYZ0001: alias in modules.alias like:
grep acpi /lib/modules/2.6.22-rc4-default/modules.alias
alias acpi*:SNY5001:* sony_laptop
alias acpi*:SNY6001:* sony_laptop
for e.g. the sony_laptop module.
This module matches against all ACPI devices with a HID or CID of SNY5001 or SNY6001

Export an uevent and modalias sysfs file containing the string:
[MODALIAS=]acpi:PNP0C0C:
additional CIDs are concatenated at the end.

commit 8c8eb78f673c07b60f31751e1e47ac367c60c6b7

Author: Thomas Renninger <[email protected]>
Date:   Mon Jul 23 14:43:32 2007 +0200

ACPI: autoload modules - ACPICA modifications

Define standardized HIDs - Rename current acpi_device_id to acpica_device_id

commit 3b0d71170d37878bbb1203ebc3f92e36d6151a80

Author: Al Viro <[email protected]>
Date:   Mon Jul 23 11:21:34 2007 +0100

ACPI: asus-laptop: Fix failure exits

> Subject : drivers/misc/asus-laptop.c:*: error: 'struct led_classdev' has no member named 'class_dev'
> References : http://lkml.org/lkml/2007/7/22/299
> Submitter : Gabriel C <[email protected]>

Fallout from f8a7c6fe14f556ca8eeddce258cb21392d0c3a2f. However, looking at it shows that checks done in ASUS_LED_UNREGISTER() can't trigger at all (we never get to asus_led_exit() if registration fails) and if that registration fails, we actually leak stuff. IOW, it's worse than just replacing class_dev with dev in there - the tests themselves had been papering over the lousy cleanup logics.

commit 3cc2649b879f0e83fd51b14c82bad5f8f208591e

Author: Luming Yu <[email protected]>
Date:   Mon Jul 23 12:39:28 2007 -0400

ACPI: fix oops due to typo in new throttling code

commit 10b3dcae0f275e2546e55303d64ddbb58cec7599

Author: Shaohua Li <[email protected]>
Date:   Fri Jul 20 10:03:25 2007 +0800

ACPI: ignore _PSx method for hotplugable PCI devices

If the ACPI device has _EJ0, ignore the device. _PSx will set power for the slot,
and the hotplug driver will take care of _PSx.

commit ab826ca4cf2fe8ebcfd21189ca8bfeb47ca88359

Author: Shaohua Li <[email protected]>
Date:   Fri Jul 20 10:03:22 2007 +0800

ACPI: Use ACPI methods to select PCI device suspend state

applied after Rafel's 'PM: Update global suspend and hibernation operations framework' patch set

commit fc30e68e88baf463683bde43347756889ba2ffae

Author: Shaohua Li <[email protected]>
Date:   Fri Jul 20 10:03:20 2007 +0800

ACPI, PNP: hook ACPI D-state to PNP suspend/resume

applied after Rafel's 'PM: Update global suspend and hibernation operations framework' patch set

commit fd4aff1a28eecbd729b409bf7d3eff5948f20414

Author: Shaohua Li <[email protected]>
Date:   Tue Jul 17 22:40:25 2007 +0200

ACPI: Add acpi_pm_device_sleep_state helper routine

Based on the David Brownell's patch at
http://marc.info/?l=linux-acpi&m=117873972806360&w=2
updated by: Rafael J. Wysocki <[email protected]>

Add a helper routine returning the lowest power (highest number) ACPI device power state that given device can be in while the system is in the sleep state indicated by acpi_target_sleep_state .

commit e9b3aba887f47f9cd64de20fec9c333a932b70dc

Author: Rafael J. Wysocki <[email protected]>
Date:   Tue Jul 17 22:40:06 2007 +0200

ACPI: Implement the set_target() callback from pm_ops

In the future some drivers may need to use ACPI to determine the low power states in which to place their devices, but to provide the drivers with this information the ACPI core needs to know what sleep state the system is going to enter. Namely, the device's state should not be too high power for given system sleep state and, if the device is supposed to be able to wake up the system, its state should not be too low power for the wake up to be possible). For this purpose, the ACPI core needs to implement the set_target() method in 'struct pm_ops' and store the target system sleep state passed by the PM core in a variable.

#1 lore raw
Quoted 2 lines · Len Brown

Len Brown (5):
ACPI: Kconfig: CONFIG_ACPI_PROCFS now defaults to N

Hi,

where can I find the information in /proc/acpi/battery and /proc/acpi/processor without procfs?

Regards,
Tino

Please CC: me in replies.

#3 lore raw
In reply to Len Brown
Quoted 7 lines · Len Brown

git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git release

Fixes regressions -- a build failure, an oops, some dmesg spam. Also fixes some D-state issues and adds ACPI module auto-loading. Yes, I'd hoped to get the last two in before rc1.
I'm hopeful that a couple-days into rc2 is sufficiently early for them.

I hate pulling this, but I did. However, what I hate even more after having done so is that ACPI now seems to select CPU hotplug. Why?

That is just *broken*. Sure, if you select STR or hibernation, we need CPU hotplug, but just for picking ACPI? Why?

Linus

author reviewer
#2 lore raw
In reply to Tino Keitel
Quoted 8 lines · Tino Keitel
Quoted 2 lines · Len Brown

Len Brown (5):
ACPI: Kconfig: CONFIG_ACPI_PROCFS now defaults to N

Hi,

where can I find the information in /proc/acpi/battery and /proc/acpi/processor without procfs?

CONFIG_ACPI_PROCFS applies only to the deprecated /proc files listed in the Kconfig help -- it doesn't apply (yet) to /proc/acpi/battery and /proc/acpi/processor

see the patch here:

http://marc.info/?l=linux-acpi&m=118534272010912&w=2

cheers,
-Len

author reviewer
#4 lore raw
In reply to Linus Torvalds
Quoted 1 line · Linus Torvalds

... ACPI now seems to select CPU hotplug. Why?

ACPI=y SMP=y systems require SUSPEND_SMP=y for system sleep support, and that requires HOTPLUG_CPU=y.

Note that ACPI=y SMP=n systems do not need it,
and thus will not select HOTPLUG_CPU=y

Quoted 2 lines

That is just *broken*. Sure, if you select STR or hibernation, we need CPU hotplug, but just for picking ACPI? Why?

My assumption is that if somebody selects CONFIG_ACPI, that 99% of the time, they intend that to include support for the ACPI hooks for system sleep states.

Conversely, supporting the 1% of people who don't want it isn't worth messing with the 99% who do, nor is the burden of yet another config option to maintain and #ifdefs in the code.

On UP, they'd get ACPI system sleep support 100% of the time by default, but on SMP this option had become problematic.

We used to have this:

if ACPI
...
config ACPI_SLEEP
bool "Sleep States"
depends on X86 && (!SMP || SUSPEND_SMP)
depends on PM
default y

So the poster-child failure was i386/defconfig itself... It couldn't support suspend to RAM because it didn't include CONFIG_ACPI_SLEEP. Not trivial for a user to select it when it doesn't even appear on the menu. It doesn't appear because CONFIG_SUSPEND_SMP isn't enabled, but that doesn't appear either -- because CONFIG_HOTPLUG_CPU isn't selected.

Most users don't want that.

So today we have this:

menuconfig ACPI

	...
        select HOTPLUG_CPU if X86 && SMP
        select SUSPEND_SMP if X86 && SMP

Which I think leads to fewer surprises, and less complicated code. (even though using select itself is fraught with peril:-)

thanks,
-Len

#5 lore raw
Quoted 13 lines · Len Brown
Quoted 1 line · Linus Torvalds

... ACPI now seems to select CPU hotplug. Why?

ACPI=y SMP=y systems require SUSPEND_SMP=y for system sleep support, and that requires HOTPLUG_CPU=y.

Note that ACPI=y SMP=n systems do not need it,
and thus will not select HOTPLUG_CPU=y

Quoted 2 lines

That is just *broken*. Sure, if you select STR or hibernation, we need CPU hotplug, but just for picking ACPI? Why?

Quoted 8 lines

My assumption is that if somebody selects CONFIG_ACPI, that 99% of the time, they intend that to include support for the ACPI hooks for system sleep states.

Conversely, supporting the 1% of people who don't want it isn't worth messing with the 99% who do, nor is the burden of yet another config option to maintain and #ifdefs in the code.

so you are saying that you know better then we do what we need?

some people configure ACPI only becouse their system won't work properly without it. they have no intention of ever doing a STR or hibernate.

David Lang

Quoted 13 lines

On UP, they'd get ACPI system sleep support 100% of the time by default, but on SMP this option had become problematic.

We used to have this:

if ACPI
...
config ACPI_SLEEP
bool "Sleep States"
depends on X86 && (!SMP || SUSPEND_SMP)
depends on PM
default y

Quoted 6 lines

So the poster-child failure was i386/defconfig itself... It couldn't support suspend to RAM because it didn't include CONFIG_ACPI_SLEEP. Not trivial for a user to select it when it doesn't even appear on the menu. It doesn't appear because CONFIG_SUSPEND_SMP isn't enabled, but that doesn't appear either -- because CONFIG_HOTPLUG_CPU isn't selected.

so have something like

config ACPI_SLEEP

        select HOTPLUG_CPU if X86 && SMP
        select SUSPEND_SMP if X86 && SMP

instead of makeing it dependant on ACPI.

David Lang

Quoted 21 lines

Most users don't want that.

So today we have this:

menuconfig ACPI

	...
       select HOTPLUG_CPU if X86 && SMP
       select SUSPEND_SMP if X86 && SMP

Which I think leads to fewer surprises, and less complicated code. (even though using select itself is fraught with peril:-)

thanks,

(quoted diff) +0 -2
-Len
 
-

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

author reviewer
#6 lore raw
Quoted 19 lines · On Wednesday 25 July 2007 22:20, [email protected] wrote:
Quoted 17 lines · Len Brown
Quoted 1 line · Linus Torvalds

... ACPI now seems to select CPU hotplug. Why?

ACPI=y SMP=y systems require SUSPEND_SMP=y for system sleep support, and that requires HOTPLUG_CPU=y.

Note that ACPI=y SMP=n systems do not need it,
and thus will not select HOTPLUG_CPU=y

Quoted 2 lines

That is just *broken*. Sure, if you select STR or hibernation, we need CPU hotplug, but just for picking ACPI? Why?

My assumption is that if somebody selects CONFIG_ACPI, that 99% of the time, they intend that to include support for the ACPI hooks for system sleep states.

Quoted 6 lines
Quoted 4 lines

Conversely, supporting the 1% of people who don't want it isn't worth messing with the 99% who do, nor is the burden of yet another config option to maintain and #ifdefs in the code.

so you are saying that you know better then we do what we need?

Feel free to share what you know about the benefits vs. the costs of maintaining CONFIG_ACPI_SLEEP as a build option.

Quoted 2 lines

some people configure ACPI only becouse their system won't work properly without it. they have no intention of ever doing a STR or hibernate.

I agree.

Further, I expect that 100% - (some people %) = 99%

If you feel that your system has been degraded because it now includes what used to be excluded under CONFIG_ACPI_SLEEP=n, please let me know how.

Quoted 20 lines
Quoted 13 lines

On UP, they'd get ACPI system sleep support 100% of the time by default, but on SMP this option had become problematic.

We used to have this:

if ACPI
...
config ACPI_SLEEP
bool "Sleep States"
depends on X86 && (!SMP || SUSPEND_SMP)
depends on PM
default y

Quoted 6 lines

So the poster-child failure was i386/defconfig itself... It couldn't support suspend to RAM because it didn't include CONFIG_ACPI_SLEEP. Not trivial for a user to select it when it doesn't even appear on the menu. It doesn't appear because CONFIG_SUSPEND_SMP isn't enabled, but that doesn't appear either -- because CONFIG_HOTPLUG_CPU isn't selected.

Quoted 7 lines

so have something like

config ACPI_SLEEP

         select HOTPLUG_CPU if X86 && SMP
         select SUSPEND_SMP if X86 && SMP

instead of makeing it dependant on ACPI.

If more config options where better, then this
would indeed be an improvement over 2.6.22.
But more config options isn't better -- except for "some people":-)

thanks.
-Len

Quoted 27 lines
Quoted 16 lines

Most users don't want that.

So today we have this:

menuconfig ACPI

	...
       select HOTPLUG_CPU if X86 && SMP
       select SUSPEND_SMP if X86 && SMP

Which I think leads to fewer surprises, and less complicated code. (even though using select itself is fraught with peril:-)

thanks,

(quoted diff) +0 -2
-Len
 
-
Quoted 5 lines

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#7 lore raw
Quoted 11 lines · Len Brown
Quoted 11 lines
Quoted 4 lines

CONFIG_ACPI_SLEEP. Not trivial for a user to select it when it doesn't even appear on the menu. It doesn't appear because CONFIG_SUSPEND_SMP isn't enabled, but that doesn't appear either -- because CONFIG_HOTPLUG_CPU isn't selected.

so have something like

config ACPI_SLEEP

         select HOTPLUG_CPU if X86 && SMP
         select SUSPEND_SMP if X86 && SMP
Quoted 5 lines
Quoted 1 line

instead of makeing it dependant on ACPI.

If more config options where better, then this
would indeed be an improvement over 2.6.22.
But more config options isn't better -- except for "some people":-)

coupling unrelated fetures togeather isn't better either.

David Lang

#8 lore raw
In reply to Len Brown
Quoted 3 lines · Len Brown

Feel free to share what you know about the benefits vs. the costs of maintaining CONFIG_ACPI_SLEEP as a build option.

Why don't you just make CONFIG_ACPI_SLEEP dependent on SOFTWARE_SUSPEND and STR?

Quoted 3 lines

If you feel that your system has been degraded because it now includes what used to be excluded under CONFIG_ACPI_SLEEP=n, please let me know how.

I feel that I get asked to include a feature that
(a) I have no interest in on that machine
(b) I didn't need to include before.

What was the advantage? And what was it that caused something like this to be a post-rc1 thing. That makes me really unhappy. This is a *regression*.

Linus

#96 lore raw
In reply to Len Brown
Quoted 6 lines · Len Brown
Quoted 1 line · Linus Torvalds

... ACPI now seems to select CPU hotplug. Why?

ACPI=y SMP=y systems require SUSPEND_SMP=y for system sleep support, and that requires HOTPLUG_CPU=y.

.. and why do you think I want system sleep support? That's the bug.

Quoted 2 lines

Note that ACPI=y SMP=n systems do not need it,
and thus will not select HOTPLUG_CPU=y

I want SMP, dammit. This machine has multi-core. And I want ACPI. I just don't want the system sleep thing.

I didn't have it before, I don't need it, I don't want it.

Quoted 3 lines

My assumption is that if somebody selects CONFIG_ACPI, that 99% of the time, they intend that to include support for the ACPI hooks for system sleep states.

That wasn't true before, and it makes no sense what-so-ever as an assumption.

The system sleep states are mostly usable on laptops. Not always even then. They are seldom used on desktops or servers, but both of those are often SMP machines, and certainly want ACPI.

So your "99%" makes no sense.

Quoted 6 lines

So today we have this:

menuconfig ACPI

	...
        select HOTPLUG_CPU if X86 && SMP
        select SUSPEND_SMP if X86 && SMP

But why the *hell* is this dependent on ACPI?

Why not just do ACPI_SLEEP, and have *that* do "select HOTPLUG_CPU/SUSPEND_CPU".

Quoted 1 line

Which I think leads to fewer surprises, and less complicated code.

That makes no sense. You're tying together things that have *nothing* to do with each other.

As mentioned (and as is *obvious*), pretty much everybody who has a multi-core CPU on x86 wants ACPI and SMP. But the set of people who want to sw-suspend such a machine is *much* smaller. There is no 99%.

Linus

#91 lore raw
In reply to Len Brown
Quoted 9 lines · Len Brown
Quoted 8 lines · On Wednesday 25 July 2007 22:20, [email protected] wrote:
Quoted 6 lines · Len Brown
Quoted 1 line · Linus Torvalds

... ACPI now seems to select CPU hotplug. Why?

ACPI=y SMP=y systems require SUSPEND_SMP=y for system sleep support, and that requires HOTPLUG_CPU=y.

Well *require* if I want SUSPEND*.

Quoted 21 lines
Quoted 9 lines
Quoted 9 lines

Note that ACPI=y SMP=n systems do not need it,
and thus will not select HOTPLUG_CPU=y

Quoted 2 lines

That is just *broken*. Sure, if you select STR or hibernation, we need CPU hotplug, but just for picking ACPI? Why?

My assumption is that if somebody selects CONFIG_ACPI, that 99% of the time, they intend that to include support for the ACPI hooks for system sleep states.

Quoted 5 lines
Quoted 4 lines

Conversely, supporting the 1% of people who don't want it isn't worth messing with the 99% who do, nor is the burden of yet another config option to maintain and #ifdefs in the code.

so you are saying that you know better then we do what we need?

Feel free to share what you know about the benefits vs. the costs of maintaining CONFIG_ACPI_SLEEP as a build option.

Quoted 2 lines

some people configure ACPI only becouse their system won't work properly without it. they have no intention of ever doing a STR or hibernate.

Quoted 7 lines

I agree.

Further, I expect that 100% - (some people %) = 99%

If you feel that your system has been degraded because it now includes what used to be excluded under CONFIG_ACPI_SLEEP=n, please let me know how.

Even if I want to SUSPEND* to <something> I can't on my Dell Precision 530 boxes , SCSI is broken with suspend therefore all these boxes have the whole SUSPEND* off, all I need is ACPI.

So why you think I want to have this all enabled by default now ? Just to bloat the kernel with something doesn't even work for me ?

And I don't get from where you have the '99%' thing ?

Quoted 26 lines
Quoted 26 lines
Quoted 14 lines

On UP, they'd get ACPI system sleep support 100% of the time by default, but on SMP this option had become problematic.

We used to have this:

if ACPI
...
config ACPI_SLEEP
bool "Sleep States"
depends on X86 && (!SMP || SUSPEND_SMP)
depends on PM
default y

Quoted 6 lines

So the poster-child failure was i386/defconfig itself... It couldn't support suspend to RAM because it didn't include CONFIG_ACPI_SLEEP. Not trivial for a user to select it when it doesn't even appear on the menu. It doesn't appear because CONFIG_SUSPEND_SMP isn't enabled, but that doesn't appear either -- because CONFIG_HOTPLUG_CPU isn't selected.

so have something like

config ACPI_SLEEP

         select HOTPLUG_CPU if X86 && SMP
         select SUSPEND_SMP if X86 && SMP
Quoted 5 lines
Quoted 1 line

instead of makeing it dependant on ACPI.

If more config options where better, then this
would indeed be an improvement over 2.6.22.
But more config options isn't better -- except for "some people":-)

But in this case some config / new config is better.

I do not need ACPI to SUSPEND but to make the box work properly.

Ohh and isn't better to make 'ACPI_PROCESSOR select SUSPEND_SMP and HOTPLUG_CPU if X86 && SMP' ?

...

config ACPI_PROCESSOR
tristate "Processor"
default y
help
This driver installs ACPI as the idle handler for Linux, and uses ACPI C2 and C3 processor states to save power, on systems that support it. It is required by several flavors of cpufreq Performance-state drivers.

...

Is more logical for me to do it here but I may be wrong.

Quoted 4 lines

thanks.
-Len

Gabriel

author reviewer
#9 lore raw
In reply to Linus Torvalds
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Len Brown

Feel free to share what you know about the benefits vs. the costs of maintaining CONFIG_ACPI_SLEEP as a build option.

Why don't you just make CONFIG_ACPI_SLEEP dependent on SOFTWARE_SUSPEND and STR?

CONFIG_STR doesn't exist.

I agree it is an attractive notion to have a high level feature presented to the user, and that the tools should select what is needed to satisfy the user's request. Unfortunately Kconfig is exceptionally bad at supporting this model. "depend" frustrates users by making config options vanish without explanation, and "select" is fundamentally broken because it doesn't enforce dependencies.

Quoted 10 lines
Quoted 3 lines

If you feel that your system has been degraded because it now includes what used to be excluded under CONFIG_ACPI_SLEEP=n, please let me know how.

I feel that I get asked to include a feature that
(a) I have no interest in on that machine
(b) I didn't need to include before.

What was the advantage? And what was it that caused something like this to be a post-rc1 thing. That makes me really unhappy. This is a *regression*.

I'm sorry that one fewer config options has offended your feeling of freedom, honestly, I am.

I was actually asking how somebody's _system_ has been degraded by this change -- but I haven't got an objective answer to that one yet.

As I said in my pull request, I agree that the D-state fixes ideally should have merged a week earlier -- before the rc1 cutoff. Indeed, we had a hack that could have gone up much earlier. However, we waited for Rafael's more general list-blessed solution -- and it turned out that solution tripped over CONFIG_ACPI_SLEEP=n.

The reason is because there is a dependency between D-states and S-states. In particular, devices which are enabled to be system wakeup devices can be limited in what D-states they can enter (else they may no longer be able to wake up the system when it is suspended)

I figured that rather than adding more ifdefs to solve that problem, it was simpler to remove ifdefs. I was also shocked to find i386 defconfig with CONFIG_ACPI_SLEEP=n. Maybe others are not shocked by this and there is a reason that defconfig on x86_64 supports sleep and i386 does not. I assumed it was a bug, maybe I was wrong.

The context for this is the EPA ENERGY STAR specification for Computers, which went into effect this month. This spec says that systems which can not automatically go into suspend within 15 minutes of idle can _not_ earn a sticker. No sticker, no client computer sales to governments. If Linux can't get STR working, broadly deployed, and enabled by default, then our plans for world domination are going to take a significant hit.

yes, I understand that there are SMP systems that want ACPI and don't need sleep or CONFIG_HOGPLUG_CPU. However, I don't see major distros shipping kernels to their server customers that way, so I didn't think it would offend a significant part of the community's sense of freedom if this config option were removed. Maybe I was wrong.

Obviously, your vote counts more than the sum total of a lot of the community, so if you want me to put a config option in to allow ACPI w/o ACPI_SLEEP, I'll simply do it for you. However, I could do a better job of it if I had a clear understanding of what the technical benefit of that option is supposed to be, and how it will make Linux better.

-Len

#10 lore raw
Quoted 3 lines · Len Brown

I was actually asking how somebody's _system_ has been degraded by this change -- but I haven't got an objective answer to that one yet.

According to that logic, we should always compile *everything* in.

Do you see the problem?

And can you realize that this should not have happened after -rc1?

So send me the patch to undo this breakage, and stop making excuses.

Linus

#11 lore raw
In reply to Len Brown
Quoted 13 lines · Len Brown
Quoted 11 lines · Linus Torvalds
Quoted 3 lines · Len Brown

If you feel that your system has been degraded because it now includes what used to be excluded under CONFIG_ACPI_SLEEP=n, please let me know how.

I feel that I get asked to include a feature that
(a) I have no interest in on that machine
(b) I didn't need to include before.

Quoted 8 lines
Quoted 2 lines

What was the advantage? And what was it that caused something like this to be a post-rc1 thing. That makes me really unhappy. This is a *regression*.

I'm sorry that one fewer config options has offended your feeling of freedom, honestly, I am.

I was actually asking how somebody's _system_ has been degraded by this change -- but I haven't got an objective answer to that one yet.

how about the fact that Linus found the problem becouse his system didn't work right?

Quoted 10 lines

As I said in my pull request, I agree that the D-state fixes ideally should have merged a week earlier -- before the rc1 cutoff. Indeed, we had a hack that could have gone up much earlier. However, we waited for Rafael's more general list-blessed solution -- and it turned out that solution tripped over CONFIG_ACPI_SLEEP=n.

The reason is because there is a dependency between D-states and S-states. In particular, devices which are enabled to be system wakeup devices can be limited in what D-states they can enter (else they may no longer be able to wake up the system when it is suspended)

you are assuming that people want to suspend

Quoted 6 lines

I figured that rather than adding more ifdefs to solve that problem, it was simpler to remove ifdefs. I was also shocked to find i386 defconfig with CONFIG_ACPI_SLEEP=n. Maybe others are not shocked by this and there is a reason that defconfig on x86_64 supports sleep and i386 does not. I assumed it was a bug, maybe I was wrong.

Quoted 6 lines

The context for this is the EPA ENERGY STAR specification for Computers, which went into effect this month. This spec says that systems which can not automatically go into suspend within 15 minutes of idle can _not_ earn a sticker. No sticker, no client computer sales to governments. If Linux can't get STR working, broadly deployed, and enabled by default, then our plans for world domination are going to take a significant hit.

isn't the sticker and specification for hardware? but in any case not all hardware needs to get that sticker.

Quoted 5 lines

yes, I understand that there are SMP systems that want ACPI and don't need sleep or CONFIG_HOGPLUG_CPU. However, I don't see major distros shipping kernels to their server customers that way, so I didn't think it would offend a significant part of the community's sense of freedom if this config option were removed. Maybe I was wrong.

distros aren't everything

Quoted 5 lines

Obviously, your vote counts more than the sum total of a lot of the community, so if you want me to put a config option in to allow ACPI w/o ACPI_SLEEP, I'll simply do it for you. However, I could do a better job of it if I had a clear understanding of what the technical benefit of that option is supposed to be, and how it will make Linux better.

the idea is that code that doesn't get compiled into the kernel can't cause the system to misbehave.

David Lang

author reviewer
#92 lore raw
In reply to Gabriel C
Quoted 7 lines · Gabriel C
Quoted 3 lines

If you feel that your system has been degraded because it now includes what used to be excluded under CONFIG_ACPI_SLEEP=n, please let me know how.

Even if I want to SUSPEND* to <something> I can't on my Dell Precision 530 boxes , SCSI is broken with suspend therefore all these boxes have the whole SUSPEND* off, all I need is ACPI.

Linux is already way behind the competition on both STR and STD. Disabling it because it doesn't work will makes this situation worse, not better.

Quoted 2 lines

So why you think I want to have this all enabled by default now ? Just to bloat the kernel with something doesn't even work for me ?

Can you be specific about how much additional "bloat" your system must endure with CONFIG_ACPI_SLEEP=y

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

config ACPI_SLEEP

         select HOTPLUG_CPU if X86 && SMP
         select SUSPEND_SMP if X86 && SMP

instead of makeing it dependant on ACPI.

Quoted 7 lines
Quoted 3 lines

If more config options where better, then this
would indeed be an improvement over 2.6.22.
But more config options isn't better -- except for "some people":-)

But in this case some config / new config is better.

I do not need ACPI to SUSPEND but to make the box work properly.

You also don't need a lot of other code in your kernel.

At some point the complexity of supporting more configuration options out-weights the benefits of having them. I have a pretty good idea of the cost of maintaining the code. So my question to you is is what, exactly, is the benefit of having 2.6.22 CONFIG_ACPI_SLEEP=y that is now lost in 2.6.23-git?

Quoted 13 lines

Ohh and isn't better to make 'ACPI_PROCESSOR select SUSPEND_SMP and HOTPLUG_CPU if X86 && SMP' ?

...

config ACPI_PROCESSOR
tristate "Processor"
default y
help
This driver installs ACPI as the idle handler for Linux, and uses ACPI C2 and C3 processor states to save power, on systems that support it. It is required by several flavors of cpufreq Performance-state drivers.

Quoted 3 lines

...

Is more logical for me to do it here but I may be wrong.

ACPI_PROCESSOR supports C-states and P-states and is not directly related to support for system sleep states. If your system is recent, then it is likely that you want to enable this (and cpufreq) to save power -- even if you are not interested in system-wide sleep states.

-Len

#12 lore raw
In reply to [email protected]
Quoted 3 lines · On Thu, 26 Jul 2007, [email protected] wrote:

how about the fact that Linus found the problem becouse his system didn't work right?

No, it works, it just forces me to use a configuration that I'm not personally interested in on that particular machine.

I tend to like using minimal kernels. I don't use modules on most of my machines, and I actually look over my config. Maybe I'm odd. But I think it's a good thing to let people decide what they want (and what they do _not_ want) in their kernels.

I think forcing people to use CPU_HOTPLUG is a mistake. There's a reason that existed as a config option. The ACPI changes basically mean that the whole CPU_HOTPLUG config option is totally pointless, because everybody is forced to have it.

Linus

#93 lore raw
In reply to Len Brown
Quoted 3 lines · Len Brown

Can you be specific about how much additional "bloat" your system must endure with CONFIG_ACPI_SLEEP=y

All of CONFIG_HOTPLUG_CPU.

Len, this is not about ACPI code. This is about CONFIG_HOTPLUG_CPU. Which I don't want. And which you forced on me.

Linus

author reviewer
#14 lore raw
In reply to [email protected]
Quoted 6 lines
Quoted 3 lines

I was actually asking how somebody's _system_ has been degraded by this change -- but I haven't got an objective answer to that one yet.

how about the fact that Linus found the problem becouse his system didn't work right?

I guess I missed that message. What system didn't work right, and how did it fail?

Quoted 9 lines
Quoted 6 lines

The context for this is the EPA ENERGY STAR specification for Computers, which went into effect this month. This spec says that systems which can not automatically go into suspend within 15 minutes of idle can _not_ earn a sticker. No sticker, no client computer sales to governments. If Linux can't get STR working, broadly deployed, and enabled by default, then our plans for world domination are going to take a significant hit.

isn't the sticker and specification for hardware? but in any case not all hardware needs to get that sticker.

No, the sticker is for the entire system (HW+SW) as shipped to the customer. ie. It is possible for the same hardware solution running Windows to earn a sticker and land a sale, while Linux fails to earn a sticker and loses the contract.

You're right, not all systems need to earn the sticker. Indeed, ENERGY STAR is supposed to be a "premium" brand. However, several governments disqualify bids for large contracts if they do not meet ENERGY STAR.

Quoted 7 lines
Quoted 5 lines

yes, I understand that there are SMP systems that want ACPI and don't need sleep or CONFIG_HOGPLUG_CPU. However, I don't see major distros shipping kernels to their server customers that way, so I didn't think it would offend a significant part of the community's sense of freedom if this config option were removed. Maybe I was wrong.

distros aren't everything

Apparently a market for more config options of is alive and well. Thank you for helping make the future of Linux more clear to me.

-Len

#13 lore raw
In reply to Linus Torvalds
Quoted 10 lines · Linus Torvalds
Quoted 2 lines · On Thu, 26 Jul 2007, [email protected] wrote:

how about the fact that Linus found the problem becouse his system didn't work right?

No, it works, it just forces me to use a configuration that I'm not personally interested in on that particular machine.

I tend to like using minimal kernels. I don't use modules on most of my machines, and I actually look over my config. Maybe I'm odd. But I think it's a good thing to let people decide what they want (and what they do _not_ want) in their kernels.

I think forcing people to use CPU_HOTPLUG is a mistake. There's a reason that existed as a config option. The ACPI changes basically mean that the whole CPU_HOTPLUG config option is totally pointless, because everybody is forced to have it.

Indeed -- forced to have a feature that is applicable in reality to 0.00000001% of the user population, I'd wager :)

I read and hone my .config to utter minimalist perfection too :) So count my vote here too, for -not- wanting CPU_HOTPLUG dead code in my kernel.

Jeff

#94 lore raw
In reply to Len Brown
Quoted 5 lines · Len Brown
Quoted 3 lines · Gabriel C
Quoted 3 lines

If you feel that your system has been degraded because it now includes what used to be excluded under CONFIG_ACPI_SLEEP=n, please let me know how.

Quoted 7 lines
Quoted 3 lines

Even if I want to SUSPEND* to <something> I can't on my Dell Precision 530 boxes , SCSI is broken with suspend therefore all these boxes have the whole SUSPEND* off, all I need is ACPI.

Linux is already way behind the competition on both STR and STD. Disabling it because it doesn't work will makes this situation worse, not better.

Heh what else can I do ? The _bug_(s) are reporter for ages.

See this one as example ( this kills all my Dells ) and there are a lot more reported.

http://bugzilla.kernel.org/show_bug.cgi?id=3062

...

Description From Nathan Bryant 2004-07-13 18:14

...

Notice '2004' and still no one really cares ..
So all I can do for now is to disable it.

Quoted 6 lines
Quoted 3 lines

So why you think I want to have this all enabled by default now ? Just to bloat the kernel with something doesn't even work for me ?

Can you be specific about how much additional "bloat" your system must endure with CONFIG_ACPI_SLEEP=y

At least I was not forced to use HOTPLUG_CPU ..

Really I just enable what I need / works on my box(es).

Quoted 34 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

config ACPI_SLEEP

         select HOTPLUG_CPU if X86 && SMP
         select SUSPEND_SMP if X86 && SMP
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

instead of makeing it dependant on ACPI.

If more config options where better, then this
would indeed be an improvement over 2.6.22.
But more config options isn't better -- except for "some people":-)

But in this case some config / new config is better.

I do not need ACPI to SUSPEND but to make the box work properly.

You also don't need a lot of other code in your kernel.

At some point the complexity of supporting more configuration options out-weights the benefits of having them. I have a pretty good idea of the cost of maintaining the code. So my question to you is is what, exactly, is the benefit of having 2.6.22 CONFIG_ACPI_SLEEP=y that is now lost in 2.6.23-git?

Quoted 13 lines

Ohh and isn't better to make 'ACPI_PROCESSOR select SUSPEND_SMP and HOTPLUG_CPU if X86 && SMP' ?

...

config ACPI_PROCESSOR
tristate "Processor"
default y
help
This driver installs ACPI as the idle handler for Linux, and uses ACPI C2 and C3 processor states to save power, on systems that support it. It is required by several flavors of cpufreq Performance-state drivers.

Quoted 8 lines
Quoted 3 lines

...

Is more logical for me to do it here but I may be wrong.

ACPI_PROCESSOR supports C-states and P-states and is not directly related to support for system sleep states. If your system is recent, then it is likely that you want to enable this (and cpufreq) to save power -- even if you are not interested in system-wide sleep states.

Oh ok.

Well then add a dummy config onpion, ACPI_DESKTOP_SUSPEND or something , move the 2 selects to there , make it visible in the menu and make it even default y but that way one can disable it.

You have a config option more even you hate that =) but no #ifdef's in code.

Quoted 3 lines

-Len

Gabriel

#95 lore raw

Re: defconfig , ACPI=n compile error

In reply to Len Brown
Quoted 10 lines
Quoted 10 lines

config ACPI_PROCESSOR
tristate "Processor"
default y
help
This driver installs ACPI as the idle handler for Linux, and uses ACPI C2 and C3 processor states to save power, on systems that support it. It is required by several flavors of cpufreq Performance-state drivers.

Quoted 8 lines
Quoted 3 lines

...

Is more logical for me to do it here but I may be wrong.

ACPI_PROCESSOR supports C-states and P-states and is not directly related to support for system sleep states. If your system is recent, then it is likely that you want to enable this (and cpufreq) to save power -- even if you are not interested in system-wide sleep states.

Btw nothing about HOTPLUG_CPU now but something is broken.

do a defconfig , make menuconfig , disable ACPI , make , and you get :

...

In file included from arch/i386/kernel/acpi/cstate.c:16:
include/acpi/processor.h:90: error: expected specifier-qualifier-list before 'acpi_integer' include/acpi/processor.h:108: error: expected specifier-qualifier-list before 'acpi_integer' include/acpi/processor.h:131: error: expected specifier-qualifier-list before 'acpi_integer' include/acpi/processor.h:149: error: expected specifier-qualifier-list before 'acpi_integer' include/acpi/processor.h:205: error: expected specifier-qualifier-list before 'acpi_handle' include/acpi/processor.h:319: warning: 'struct acpi_device' declared inside parameter list include/acpi/processor.h:319: warning: its scope is only this definition or declaration, which is probably not what you want include/acpi/processor.h:322: warning: 'struct acpi_device' declared inside parameter list
make[2]: *** [arch/i386/kernel/acpi/cstate.o] Error 1
make[1]: *** [arch/i386/kernel/acpi] Error 2

...

$ grep ACPI .config
# Power management options (ACPI, APM)
# CONFIG_ACPI is not set
CONFIG_ACPI_PROCESSOR=y
CONFIG_X86_ACPI_CPUFREQ=y
CONFIG_X86_POWERNOW_K8_ACPI=y
CONFIG_X86_ACPI_CPUFREQ_PROC_INTF=y

Looks like CONFIG_X86_POWERNOW_K8_ACPI selects only ACPI_PROCESSOR , guessing it should depend on ACPI ?

Quoted 3 lines

-Len

Gabriel

#15 lore raw

CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)

In reply to Len Brown
Quoted 11 lines · Len Brown
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Len Brown

Feel free to share what you know about the benefits vs. the costs of maintaining CONFIG_ACPI_SLEEP as a build option.

Why don't you just make CONFIG_ACPI_SLEEP dependent on SOFTWARE_SUSPEND and STR?

CONFIG_STR doesn't exist.

Hmm, perhaps we should introduce a CONFIG_SUSPEND and change CONFIG_SOFTWARE_SUSPEND into CONFIG_HIBERNATION, both depending on CONFIG_PM?

There's quite some code needed only for suspend compiled in when CONFIG_PM is set ...

Greetings,
Rafael

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

Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)

Quoted 7 lines · Rafael J. Wysocki

Hmm, perhaps we should introduce a CONFIG_SUSPEND and change CONFIG_SOFTWARE_SUSPEND into CONFIG_HIBERNATION, both depending on CONFIG_PM?

There's quite some code needed only for suspend compiled in when CONFIG_PM is set ...

Sounds like a good idea, although I suspect that CONFIG_PM really *is* fairly close to CONFIG_SUSPEND. The thing is, all the stuff it enabled is largely useless without at least STR.

(Yes, I realize that you can do per-driver suspend events etc, but I suspect not a lot of people have used it).

But from a logical standpoint, it does make sense to have a separate config option for the STR support.

Linus

#17 lore raw

Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)

Quoted 7 lines · Linus Torvalds
Quoted 5 lines · Rafael J. Wysocki

Hmm, perhaps we should introduce a CONFIG_SUSPEND and change CONFIG_SOFTWARE_SUSPEND into CONFIG_HIBERNATION, both depending on CONFIG_PM?

Quoted 6 lines
Quoted 2 lines

There's quite some code needed only for suspend compiled in when CONFIG_PM is set ...

Sounds like a good idea, although I suspect that CONFIG_PM really *is* fairly close to CONFIG_SUSPEND. The thing is, all the stuff it enabled is largely useless without at least STR.

My point is we have ACPI dependent on PM, so if you want ACPI, you end up with all of the STR stuff built in, which is what you don't like (if I understand that correctly). If we have CONFIG_SUSPEND, you'll be able to choose ACPI alone. :-)

Quoted 5 lines

(Yes, I realize that you can do per-driver suspend events etc, but I suspect not a lot of people have used it).

But from a logical standpoint, it does make sense to have a separate config option for the STR support.

Exactly.

Greetings,
Rafael

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

Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)

Quoted 5 lines · Rafael J. Wysocki

My point is we have ACPI dependent on PM, so if you want ACPI, you end up with all of the STR stuff built in, which is what you don't like (if I understand that correctly). If we have CONFIG_SUSPEND, you'll be able to choose ACPI alone. :-)

Good point.

Anyway, I think the ACPI problem really is as trivial as the following three-liner removal fix. If the user doesn't want suspend, ACPI shouldn't force it on him.

A nicer fix might be to also make some of the ACPI helper routines depend on whether they are needed or not (which in turn will depend on whether suspend support has been compiled into the kernel), but quite frankly, that's secondary at least for me.

So if we have a few ACPI routines that will never get called (because we don't even enable the interfaces that would *cause* them to be called), I don't think that's a huge problem. It's a beauty wart, but nobody really cares (and it's even something that we could get the compiler to optimize away for us if we really cared).

Linus

---
Don't force-enable suspend/hibernate support just for ACPI

It's a totally independent decision for the user whether he wants suspend and/or hibernation support, and ACPI shouldn't care.

---
 drivers/acpi/Kconfig |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/acpi/Kconfig +0 -3
index 251344c..22b401b 100644
@@ -11,9 +11,6 @@ menuconfig ACPI
 	depends on PCI
 	depends on PM
 	select PNP
-	# for sleep
-	select HOTPLUG_CPU if X86 && SMP
-	select SUSPEND_SMP if X86 && SMP
 	default y
 	---help---
 	  Advanced Configuration and Power Interface (ACPI) support for 
#97 lore raw
In reply to Len Brown
Quoted 5 lines · Len Brown

Hi Linus,

please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git release

This seems to break ia64 defconfig:

Building modules, stage 2.
MODPOST 157 modules
FATAL: drivers/acpi/button: sizeof(struct acpi_device_id)=20 is not a modulo of the size of section __mod_acpi_device_table=144. Fix definition of struct acpi_device_id in mod_devicetable.h
make[2]: *** [__modpost] Error 1
make[1]: *** [modules] Error 2
make: *** [_all] Error 2

gcc 3.3.6, binutils 2.15.94

http://l4x.org/k/?d=32569

Jan

#98 lore raw
Quoted 17 lines · Jan Dittmer
Quoted 5 lines · Len Brown

Hi Linus,

please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git release

This seems to break ia64 defconfig:

Building modules, stage 2.
MODPOST 157 modules
FATAL: drivers/acpi/button: sizeof(struct acpi_device_id)=20 is not a modulo of the size of section __mod_acpi_device_table=144. Fix definition of struct acpi_device_id in mod_devicetable.h
make[2]: *** [__modpost] Error 1
make[1]: *** [modules] Error 2
make: *** [_all] Error 2

Quoted 3 lines

gcc 3.3.6, binutils 2.15.94

http://l4x.org/k/?d=32569

This is strange, I just compiled on a IA64 with button as module (defconfig), but with gcc version 4.1.2, all is fine. Anyone an idea how to run into that?

I won't be able to detailed debug this before Monday, but be sure I will do so then.

Thanks,

Thomas

#19 lore raw

PATCH 1/1 let SUSPEND select HOTPLUG_CPU

In reply to Linus Torvalds
Quoted 44 lines · Linus Torvalds
Quoted 5 lines · Rafael J. Wysocki

My point is we have ACPI dependent on PM, so if you want ACPI, you end up with all of the STR stuff built in, which is what you don't like (if I understand that correctly). If we have CONFIG_SUSPEND, you'll be able to choose ACPI alone. :-)

Good point.

Anyway, I think the ACPI problem really is as trivial as the following three-liner removal fix. If the user doesn't want suspend, ACPI shouldn't force it on him.

A nicer fix might be to also make some of the ACPI helper routines depend on whether they are needed or not (which in turn will depend on whether suspend support has been compiled into the kernel), but quite frankly, that's secondary at least for me.

So if we have a few ACPI routines that will never get called (because we don't even enable the interfaces that would *cause* them to be called), I don't think that's a huge problem. It's a beauty wart, but nobody really cares (and it's even something that we could get the compiler to optimize away for us if we really cared).

Linus

---
Don't force-enable suspend/hibernate support just for ACPI

It's a totally independent decision for the user whether he wants suspend and/or hibernation support, and ACPI shouldn't care.

---
 drivers/acpi/Kconfig |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/acpi/Kconfig +0 -0
index 251344c..22b401b 100644

drivers/acpi/Kconfig menuconfig ACPI · line 16

Quoted 9 lines
drivers/acpi/Kconfig +0 -3
@@ -11,9 +11,6 @@ menuconfig ACPI
 	depends on PCI
 	depends on PM
 	select PNP
-	# for sleep
-	select HOTPLUG_CPU if X86 && SMP
-	select SUSPEND_SMP if X86 && SMP
 	default y
 	---help---
 	  Advanced Configuration and Power Interface (ACPI) support for 

The dependency of SUSPEND_SMP on HOTPLUG_CPU is quite unintuitive, so what about something like the patch below?

This should address a main issue behind Len's patch.

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 changes SOFTWARE_SUSPEND if SMP to select HOTPLUG_CPU instead of depending on it.

---

 kernel/power/Kconfig |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
kernel/power/Kconfig +14 -6
@@ -72,9 +72,22 @@ 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_SMP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+	depends on SMP
+	default y
+
+config SUSPEND_SMP
+	bool
+	depends on SUSPEND_SMP_POSSIBLE && SOFTWARE_SUSPEND
+	select HOTPLUG_CPU
+	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 ((X86 || PPC64_SWSUSP || FRV || PPC32) && !SMP) || SUSPEND_SMP_POSSIBLE
 	---help---
 	  Enable the suspend to disk (STD) functionality, which is usually
 	  called "hibernation" in user interfaces.  STD checkpoints the
@@ -132,11 +145,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
#20 lore raw

Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU

Quoted 1 line · Adrian Bunk

The dependency of SUSPEND_SMP on HOTPLUG_CPU is quite unintuitive,

It's not entirely unintuitive. That option's full name is "Support for suspend on SMP and hot-pluggable CPUs".

Only the place where you find the option is unintuitive, as far as its first application is concerned. (It lives in the "Processor type and features" menu which is OK for the 2nd application of this option.) And the variable name of that option is unintuitive because it covers only the 2nd application of the option, I suppose for historical reasons.

kernel/power/Kconfig config PM_TRACE · line 85

Quoted 11 lines
kernel/power/Kconfig +11 -0
+config SUSPEND_SMP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+	depends on SMP
+	default y
+
+config SUSPEND_SMP
+	bool
+	depends on SUSPEND_SMP_POSSIBLE && SOFTWARE_SUSPEND
+	select HOTPLUG_CPU
+	default y

Yes, that's the price to pay if you want to select something that in turn depends on a number of other things.

Wait, doesn't HOTPLUG_CPU also depend on EXPERIMENTAL?

Signature · 3 lines
Stefan Richter
-=====-=-=== -=== ===--
http://arcgraph.de/sr/
#25 lore raw

Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU

In reply to Adrian Bunk
Quoted 3 lines · Adrian Bunk

The dependency of SUSPEND_SMP on HOTPLUG_CPU is quite unintuitive, so what about something like the patch below?

Yeah, this looks reasonable.

May I suggest another level of indirection, though:

kernel/power/Kconfig config PM_TRACE · line 79

Quoted 5 lines
kernel/power/Kconfig +5 -0
+config SUSPEND_SMP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+	depends on SMP
+	default y

How about making this a bit more split up, and do it as

	# SMP suspend is possible on ..
	config SUSPEND_SMP_POSSIBLE
		bool
		depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
		default y

	# UP suspend is possible on ..
	config SUSPEND_UP_POSSIBLE
		bool
		depends on X86 || PPC64_SWSUSP || FRV || PPC32
		default y 

	# Can we suspend?
	config SUSPEND_POSSIBLE
		bool
		depends on (SMP && SUSPEND_SMP_POSSIBLE) || (SUSPEND_UP_POSSIBLE && !SMP)
		default y

and then we have just a

	config SOFTWARE_SUSPEND
		bool "Software Suspend (Hibernation)"
		depends on PM && SWAP
		depends on SUSPEND_POSSIBLE

	config SUSPEND_SMP
		bool
		depends on SOFTWARE_SUSPEND && SMP
		select HOTPLUG_CPU
		default y

and now each of the config options looks pretty simple and describe one thing.

[ For extra bonus points: the SUSPEND_POSSIBLE thing is still pretty
complicated, and it might actually be a better idea to make it a per-arch config option, and just make the x86/arch say

	config SUSPEND_POSSIBLE
		bool
		depends on !(X86_VOYAGER && SMP)
		default y

instead: since SUSPEND_POSSIBLE is always true on x86 regardless of SMP or not, just not on X86_VOYAGER. Then, each architecture can have its own private rules for whether that architecture has SUSPEND_POSSIBLE or not, so on ppc, it might look like

	config SUSPEND_POSSIBLE
		bool
		depends on (PPC64 && (PPC_PSERIES || PPC_PMAC)) || PPC_SWSUSP
		bool y

or something, but the point is, now the complexity is a per-architecture thing, so other architectures simply don't have to care any more! ]

And the user only ever sees one single question: the one for "SOFTWARE_SUSPEND". All the others would directly flow either from the architecture choice, or from that.

Anybody willing to rewrite it that way?

Linus

#21 lore raw

Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU

In reply to Stefan Richter
Quoted 11 lines · Stefan Richter
Quoted 1 line · Adrian Bunk

The dependency of SUSPEND_SMP on HOTPLUG_CPU is quite unintuitive,

It's not entirely unintuitive. That option's full name is "Support for suspend on SMP and hot-pluggable CPUs".

Only the place where you find the option is unintuitive, as far as its first application is concerned. (It lives in the "Processor type and features" menu which is OK for the 2nd application of this option.) And the variable name of that option is unintuitive because it covers only the 2nd application of the option, I suppose for historical reasons.

We can figure out ourselves when HOTPLUG_CPU is required, so there's no reason to bother the user with it.

Quoted 6 lines
Quoted 6 lines
kernel/power/Kconfig +6 -0
+config SUSPEND_SMP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+	depends on SMP
+	default y
+
Quoted 8 lines

kernel/power/Kconfig config PM_TRACE · line 85

Quoted 5 lines
kernel/power/Kconfig +5 -0
+config SUSPEND_SMP
+	bool
+	depends on SUSPEND_SMP_POSSIBLE && SOFTWARE_SUSPEND
+	select HOTPLUG_CPU
+	default y

Yes, that's the price to pay if you want to select something that in turn depends on a number of other things.

Yes, but a good user interface is worth it.

Quoted 1 line

Wait, doesn't HOTPLUG_CPU also depend on EXPERIMENTAL?

Damn, I started thinking about it, and then forgot about it when finishing the patch.

My thoughts were:
Is HOTPLUG_CPU still an experimental feature, or has it become a well-tested no longer experimental feature now that it's used on most recent laptops?

Quoted 1 line

Stefan Richter

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#99 lore raw
In reply to Thomas Renninger
Quoted 18 lines · Thomas Renninger
Quoted 17 lines · Jan Dittmer
Quoted 5 lines · Len Brown

Hi Linus,

please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git release

This seems to break ia64 defconfig:

Building modules, stage 2.
MODPOST 157 modules
FATAL: drivers/acpi/button: sizeof(struct acpi_device_id)=20 is not a modulo of the size of section __mod_acpi_device_table=144. Fix definition of struct acpi_device_id in mod_devicetable.h
make[2]: *** [__modpost] Error 1
make[1]: *** [modules] Error 2
make: *** [_all] Error 2

Quoted 7 lines
Quoted 3 lines

gcc 3.3.6, binutils 2.15.94

http://l4x.org/k/?d=32569

This is strange, I just compiled on a IA64 with button as module (defconfig), but with gcc version 4.1.2, all is fine. Anyone an idea how to run into that?

I don't have an idea how this happens, but it sounds like an alignment issue:

sizeof(struct acpi_device_id)=20
"struct acpi_device_id button_device_ids[]" contains 6 elements 144 = 6 * 24 = 6 * (3 * 8)

So it seems on ia64 with gcc 3.3.6 there's some 8 byte alignment of the array members?

Sam and the ia64 maintainers Cc'ed - they might know better what's going on here.

Quoted 6 lines

I won't be able to detailed debug this before Monday, but be sure I will do so then.

Thanks,

Thomas

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#100 lore raw
Quoted 4 lines · Adrian Bunk

I don't have an idea how this happens, but it sounds like an alignment issue:

sizeof(struct acpi_device_id)=20

This is wrong. The structure has 24 bytes (including 7(!) bytes of padding).

Andreas.

Signature · 8 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#116 lore raw
In reply to Jan Dittmer
Quoted 5 lines · Jan Dittmer
Quoted 4 lines · Len Brown

Hi Linus,

please pull from:

Quoted 7 lines
Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git release

This seems to break ia64 defconfig:

Building modules, stage 2.
MODPOST 157 modules
FATAL: drivers/acpi/button: sizeof(struct acpi_device_id)=20 is not a modulo of the size of section __mod_acpi_device_table=144.

Are you cross-compiling? The definition of kernel_ulong_t won't work on x86.

Andreas.

Signature · 8 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#102 lore raw

scripts/mod/file2alias.c cross compile problem

In reply to a message not in the archive
Quoted 8 lines · Tony
Quoted 5 lines

So it seems on ia64 with gcc 3.3.6 there's some 8 byte alignment of the array members?

Sam and the ia64 maintainers Cc'ed - they might know better what's going on here.

This ia64 maintainer is baffled ... but I don't see the problem here (perhaps because my build machine has gcc 3.4.6).

I found what causes this problem, and it only occurs during cross compilation.

The struct is:

#define ACPI_ID_LEN 9

struct acpi_device_id {
	 __u8 id[ACPI_ID_LEN];
	kernel_ulong_t driver_data;
};

When compiling for ia64, this results in:

struct acpi_device_id {
	__u8 id[9];
	uint64_t driver_data;
};

sizeof(struct acpi_device_id) for ia64 is due to different padding after id[] 20 bytes on i386 but 24 bytes on ia64.

scripts/mod/file2alias.c is compiled with HOSTCC and ensures that kernel_ulong_t is correct (in this case uint64_t for ia64), but it can't cope with different padding on different architectures.

Quoted 1 line

-Tony

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#26 lore raw

PATCH 1/1 SOFTWARE_SUSPEND: handle HOTPLUG_CPU automatically

In reply to Linus Torvalds
Quoted 19 lines · Linus Torvalds
Quoted 3 lines · Adrian Bunk

The dependency of SUSPEND_SMP on HOTPLUG_CPU is quite unintuitive, so what about something like the patch below?

Yeah, this looks reasonable.

May I suggest another level of indirection, though:

Review

Quoted 5 lines
(quoted diff) +5 -0
+config SUSPEND_SMP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+	depends on SMP
+	default y

How about making this a bit more split up, and do it as

Quoted 11 lines
	# SMP suspend is possible on ..
	config SUSPEND_SMP_POSSIBLE
		bool
		depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
		default y

	# UP suspend is possible on ..
	config SUSPEND_UP_POSSIBLE
		bool
		depends on X86 || PPC64_SWSUSP || FRV || PPC32
		default y 

Sounds good.

Quoted 5 lines
	# Can we suspend?
	config SUSPEND_POSSIBLE
		bool
		depends on (SMP && SUSPEND_SMP_POSSIBLE) || (SUSPEND_UP_POSSIBLE && !SMP)
		default y

IMHO not required:

config SOFTWARE_SUSPEND

	bool "Software Suspend (Hibernation)"
	depends on PM && SWAP
	depends on SUSPEND_UP_POSSIBLE || SUSPEND_SMP_POSSIBLE
Quoted 16 lines

and then we have just a

	config SOFTWARE_SUSPEND
		bool "Software Suspend (Hibernation)"
		depends on PM && SWAP
		depends on SUSPEND_POSSIBLE

	config SUSPEND_SMP
		bool
		depends on SOFTWARE_SUSPEND && SMP
		select HOTPLUG_CPU
		default y

and now each of the config options looks pretty simple and describe one thing.

Quoted 8 lines

[ For extra bonus points: the SUSPEND_POSSIBLE thing is still pretty
complicated, and it might actually be a better idea to make it a per-arch config option, and just make the x86/arch say

	config SUSPEND_POSSIBLE
		bool
		depends on !(X86_VOYAGER && SMP)
		default y

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.)

Quoted 10 lines

instead: since SUSPEND_POSSIBLE is always true on x86 regardless of SMP or not, just not on X86_VOYAGER. Then, each architecture can have its own private rules for whether that architecture has SUSPEND_POSSIBLE or not, so on ppc, it might look like

	config SUSPEND_POSSIBLE
		bool
		depends on (PPC64 && (PPC_PSERIES || PPC_PMAC)) || PPC_SWSUSP
		bool y
Quoted 8 lines

or something, but the point is, now the complexity is a per-architecture thing, so other architectures simply don't have to care any more! ]

And the user only ever sees one single question: the one for "SOFTWARE_SUSPEND". All the others would directly flow either from the architecture choice, or from that.

Anybody willing to rewrite it that way?

Patch below.

Quoted 1 line

Linus

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.

---

 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 <[email protected]>
Date:   Sat Jul 28 06:47:03 2007 +0200

asdf

arch/i386/Kconfig +11 -5
index abb582b..eb00a12 100644
@@ -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"
arch/powerpc/Kconfig +9 -2
index 00099ef..950be0b 100644
@@ -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.
arch/x86_64/Kconfig +12 -7
index 45f82ae..810ed4b 100644
@@ -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
kernel/power/Kconfig +17 -6
index c1a106d..c7f74ba 100644
@@ -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
author reviewer
#29 lore raw

Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)

In reply to Linus Torvalds
Quoted 3 lines · Linus Torvalds

Anyway, I think the ACPI problem really is as trivial as the following three-liner removal fix. If the user doesn't want suspend, ACPI shouldn't force it on him.

...

drivers/acpi/Kconfig menuconfig ACPI · line 16

Quoted 3 lines
drivers/acpi/Kconfig +0 -3
-	# for sleep
-	select HOTPLUG_CPU if X86 && SMP
-	select SUSPEND_SMP if X86 && SMP

That three-liner will crash ACPI+SMP-HOTPLUG_CPU kernels on resume. While cpu0 is in a known state when the power goes out, without HOTPLUG_CPU the other cpus (and the memory they touch) are in an indeterminate state.

Yes, we could invent a new mechanism to offline the other CPUS
before suspend and online them upon resume,
but that is what the more general HOTPLUG_CPU code does for us already. Indeed, that is pretty much _all_ that HOTPLUG_CPU code does on X86 -- as we don't have any physical hotplug support today beneath
this the logical hotplug support -- you could call it CONFIG_CPU_OFFLINE_ONLINE...

Quoted 10 lines

A nicer fix might be to also make some of the ACPI helper routines depend on whether they are needed or not (which in turn will depend on whether suspend support has been compiled into the kernel), but quite frankly, that's secondary at least for me.

So if we have a few ACPI routines that will never get called (because we don't even enable the interfaces that would *cause* them to be called), I don't think that's a huge problem. It's a beauty wart, but nobody really cares (and it's even something that we could get the compiler to optimize away for us if we really cared).

Re: warts, I agree.
My question is why the HOTPLUG_CPU=y code is any different. When I compile HOTPLUG_CPU out of an x86_64 kernel, the kernel shrinks by only 18KB, which on a kernel that has ACPI+SMP doesn't seem like such a big wart.

Yes, now that you brought it up, I think it would be just dandy if HOTPLUG_CPU simply got folded into SMP -- for I see little to no benefit to having it as its own config option.

But on the assumption that you are not swayed (when was the last time you were?) and you still feel strongly we should be able to exclude ACPI_SLEEP and HOTPLUG_CPU from ACPI+SMP kernels, I'll send you a patch do to that properly.
It will largely restores things to how we had them in 2.6.22.
It looks like a step backwards to me, but you may see it differently.

-Len

author reviewer
#30 lore raw

PATCH 1/1 ACPI: restore CONFIG_ACPI_SLEEP

From: Len Brown <[email protected]>

Restore the 2.6.22 CONFIG_ACPI_SLEEP build option, with a few differences:
1. selects HOTPLUG_CPU rather than depends on HOTPLUG_CPU.
2. ACPI_SLEEP can be enabled on IA64

Disabling this option shrinks the kernel by 16KB.

Disabling this option on SMP allows the user to
deselect HOTPLUG_CPU and save an addition 18KB.

---
 arch/i386/kernel/acpi/Makefile   |    2 +-
 arch/i386/kernel/setup.c         |    2 +-
 arch/x86_64/kernel/acpi/Makefile |    2 +-
 arch/x86_64/kernel/head.S        |    2 +-
 arch/x86_64/kernel/setup.c       |    2 +-
 drivers/acpi/Kconfig             |   17 +++++++++++++++++
 drivers/acpi/sleep/Makefile      |    4 ++--
 drivers/acpi/sleep/poweroff.c    |    2 ++
 drivers/acpi/sleep/proc.c        |    2 +-
 drivers/pci/pci-acpi.c           |    4 ++++
 drivers/pnp/pnpacpi/core.c       |    4 ++++
 include/acpi/acpi_drivers.h      |    4 ++++
 kernel/sysctl.c                  |    2 +-
 13 files changed, 40 insertions(+), 9 deletions(-)
arch/i386/kernel/acpi/Makefile +1 -1
index 223f58f..7f7be01 100644
@@ -2,7 +2,7 @@ obj-$(CONFIG_ACPI)		+= boot.o
 ifneq ($(CONFIG_PCI),)
 obj-$(CONFIG_X86_IO_APIC)	+= earlyquirk.o
 endif
-obj-$(CONFIG_ACPI)		+= sleep.o wakeup.o
+obj-$(CONFIG_ACPI_SLEEP)	+= sleep.o wakeup.o
 
 ifneq ($(CONFIG_ACPI_PROCESSOR),)
 obj-y				+= cstate.o processor.o
arch/i386/kernel/setup.c +1 -1
index 7fe5da3..d474cd6 100644
@@ -422,7 +422,7 @@ void __init setup_bootmem_allocator(void)
 	 */
 	reserve_bootmem(PAGE_SIZE, PAGE_SIZE);
 #endif
-#ifdef CONFIG_ACPI
+#ifdef CONFIG_ACPI_SLEEP
 	/*
 	 * Reserve low memory region for sleep support.
 	 */
arch/x86_64/kernel/acpi/Makefile +1 -1
index 17595d2..080b996 100644
@@ -1,6 +1,6 @@
 obj-y			:= boot.o
 boot-y			:= ../../../i386/kernel/acpi/boot.o
-obj-y			+= sleep.o wakeup.o
+obj-$(CONFIG_ACPI_SLEEP)	+= sleep.o wakeup.o
 
 ifneq ($(CONFIG_ACPI_PROCESSOR),)
 obj-y			+= processor.o
arch/x86_64/kernel/head.S +1 -1
index 3a16e41..e89abcd 100644
@@ -120,7 +120,7 @@ ident_complete:
 	addq	%rbp, trampoline_level4_pgt + 0(%rip)
 	addq	%rbp, trampoline_level4_pgt + (511*8)(%rip)
 #endif
-#ifdef CONFIG_ACPI
+#ifdef CONFIG_ACPI_SLEEP
 	addq	%rbp, wakeup_level4_pgt + 0(%rip)
 	addq	%rbp, wakeup_level4_pgt + (511*8)(%rip)
 #endif
arch/x86_64/kernel/setup.c +1 -1
index 0f400f3..af838f6 100644
@@ -333,7 +333,7 @@ void __init setup_arch(char **cmdline_p)
 	reserve_bootmem_generic(SMP_TRAMPOLINE_BASE, 2*PAGE_SIZE);
 #endif
 
-#ifdef CONFIG_ACPI
+#ifdef CONFIG_ACPI_SLEEP
        /*
         * Reserve low memory region for sleep support.
         */
drivers/acpi/Kconfig +17 -0
index 22b401b..f38db44 100644
@@ -42,6 +42,23 @@ menuconfig ACPI
 
 if ACPI
 
+config ACPI_SLEEP
+	bool "ACPI hooks for system sleep and wakeup"
+	select HOTPLUG_CPU if X86 && SMP
+	select SUSPEND_SMP if X86 && SMP
+	default X86
+	---help---
+	  Say Y to include ACPI hooks for system sleep and wakeup.
+	  This options is needed for suspend to RAM on ACPI-enabled
+	  machines, for it includes the wakup vector support,
+	  as well as wakeup-device support.
+
+	  System Hibernate to disk can function without this option,
+	  but wakeup devices may work better with it.
+
+	  Disabling ACPI_SLEEP saves about 16 KB, and allows
+	  disabling HOTPLUG_CPU, which saves an additional 18 KB.
+
 config ACPI_PROCFS
 	bool "Deprecated /proc/acpi files"
 	depends on PROC_FS
drivers/acpi/sleep/Makefile +2 -2
index 01a993a..195a4f6 100644
@@ -1,5 +1,5 @@
 obj-y					:= poweroff.o wakeup.o
-obj-y					+= main.o
-obj-$(CONFIG_X86)			+= proc.o
+obj-$(CONFIG_ACPI_SLEEP)		+= main.o
+obj-$(CONFIG_ACPI_SLEEP)		+= proc.o
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
drivers/acpi/sleep/poweroff.c +2 -0
index b3f68ef..39e40d5 100644
@@ -18,6 +18,7 @@
 
 int acpi_sleep_prepare(u32 acpi_state)
 {
+#ifdef CONFIG_ACPI_SLEEP
 	/* do we have a wakeup address for S2 and S3? */
 	if (acpi_state == ACPI_STATE_S3) {
 		if (!acpi_wakeup_address) {
@@ -30,6 +31,7 @@ int acpi_sleep_prepare(u32 acpi_state)
 	}
 	ACPI_FLUSH_CPU_CACHE();
 	acpi_enable_wakeup_device_prep(acpi_state);
+#endif
 	acpi_gpe_sleep_prepare(acpi_state);
 	acpi_enter_sleep_state_prep(acpi_state);
 	return 0;
drivers/acpi/sleep/proc.c +1 -1
index ed58e11..25b87ad 100644
@@ -78,7 +78,7 @@ acpi_system_write_sleep(struct file *file,
 }
 #endif				/* CONFIG_ACPI_PROCFS */
 
-#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE)
+#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || !defined(CONFIG_X86)
 /* use /sys/class/rtc/rtcX/wakealarm instead; it's not ACPI-specific */
 #else
 #define	HAVE_ACPI_LEGACY_ALARM
drivers/pci/pci-acpi.c +4 -0
index 67c63d1..5c6a5d0 100644
@@ -220,6 +220,7 @@ acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
 }
 EXPORT_SYMBOL(pci_osc_control_set);
 
+#ifdef CONFIG_ACPI_SLEEP
 /*
  * _SxD returns the D-state with the highest power
  * (lowest D-state number) supported in the S-state "x".
@@ -267,6 +268,7 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev,
 	}
 	return PCI_POWER_ERROR;
 }
+#endif
 
 static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
 {
@@ -340,7 +342,9 @@ static int __init acpi_pci_init(void)
 	ret = register_acpi_bus_type(&acpi_pci_bus);
 	if (ret)
 		return 0;
+#ifdef	CONFIG_ACPI_SLEEP
 	platform_pci_choose_state = acpi_pci_choose_state;
+#endif
 	platform_pci_set_power_state = acpi_pci_set_power_state;
 	return 0;
 }
drivers/pnp/pnpacpi/core.c +4 -0
index 6a2a3c2..616fc72 100644
@@ -127,6 +127,7 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)
 	return ACPI_FAILURE(status) ? -ENODEV : 0;
 }
 
+#ifdef CONFIG_ACPI_SLEEP
 static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
 {
 	return acpi_bus_set_power((acpi_handle) dev->data,
@@ -140,14 +141,17 @@ static int pnpacpi_resume(struct pnp_dev *dev)
 {
 	return acpi_bus_set_power((acpi_handle) dev->data, ACPI_STATE_D0);
 }
+#endif
 
 static struct pnp_protocol pnpacpi_protocol = {
 	.name	 = "Plug and Play ACPI",
 	.get	 = pnpacpi_get_resources,
 	.set	 = pnpacpi_set_resources,
 	.disable = pnpacpi_disable_resources,
+#ifdef CONFIG_ACPI_SLEEP
 	.suspend = pnpacpi_suspend,
 	.resume = pnpacpi_resume,
+#endif
 };
 
 static int __init pnpacpi_add_device(struct acpi_device *device)
include/acpi/acpi_drivers.h +4 -0
index f85f77a..202acb9 100644
@@ -147,6 +147,10 @@ static inline void unregister_hotplug_dock_device(acpi_handle handle)
 /*--------------------------------------------------------------------------
                                   Suspend/Resume
   -------------------------------------------------------------------------- */
+#ifdef CONFIG_ACPI_SLEEP
 extern int acpi_sleep_init(void);
+#else
+static inline int acpi_sleep_init(void) { return 0; }
+#endif
 
 #endif /*__ACPI_DRIVERS_H__*/
kernel/sysctl.c +1 -1
index eb26f2b..79c891e 100644
@@ -689,7 +689,7 @@ static ctl_table kern_table[] = {
 		.proc_handler	= &proc_dointvec,
 	},
 #endif
-#if defined(CONFIG_ACPI) && defined(CONFIG_X86)
+#if	defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
 	{
 		.ctl_name	= KERN_ACPI_VIDEO_FLAGS,
 		.procname	= "acpi_video_flags",
#117 lore raw
In reply to Andreas Schwab
Quoted 8 lines · Andreas Schwab
Quoted 6 lines · Jan Dittmer
Quoted 5 lines · Len Brown

Hi Linus,

please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git release

Quoted 8 lines
Quoted 5 lines

This seems to break ia64 defconfig:

Building modules, stage 2.
MODPOST 157 modules
FATAL: drivers/acpi/button: sizeof(struct acpi_device_id)=20 is not a modulo of the size of section __mod_acpi_device_table=144.

Are you cross-compiling? The definition of kernel_ulong_t won't work on x86.

Yes, sorry, should have mentioned that. Build system is x86. Still, it didn't happen before the recent acpi merge.

Jan

#22 lore raw

Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU

In reply to Adrian Bunk
Quoted 5 lines · Adrian Bunk
Quoted 2 lines · Stefan Richter

Yes, that's the price to pay if you want to select something that in turn depends on a number of other things.

Yes, but a good user interface is worth it.

That's right. But a hypothetical other way would be to leave Kconfigs minimal ands put the necessary features into scripts/kconfig.

Signature · 3 lines
Stefan -ENOPATCH Richter
-=====-=-=== -=== ===--
http://arcgraph.de/sr/
#27 lore raw

Re: [2.6 patch] SOFTWARE_SUSPEND: handle HOTPLUG_CPU automatically

In reply to Adrian Bunk
Quoted 4 lines · Adrian Bunk
Quoted 3 lines · Linus Torvalds

[ For extra bonus points: the SUSPEND_POSSIBLE thing is still pretty
complicated, and it might actually be a better idea to make it a per-arch config option,

...

Quoted 2 lines

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

Unless /all/ architectures define it, of course.

Signature · 3 lines
Stefan Richter
-=====-=-=== -=== ===--
http://arcgraph.de/sr/
#24 lore raw

Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU

In reply to Stefan Richter
Quoted 6 lines · Stefan Richter
Quoted 1 line · Adrian Bunk

The dependency of SUSPEND_SMP on HOTPLUG_CPU is quite unintuitive,

It's not entirely unintuitive. That option's full name is "Support for suspend on SMP and hot-pluggable CPUs".

I have to give reason to Len Brown on limit the options else this is much more difficult.

Make sense define SUSPEND_SMP without define HOTPLUG_CPU ? or make sense define HOTPLUG_CPU without define SUSPEND_SMP ? Even if both options could make sense, we have to have the code prepare for it, which couldn't be prepared.
But it is more easier and more importante focus on major cases which is:
"I don't care" and force some configuration and everybody test the same code. Else in ACPI we have many issues to resolve like with this define and without other, which philosophically could be interesting but is not the major case and don't let us focus on stability.

Thanks,

Signature · 1 line
Sérgio M. B.
#31 lore raw

Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)

In reply to Len Brown
Quoted 2 lines · Len Brown

That three-liner will crash ACPI+SMP-HOTPLUG_CPU kernels on resume.

Explain that to me.

There should *be* no resume.

ACPI doesn't suspend/resume on its own, I hope.

It is all done by the top-level suspend/resume code, not by ACPI. ACPI is a pure helper, and if you've changed that, then I think we need to revert more than a few lines.

And it's the *top*level* code that selects HOTPLUG_CPU. Through SUSPEND_SMP (which will select HOTPLUG_CPU) and SOFTWARE_SUSPEND.

This is why it's so *totally* and *utterly* bogus for ACPI to select features that it has nothign what-so-ever to do with.

In other words: ACPI isn't in the driving seat.

Linus

#32 lore raw

Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)

Quoted 3 lines · Linus Torvalds

And it's the *top*level* code that selects HOTPLUG_CPU. Through SUSPEND_SMP (which will select HOTPLUG_CPU) and SOFTWARE_SUSPEND.

In other words, the problem seems to be that

kernel/power/main.c:
suspend_devices_and_enter()

does the proper "disable/enable_nonboot_cpus()", but it does so without having enabled CPU hotplug.

And you seem to think that it's ACPI that should enable the hotplug, even though the code that actually needs it is _outside_ ACPI. And I think that's wrong, and that this is a bug.

So I think the real issue is that we allow that "suspend_devices_and_enter()" code to be compiled without HOTPLUG_CPU in the first place. It's not supposed to work that way.

Of course, it may well be that other architectures can happily suspend even with multiple CPU's active, which may be the cause of this mess. But I really think it shouldn't be ACPI that has to select the CPU hotplug, since it's not ACPI that _uses_ it in the first place.

Rafael: making a config option for STR (the same way we have a config option for hibernate), and just not allowing it on SMP without HOTPLUG_CPU seems to be the right thing. Len is right in that we do insane things right now (trying to STR with multiple CPU's still active), and I just don't think he's the one that should work around it!

Linus

#33 lore raw

Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)

Quoted 27 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds

And it's the *top*level* code that selects HOTPLUG_CPU. Through SUSPEND_SMP (which will select HOTPLUG_CPU) and SOFTWARE_SUSPEND.

In other words, the problem seems to be that

kernel/power/main.c:
suspend_devices_and_enter()

does the proper "disable/enable_nonboot_cpus()", but it does so without having enabled CPU hotplug.

And you seem to think that it's ACPI that should enable the hotplug, even though the code that actually needs it is _outside_ ACPI. And I think that's wrong, and that this is a bug.

So I think the real issue is that we allow that "suspend_devices_and_enter()" code to be compiled without HOTPLUG_CPU in the first place. It's not supposed to work that way.

Of course, it may well be that other architectures can happily suspend even with multiple CPU's active, which may be the cause of this mess. But I really think it shouldn't be ACPI that has to select the CPU hotplug, since it's not ACPI that _uses_ it in the first place.

Quoted 5 lines

Rafael: making a config option for STR (the same way we have a config option for hibernate), and just not allowing it on SMP without HOTPLUG_CPU seems to be the right thing. Len is right in that we do insane things right now (trying to STR with multiple CPU's still active), and I just don't think he's the one that should work around it!

Well, I agree and that's why I asked. :-)

OK, I'll prepare a patch to introduce CONFIG_SUSPEND, but that will require quite a bit of (compilation) testing on different architectures.

Greetings,
Rafael

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

Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU

In reply to Adrian Bunk
Quoted 87 lines · Adrian Bunk
Quoted 44 lines · Linus Torvalds
Quoted 5 lines · Rafael J. Wysocki

My point is we have ACPI dependent on PM, so if you want ACPI, you end up with all of the STR stuff built in, which is what you don't like (if I understand that correctly). If we have CONFIG_SUSPEND, you'll be able to choose ACPI alone. :-)

Good point.

Anyway, I think the ACPI problem really is as trivial as the following three-liner removal fix. If the user doesn't want suspend, ACPI shouldn't force it on him.

A nicer fix might be to also make some of the ACPI helper routines depend on whether they are needed or not (which in turn will depend on whether suspend support has been compiled into the kernel), but quite frankly, that's secondary at least for me.

So if we have a few ACPI routines that will never get called (because we don't even enable the interfaces that would *cause* them to be called), I don't think that's a huge problem. It's a beauty wart, but nobody really cares (and it's even something that we could get the compiler to optimize away for us if we really cared).

Linus

---
Don't force-enable suspend/hibernate support just for ACPI

It's a totally independent decision for the user whether he wants suspend and/or hibernation support, and ACPI shouldn't care.

---
 drivers/acpi/Kconfig |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/acpi/Kconfig +0 -0
index 251344c..22b401b 100644

drivers/acpi/Kconfig menuconfig ACPI · line 16

Quoted 9 lines
drivers/acpi/Kconfig +0 -3
@@ -11,9 +11,6 @@ menuconfig ACPI
 	depends on PCI
 	depends on PM
 	select PNP
-	# for sleep
-	select HOTPLUG_CPU if X86 && SMP
-	select SUSPEND_SMP if X86 && SMP
 	default y
 	---help---
 	  Advanced Configuration and Power Interface (ACPI) support for 

The dependency of SUSPEND_SMP on HOTPLUG_CPU is quite unintuitive, so what about something like the patch below?

This should address a main issue behind Len's patch.

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 changes SOFTWARE_SUSPEND if SMP to select HOTPLUG_CPU instead of depending on it.

---

 kernel/power/Kconfig |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
kernel/power/Kconfig +1 -0
@@ -72,9 +72,22 @@ 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_SMP_POSSIBLE

kernel/power/Kconfig config PM_TRACE · line 85

Quoted 10 lines
kernel/power/Kconfig +10 -0
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+	depends on SMP
+	default y
+
+config SUSPEND_SMP
+	bool
+	depends on SUSPEND_SMP_POSSIBLE && SOFTWARE_SUSPEND
+	select HOTPLUG_CPU
+	default y

That should not depend on SOFTWARE_SUSPEND (it's equivalent to HIBERNATION).

Greetings,
Rafael

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

Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)

In reply to Rafael J. Wysocki
Quoted 3 lines · Rafael J. Wysocki

OK, I'll prepare a patch to introduce CONFIG_SUSPEND, but that will require quite a bit of (compilation) testing on different architectures.

Sure. I'm not too worried, the fallout should be of the trivial kind.

Also, mind basing it on the (independent) cleanups that Adrian already sent out. This is all intertwined..

Linus

#35 lore raw

cover Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (was: CONFIG_SUSPEND?)

Quoted 10 lines · Linus Torvalds
Quoted 3 lines · Rafael J. Wysocki

OK, I'll prepare a patch to introduce CONFIG_SUSPEND, but that will require quite a bit of (compilation) testing on different architectures.

Sure. I'm not too worried, the fallout should be of the trivial kind.

Also, mind basing it on the (independent) cleanups that Adrian already sent out. This is all intertwined..

OK, it took more time than I had hoped, but I wanted CONFIG_HIBERNATION and CONFIG_SUSPEND to be really independent of each other.

The two patches in the next messages implement the idea:
* replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION
* introduce CONFIG_SUSPEND that selects CONFIG_HOTPLUG_CPU, if necessary, and make it possible to choose suspend and hibernation independently of each other.

Greetings,
Rafael

#37 lore raw

PATCH 1/2 Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION

In reply to Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION to avoid confusion (among other things, with CONFIG_SUSPEND introduced in the next patch).

---
 arch/i386/Kconfig.debug                 |    4 ++--
 arch/i386/kernel/e820.c                 |    2 +-
 arch/i386/mm/init.c                     |    2 +-
 arch/i386/power/Makefile                |    2 +-
 arch/powerpc/Kconfig.debug              |    2 +-
 arch/powerpc/configs/lite5200_defconfig |    2 +-
 arch/powerpc/configs/pmac32_defconfig   |    2 +-
 arch/powerpc/kernel/Makefile            |    6 +++---
 arch/ppc/configs/TQM8540_defconfig      |    2 +-
 arch/ppc/configs/TQM8541_defconfig      |    2 +-
 arch/ppc/configs/TQM8555_defconfig      |    2 +-
 arch/ppc/configs/TQM8560_defconfig      |    2 +-
 arch/ppc/configs/ev64360_defconfig      |    2 +-
 arch/ppc/configs/ml300_defconfig        |    2 +-
 arch/ppc/configs/ml403_defconfig        |    2 +-
 arch/ppc/configs/mpc834x_sys_defconfig  |    2 +-
 arch/ppc/configs/prep_defconfig         |    2 +-
 arch/sparc64/Kconfig.debug              |    2 +-
 arch/x86_64/defconfig                   |    2 +-
 arch/x86_64/kernel/Makefile             |    2 +-
 arch/x86_64/kernel/suspend.c            |    4 ++--
 drivers/acpi/sleep/main.c               |    6 +++---
 drivers/acpi/sleep/proc.c               |    2 +-
 drivers/i2c/chips/tps65010.c            |    2 +-
 include/asm-i386/e820.h                 |    2 +-
 include/linux/suspend.h                 |    8 ++++----
 kernel/power/Kconfig                    |    6 +++---
 kernel/power/Makefile                   |    2 +-
 kernel/power/main.c                     |    2 +-
 kernel/power/power.h                    |    2 +-
 kernel/sys.c                            |    2 +-
 mm/Kconfig                              |    4 ++--
 mm/swapfile.c                           |    6 +++---
 33 files changed, 47 insertions(+), 47 deletions(-)
arch/i386/Kconfig.debug +2 -2
Index: linux-2.6.23-rc1/arch/i386/Kconfig.debug
===================================================================
@@ -36,11 +36,11 @@ config DEBUG_STACK_USAGE
 	  This option will slow down process creation somewhat.
 
 comment "Page alloc debug is incompatible with Software Suspend on i386"
-	depends on DEBUG_KERNEL && SOFTWARE_SUSPEND
+	depends on DEBUG_KERNEL && HIBERNATION
 
 config DEBUG_PAGEALLOC
 	bool "Debug page memory allocations"
-	depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND && !HUGETLBFS
+	depends on DEBUG_KERNEL && !HIBERNATION && !HUGETLBFS
 	help
 	  Unmap pages from the kernel linear mapping after free_pages().
 	  This results in a large slowdown, but helps to find certain types
arch/i386/kernel/e820.c +1 -1
Index: linux-2.6.23-rc1/arch/i386/kernel/e820.c
===================================================================
@@ -321,7 +321,7 @@ static int __init request_standard_resou
 
 subsys_initcall(request_standard_resources);
 
-#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
+#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
 /**
  * e820_mark_nosave_regions - Find the ranges of physical addresses that do not
  * correspond to e820 RAM areas and mark the corresponding pages as nosave for
arch/i386/mm/init.c +1 -1
Index: linux-2.6.23-rc1/arch/i386/mm/init.c
===================================================================
@@ -432,7 +432,7 @@ static void __init pagetable_init (void)
 	paravirt_pagetable_setup_done(pgd_base);
 }
 
-#if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_ACPI_SLEEP)
+#if defined(CONFIG_HIBERNATION) || defined(CONFIG_ACPI_SLEEP)
 /*
  * Swap suspend & friends need this for resume because things like the intel-agp
  * driver might have split up a kernel 4MB mapping.
arch/i386/power/Makefile +1 -1
Index: linux-2.6.23-rc1/arch/i386/power/Makefile
===================================================================
@@ -1,2 +1,2 @@
 obj-$(CONFIG_PM)		+= cpu.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o suspend.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o
arch/powerpc/Kconfig.debug +1 -1
Index: linux-2.6.23-rc1/arch/powerpc/Kconfig.debug
===================================================================
@@ -20,7 +20,7 @@ config DEBUG_STACK_USAGE
 
 config DEBUG_PAGEALLOC
         bool "Debug page memory allocations"
-        depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
+        depends on DEBUG_KERNEL && !HIBERNATION
         help
           Unmap pages from the kernel linear mapping after free_pages().
           This results in a large slowdown, but helps to find certain types
arch/powerpc/configs/lite5200_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/powerpc/configs/lite5200_defconfig
===================================================================
@@ -196,7 +196,7 @@ CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
 # CONFIG_PM_SYSFS_DEPRECATED is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 # CONFIG_WANT_DEVICE_TREE is not set
 CONFIG_ISA_DMA_API=y
arch/powerpc/configs/pmac32_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/powerpc/configs/pmac32_defconfig
===================================================================
@@ -218,7 +218,7 @@ CONFIG_PM=y
 CONFIG_PM_DEBUG=y
 # CONFIG_DISABLE_CONSOLE_SUSPEND is not set
 CONFIG_PM_SYSFS_DEPRECATED=y
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 CONFIG_APM_EMULATION=y
 CONFIG_SECCOMP=y
arch/powerpc/kernel/Makefile +3 -3
Index: linux-2.6.23-rc1/arch/powerpc/kernel/Makefile
===================================================================
@@ -37,9 +37,9 @@ obj-$(CONFIG_GENERIC_TBSYNC)	+= smp-tbsy
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_6xx)		+= idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
 obj-$(CONFIG_TAU)		+= tau_6xx.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o suspend.o
-obj32-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_32.o
-obj64-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_64.o swsusp_asm64.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o
+obj32-$(CONFIG_HIBERNATION) += swsusp_32.o
+obj64-$(CONFIG_HIBERNATION) += swsusp_64.o swsusp_asm64.o
 obj32-$(CONFIG_MODULES)		+= module_32.o
 
 ifeq ($(CONFIG_PPC_MERGE),y)
arch/ppc/configs/TQM8540_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8540_defconfig
===================================================================
@@ -136,7 +136,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/TQM8541_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8541_defconfig
===================================================================
@@ -138,7 +138,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/TQM8555_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8555_defconfig
===================================================================
@@ -138,7 +138,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/TQM8560_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8560_defconfig
===================================================================
@@ -137,7 +137,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/ev64360_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/ev64360_defconfig
===================================================================
@@ -142,7 +142,7 @@ CONFIG_BINFMT_MISC=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyMM0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/ml300_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/ml300_defconfig
===================================================================
@@ -148,7 +148,7 @@ CONFIG_BINFMT_ELF=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,9600"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/ml403_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/ml403_defconfig
===================================================================
@@ -149,7 +149,7 @@ CONFIG_BINFMT_ELF=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,9600"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/mpc834x_sys_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/mpc834x_sys_defconfig
===================================================================
@@ -130,7 +130,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/prep_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/prep_defconfig
===================================================================
@@ -166,7 +166,7 @@ CONFIG_PROC_PREPRESIDUAL=y
 CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 # CONFIG_SECCOMP is not set
 CONFIG_ISA_DMA_API=y
arch/sparc64/Kconfig.debug +1 -1
Index: linux-2.6.23-rc1/arch/sparc64/Kconfig.debug
===================================================================
@@ -29,7 +29,7 @@ config DEBUG_BOOTMEM
 
 config DEBUG_PAGEALLOC
 	bool "Debug page memory allocations"
-	depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
+	depends on DEBUG_KERNEL && !HIBERNATION
 	help
 	  Unmap pages from the kernel linear mapping after free_pages().
 	  This results in a large slowdown, but helps to find certain types
arch/x86_64/defconfig +1 -1
Index: linux-2.6.23-rc1/arch/x86_64/defconfig
===================================================================
@@ -199,7 +199,7 @@ CONFIG_GENERIC_PENDING_IRQ=y
 CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 CONFIG_SUSPEND_SMP=y
 
arch/x86_64/kernel/Makefile +1 -1
Index: linux-2.6.23-rc1/arch/x86_64/kernel/Makefile
===================================================================
@@ -26,7 +26,7 @@ obj-y				+= io_apic.o mpparse.o genapic.
 obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o crash.o
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_PM)		+= suspend.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend_asm.o
+obj-$(CONFIG_HIBERNATION)	+= suspend_asm.o
 obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 obj-$(CONFIG_IOMMU)		+= pci-gart.o aperture.o
arch/x86_64/kernel/suspend.c +2 -2
Index: linux-2.6.23-rc1/arch/x86_64/kernel/suspend.c
===================================================================
@@ -146,7 +146,7 @@ void fix_processor_context(void)
 
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /* Defined in arch/x86_64/kernel/suspend_asm.S */
 extern int restore_image(void);
 
@@ -236,4 +236,4 @@ int pfn_is_nosave(unsigned long pfn)
 	unsigned long nosave_end_pfn = PAGE_ALIGN(__pa_symbol(&__nosave_end)) >> PAGE_SHIFT;
 	return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
 }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
drivers/acpi/sleep/main.c +3 -3
Index: linux-2.6.23-rc1/drivers/acpi/sleep/main.c
===================================================================
@@ -204,7 +204,7 @@ static struct platform_suspend_ops acpi_
 	.finish = acpi_pm_finish,
 };
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 static int acpi_hibernation_start(void)
 {
 	acpi_target_sleep_state = ACPI_STATE_S4;
@@ -266,7 +266,7 @@ static struct platform_hibernation_ops a
 	.pre_restore = acpi_hibernation_pre_restore,
 	.restore_cleanup = acpi_hibernation_restore_cleanup,
 };
-#endif				/* CONFIG_SOFTWARE_SUSPEND */
+#endif				/* CONFIG_HIBERNATION */
 
 /**
  *	acpi_pm_device_sleep_state - return preferred power state of ACPI device
@@ -386,7 +386,7 @@ int __init acpi_sleep_init(void)
 
 	suspend_set_ops(&acpi_pm_ops);
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	if (sleep_states[ACPI_STATE_S4])
 		hibernation_set_ops(&acpi_hibernation_ops);
 #else
drivers/acpi/sleep/proc.c +1 -1
Index: linux-2.6.23-rc1/drivers/acpi/sleep/proc.c
===================================================================
@@ -58,7 +58,7 @@ acpi_system_write_sleep(struct file *fil
 		goto Done;
 	}
 	state = simple_strtoul(str, NULL, 0);
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	if (state == 4) {
 		error = hibernate();
 		goto Done;
drivers/i2c/chips/tps65010.c +1 -1
Index: linux-2.6.23-rc1/drivers/i2c/chips/tps65010.c
===================================================================
@@ -352,7 +352,7 @@ static void tps65010_interrupt(struct tp
 			/* REVISIT:  this might need its own workqueue
 			 * plus tweaks including deadlock avoidance ...
 			 * also needs to get error handling and probably
-			 * an #ifdef CONFIG_SOFTWARE_SUSPEND
+			 * an #ifdef CONFIG_HIBERNATION
 			 */
 			hibernate();
 #endif
include/asm-i386/e820.h +1 -1
Index: linux-2.6.23-rc1/include/asm-i386/e820.h
===================================================================
@@ -47,7 +47,7 @@ extern void e820_register_memory(void);
 extern void limit_regions(unsigned long long size);
 extern void print_memory_map(char *who);
 
-#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
+#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
 extern void e820_mark_nosave_regions(void);
 #else
 static inline void e820_mark_nosave_regions(void)
include/linux/suspend.h +4 -4
Index: linux-2.6.23-rc1/include/linux/suspend.h
===================================================================
@@ -174,7 +174,7 @@ struct platform_hibernation_ops {
 };
 
 #ifdef CONFIG_PM
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
 static inline void register_nosave_region(unsigned long b, unsigned long e)
@@ -192,14 +192,14 @@ extern unsigned long get_safe_page(gfp_t
 
 extern void hibernation_set_ops(struct platform_hibernation_ops *ops);
 extern int hibernate(void);
-#else /* CONFIG_SOFTWARE_SUSPEND */
+#else /* CONFIG_HIBERNATION */
 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
 static inline void swsusp_set_page_free(struct page *p) {}
 static inline void swsusp_unset_page_free(struct page *p) {}
 
 static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {}
 static inline int hibernate(void) { return -ENOSYS; }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
 
 void save_processor_state(void);
 void restore_processor_state(void);
@@ -240,7 +240,7 @@ static inline int unregister_pm_notifier
 #define pm_notifier(fn, pri)	do { (void)(fn); } while (0)
 #endif /* CONFIG_PM */
 
-#if !defined CONFIG_SOFTWARE_SUSPEND || !defined(CONFIG_PM)
+#if !defined CONFIG_HIBERNATION || !defined(CONFIG_PM)
 static inline void register_nosave_region(unsigned long b, unsigned long e)
 {
 }
kernel/power/Kconfig +3 -3
Index: linux-2.6.23-rc1/kernel/power/Kconfig
===================================================================
@@ -72,8 +72,8 @@ 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 SOFTWARE_SUSPEND
-	bool "Software Suspend (Hibernation)"
+config HIBERNATION
+	bool "Hibernation"
 	depends on PM && SWAP && (((X86 || PPC64_SWSUSP) && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP))
 	---help---
 	  Enable the suspend to disk (STD) functionality, which is usually
@@ -112,7 +112,7 @@ config SOFTWARE_SUSPEND
 
 config PM_STD_PARTITION
 	string "Default resume partition"
-	depends on SOFTWARE_SUSPEND
+	depends on HIBERNATION
 	default ""
 	---help---
 	  The default resume partition is the partition that the suspend-
kernel/power/Makefile +1 -1
Index: linux-2.6.23-rc1/kernel/power/Makefile
===================================================================
@@ -5,6 +5,6 @@ endif
 
 obj-y				:= main.o process.o console.o
 obj-$(CONFIG_PM_LEGACY)		+= pm.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o disk.o snapshot.o swap.o user.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o disk.o snapshot.o swap.o user.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
kernel/power/main.c +1 -1
Index: linux-2.6.23-rc1/kernel/power/main.c
===================================================================
@@ -295,7 +295,7 @@ static ssize_t state_show(struct kset *k
 		if (pm_states[i] && valid_state(i))
 			s += sprintf(s,"%s ", pm_states[i]);
 	}
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	s += sprintf(s, "%s\n", "disk");
 #else
 	if (s != buf)
kernel/power/power.h +1 -1
Index: linux-2.6.23-rc1/kernel/power/power.h
===================================================================
@@ -13,7 +13,7 @@ struct swsusp_info {
 
 
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Keep some memory free so that I/O operations can succeed without paging
  * [Might this be more than 4 MB?]
kernel/sys.c +1 -1
Index: linux-2.6.23-rc1/kernel/sys.c
===================================================================
@@ -954,7 +954,7 @@ asmlinkage long sys_reboot(int magic1, i
 		unlock_kernel();
 		return -EINVAL;
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	case LINUX_REBOOT_CMD_SW_SUSPEND:
 		{
 			int ret = hibernate();
mm/Kconfig +2 -2
Index: linux-2.6.23-rc1/mm/Kconfig
===================================================================
@@ -116,11 +116,11 @@ config SPARSEMEM_EXTREME
 config MEMORY_HOTPLUG
 	bool "Allow for memory hot-add"
 	depends on SPARSEMEM || X86_64_ACPI_NUMA
-	depends on HOTPLUG && !SOFTWARE_SUSPEND && ARCH_ENABLE_MEMORY_HOTPLUG
+	depends on HOTPLUG && !HIBERNATION && ARCH_ENABLE_MEMORY_HOTPLUG
 	depends on (IA64 || X86 || PPC64 || SUPERH)
 
 comment "Memory hotplug is currently incompatible with Software Suspend"
-	depends on SPARSEMEM && HOTPLUG && SOFTWARE_SUSPEND
+	depends on SPARSEMEM && HOTPLUG && HIBERNATION
 
 config MEMORY_HOTPLUG_SPARSE
 	def_bool y
mm/swapfile.c +3 -3
Index: linux-2.6.23-rc1/mm/swapfile.c
===================================================================
@@ -425,7 +425,7 @@ void free_swap_and_cache(swp_entry_t ent
 	}
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Find the swap type that corresponds to given device (if any).
  *
@@ -951,7 +951,7 @@ sector_t map_swap_page(struct swap_info_
 	}
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Get the (PAGE_SIZE) block corresponding to given offset on the swapdev
  * corresponding to given index in swap_info (swap type).
@@ -966,7 +966,7 @@ sector_t swapdev_block(int swap_type, pg
 	sis = swap_info + swap_type;
 	return (sis->flags & SWP_WRITEOK) ? map_swap_page(sis, offset) : 0;
 }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
 
 /*
  * Free all of a swapdev's extent information
#36 lore raw

cover Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (was: CONFIG_SUSPEND?)

In reply to Linus Torvalds
Quoted 10 lines · Linus Torvalds
Quoted 3 lines · Rafael J. Wysocki

OK, I'll prepare a patch to introduce CONFIG_SUSPEND, but that will require quite a bit of (compilation) testing on different architectures.

Sure. I'm not too worried, the fallout should be of the trivial kind.

Also, mind basing it on the (independent) cleanups that Adrian already sent out. This is all intertwined..

OK, it took more time than I had hoped, but I wanted CONFIG_HIBERNATION and CONFIG_SUSPEND to be really independent of each other.

The two patches in the next messages implement the idea:
* replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION
* introduce CONFIG_SUSPEND that selects CONFIG_HOTPLUG_CPU, if necessary, and make it possible to choose suspend and hibernation independently of each other.

Greetings,
Rafael

#38 lore raw

PATCH 1/2 Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION

From: Rafael J. Wysocki <[email protected]>

Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION to avoid confusion (among other things, with CONFIG_SUSPEND introduced in the next patch).

---
 arch/i386/Kconfig.debug                 |    4 ++--
 arch/i386/kernel/e820.c                 |    2 +-
 arch/i386/mm/init.c                     |    2 +-
 arch/i386/power/Makefile                |    2 +-
 arch/powerpc/Kconfig.debug              |    2 +-
 arch/powerpc/configs/lite5200_defconfig |    2 +-
 arch/powerpc/configs/pmac32_defconfig   |    2 +-
 arch/powerpc/kernel/Makefile            |    6 +++---
 arch/ppc/configs/TQM8540_defconfig      |    2 +-
 arch/ppc/configs/TQM8541_defconfig      |    2 +-
 arch/ppc/configs/TQM8555_defconfig      |    2 +-
 arch/ppc/configs/TQM8560_defconfig      |    2 +-
 arch/ppc/configs/ev64360_defconfig      |    2 +-
 arch/ppc/configs/ml300_defconfig        |    2 +-
 arch/ppc/configs/ml403_defconfig        |    2 +-
 arch/ppc/configs/mpc834x_sys_defconfig  |    2 +-
 arch/ppc/configs/prep_defconfig         |    2 +-
 arch/sparc64/Kconfig.debug              |    2 +-
 arch/x86_64/defconfig                   |    2 +-
 arch/x86_64/kernel/Makefile             |    2 +-
 arch/x86_64/kernel/suspend.c            |    4 ++--
 drivers/acpi/sleep/main.c               |    6 +++---
 drivers/acpi/sleep/proc.c               |    2 +-
 drivers/i2c/chips/tps65010.c            |    2 +-
 include/asm-i386/e820.h                 |    2 +-
 include/linux/suspend.h                 |    8 ++++----
 kernel/power/Kconfig                    |    6 +++---
 kernel/power/Makefile                   |    2 +-
 kernel/power/main.c                     |    2 +-
 kernel/power/power.h                    |    2 +-
 kernel/sys.c                            |    2 +-
 mm/Kconfig                              |    4 ++--
 mm/swapfile.c                           |    6 +++---
 33 files changed, 47 insertions(+), 47 deletions(-)
arch/i386/Kconfig.debug +2 -2
Index: linux-2.6.23-rc1/arch/i386/Kconfig.debug
===================================================================
@@ -36,11 +36,11 @@ config DEBUG_STACK_USAGE
 	  This option will slow down process creation somewhat.
 
 comment "Page alloc debug is incompatible with Software Suspend on i386"
-	depends on DEBUG_KERNEL && SOFTWARE_SUSPEND
+	depends on DEBUG_KERNEL && HIBERNATION
 
 config DEBUG_PAGEALLOC
 	bool "Debug page memory allocations"
-	depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND && !HUGETLBFS
+	depends on DEBUG_KERNEL && !HIBERNATION && !HUGETLBFS
 	help
 	  Unmap pages from the kernel linear mapping after free_pages().
 	  This results in a large slowdown, but helps to find certain types
arch/i386/kernel/e820.c +1 -1
Index: linux-2.6.23-rc1/arch/i386/kernel/e820.c
===================================================================
@@ -321,7 +321,7 @@ static int __init request_standard_resou
 
 subsys_initcall(request_standard_resources);
 
-#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
+#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
 /**
  * e820_mark_nosave_regions - Find the ranges of physical addresses that do not
  * correspond to e820 RAM areas and mark the corresponding pages as nosave for
arch/i386/mm/init.c +1 -1
Index: linux-2.6.23-rc1/arch/i386/mm/init.c
===================================================================
@@ -432,7 +432,7 @@ static void __init pagetable_init (void)
 	paravirt_pagetable_setup_done(pgd_base);
 }
 
-#if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_ACPI_SLEEP)
+#if defined(CONFIG_HIBERNATION) || defined(CONFIG_ACPI_SLEEP)
 /*
  * Swap suspend & friends need this for resume because things like the intel-agp
  * driver might have split up a kernel 4MB mapping.
arch/i386/power/Makefile +1 -1
Index: linux-2.6.23-rc1/arch/i386/power/Makefile
===================================================================
@@ -1,2 +1,2 @@
 obj-$(CONFIG_PM)		+= cpu.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o suspend.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o
arch/powerpc/Kconfig.debug +1 -1
Index: linux-2.6.23-rc1/arch/powerpc/Kconfig.debug
===================================================================
@@ -20,7 +20,7 @@ config DEBUG_STACK_USAGE
 
 config DEBUG_PAGEALLOC
         bool "Debug page memory allocations"
-        depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
+        depends on DEBUG_KERNEL && !HIBERNATION
         help
           Unmap pages from the kernel linear mapping after free_pages().
           This results in a large slowdown, but helps to find certain types
arch/powerpc/configs/lite5200_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/powerpc/configs/lite5200_defconfig
===================================================================
@@ -196,7 +196,7 @@ CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
 # CONFIG_PM_SYSFS_DEPRECATED is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 # CONFIG_WANT_DEVICE_TREE is not set
 CONFIG_ISA_DMA_API=y
arch/powerpc/configs/pmac32_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/powerpc/configs/pmac32_defconfig
===================================================================
@@ -218,7 +218,7 @@ CONFIG_PM=y
 CONFIG_PM_DEBUG=y
 # CONFIG_DISABLE_CONSOLE_SUSPEND is not set
 CONFIG_PM_SYSFS_DEPRECATED=y
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 CONFIG_APM_EMULATION=y
 CONFIG_SECCOMP=y
arch/powerpc/kernel/Makefile +3 -3
Index: linux-2.6.23-rc1/arch/powerpc/kernel/Makefile
===================================================================
@@ -37,9 +37,9 @@ obj-$(CONFIG_GENERIC_TBSYNC)	+= smp-tbsy
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_6xx)		+= idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
 obj-$(CONFIG_TAU)		+= tau_6xx.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o suspend.o
-obj32-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_32.o
-obj64-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_64.o swsusp_asm64.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o
+obj32-$(CONFIG_HIBERNATION) += swsusp_32.o
+obj64-$(CONFIG_HIBERNATION) += swsusp_64.o swsusp_asm64.o
 obj32-$(CONFIG_MODULES)		+= module_32.o
 
 ifeq ($(CONFIG_PPC_MERGE),y)
arch/ppc/configs/TQM8540_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8540_defconfig
===================================================================
@@ -136,7 +136,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/TQM8541_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8541_defconfig
===================================================================
@@ -138,7 +138,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/TQM8555_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8555_defconfig
===================================================================
@@ -138,7 +138,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/TQM8560_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8560_defconfig
===================================================================
@@ -137,7 +137,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/ev64360_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/ev64360_defconfig
===================================================================
@@ -142,7 +142,7 @@ CONFIG_BINFMT_MISC=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyMM0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/ml300_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/ml300_defconfig
===================================================================
@@ -148,7 +148,7 @@ CONFIG_BINFMT_ELF=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,9600"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/ml403_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/ml403_defconfig
===================================================================
@@ -149,7 +149,7 @@ CONFIG_BINFMT_ELF=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,9600"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/mpc834x_sys_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/mpc834x_sys_defconfig
===================================================================
@@ -130,7 +130,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/prep_defconfig +1 -1
Index: linux-2.6.23-rc1/arch/ppc/configs/prep_defconfig
===================================================================
@@ -166,7 +166,7 @@ CONFIG_PROC_PREPRESIDUAL=y
 CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 # CONFIG_SECCOMP is not set
 CONFIG_ISA_DMA_API=y
arch/sparc64/Kconfig.debug +1 -1
Index: linux-2.6.23-rc1/arch/sparc64/Kconfig.debug
===================================================================
@@ -29,7 +29,7 @@ config DEBUG_BOOTMEM
 
 config DEBUG_PAGEALLOC
 	bool "Debug page memory allocations"
-	depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
+	depends on DEBUG_KERNEL && !HIBERNATION
 	help
 	  Unmap pages from the kernel linear mapping after free_pages().
 	  This results in a large slowdown, but helps to find certain types
arch/x86_64/defconfig +1 -1
Index: linux-2.6.23-rc1/arch/x86_64/defconfig
===================================================================
@@ -199,7 +199,7 @@ CONFIG_GENERIC_PENDING_IRQ=y
 CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 CONFIG_SUSPEND_SMP=y
 
arch/x86_64/kernel/Makefile +1 -1
Index: linux-2.6.23-rc1/arch/x86_64/kernel/Makefile
===================================================================
@@ -26,7 +26,7 @@ obj-y				+= io_apic.o mpparse.o genapic.
 obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o crash.o
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_PM)		+= suspend.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend_asm.o
+obj-$(CONFIG_HIBERNATION)	+= suspend_asm.o
 obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 obj-$(CONFIG_IOMMU)		+= pci-gart.o aperture.o
arch/x86_64/kernel/suspend.c +2 -2
Index: linux-2.6.23-rc1/arch/x86_64/kernel/suspend.c
===================================================================
@@ -146,7 +146,7 @@ void fix_processor_context(void)
 
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /* Defined in arch/x86_64/kernel/suspend_asm.S */
 extern int restore_image(void);
 
@@ -236,4 +236,4 @@ int pfn_is_nosave(unsigned long pfn)
 	unsigned long nosave_end_pfn = PAGE_ALIGN(__pa_symbol(&__nosave_end)) >> PAGE_SHIFT;
 	return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
 }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
drivers/acpi/sleep/main.c +3 -3
Index: linux-2.6.23-rc1/drivers/acpi/sleep/main.c
===================================================================
@@ -204,7 +204,7 @@ static struct platform_suspend_ops acpi_
 	.finish = acpi_pm_finish,
 };
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 static int acpi_hibernation_start(void)
 {
 	acpi_target_sleep_state = ACPI_STATE_S4;
@@ -266,7 +266,7 @@ static struct platform_hibernation_ops a
 	.pre_restore = acpi_hibernation_pre_restore,
 	.restore_cleanup = acpi_hibernation_restore_cleanup,
 };
-#endif				/* CONFIG_SOFTWARE_SUSPEND */
+#endif				/* CONFIG_HIBERNATION */
 
 /**
  *	acpi_pm_device_sleep_state - return preferred power state of ACPI device
@@ -386,7 +386,7 @@ int __init acpi_sleep_init(void)
 
 	suspend_set_ops(&acpi_pm_ops);
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	if (sleep_states[ACPI_STATE_S4])
 		hibernation_set_ops(&acpi_hibernation_ops);
 #else
drivers/acpi/sleep/proc.c +1 -1
Index: linux-2.6.23-rc1/drivers/acpi/sleep/proc.c
===================================================================
@@ -58,7 +58,7 @@ acpi_system_write_sleep(struct file *fil
 		goto Done;
 	}
 	state = simple_strtoul(str, NULL, 0);
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	if (state == 4) {
 		error = hibernate();
 		goto Done;
drivers/i2c/chips/tps65010.c +1 -1
Index: linux-2.6.23-rc1/drivers/i2c/chips/tps65010.c
===================================================================
@@ -352,7 +352,7 @@ static void tps65010_interrupt(struct tp
 			/* REVISIT:  this might need its own workqueue
 			 * plus tweaks including deadlock avoidance ...
 			 * also needs to get error handling and probably
-			 * an #ifdef CONFIG_SOFTWARE_SUSPEND
+			 * an #ifdef CONFIG_HIBERNATION
 			 */
 			hibernate();
 #endif
include/asm-i386/e820.h +1 -1
Index: linux-2.6.23-rc1/include/asm-i386/e820.h
===================================================================
@@ -47,7 +47,7 @@ extern void e820_register_memory(void);
 extern void limit_regions(unsigned long long size);
 extern void print_memory_map(char *who);
 
-#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
+#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
 extern void e820_mark_nosave_regions(void);
 #else
 static inline void e820_mark_nosave_regions(void)
include/linux/suspend.h +4 -4
Index: linux-2.6.23-rc1/include/linux/suspend.h
===================================================================
@@ -174,7 +174,7 @@ struct platform_hibernation_ops {
 };
 
 #ifdef CONFIG_PM
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
 static inline void register_nosave_region(unsigned long b, unsigned long e)
@@ -192,14 +192,14 @@ extern unsigned long get_safe_page(gfp_t
 
 extern void hibernation_set_ops(struct platform_hibernation_ops *ops);
 extern int hibernate(void);
-#else /* CONFIG_SOFTWARE_SUSPEND */
+#else /* CONFIG_HIBERNATION */
 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
 static inline void swsusp_set_page_free(struct page *p) {}
 static inline void swsusp_unset_page_free(struct page *p) {}
 
 static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {}
 static inline int hibernate(void) { return -ENOSYS; }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
 
 void save_processor_state(void);
 void restore_processor_state(void);
@@ -240,7 +240,7 @@ static inline int unregister_pm_notifier
 #define pm_notifier(fn, pri)	do { (void)(fn); } while (0)
 #endif /* CONFIG_PM */
 
-#if !defined CONFIG_SOFTWARE_SUSPEND || !defined(CONFIG_PM)
+#if !defined CONFIG_HIBERNATION || !defined(CONFIG_PM)
 static inline void register_nosave_region(unsigned long b, unsigned long e)
 {
 }
kernel/power/Kconfig +3 -3
Index: linux-2.6.23-rc1/kernel/power/Kconfig
===================================================================
@@ -72,8 +72,8 @@ 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 SOFTWARE_SUSPEND
-	bool "Software Suspend (Hibernation)"
+config HIBERNATION
+	bool "Hibernation"
 	depends on PM && SWAP && (((X86 || PPC64_SWSUSP) && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP))
 	---help---
 	  Enable the suspend to disk (STD) functionality, which is usually
@@ -112,7 +112,7 @@ config SOFTWARE_SUSPEND
 
 config PM_STD_PARTITION
 	string "Default resume partition"
-	depends on SOFTWARE_SUSPEND
+	depends on HIBERNATION
 	default ""
 	---help---
 	  The default resume partition is the partition that the suspend-
kernel/power/Makefile +1 -1
Index: linux-2.6.23-rc1/kernel/power/Makefile
===================================================================
@@ -5,6 +5,6 @@ endif
 
 obj-y				:= main.o process.o console.o
 obj-$(CONFIG_PM_LEGACY)		+= pm.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o disk.o snapshot.o swap.o user.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o disk.o snapshot.o swap.o user.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
kernel/power/main.c +1 -1
Index: linux-2.6.23-rc1/kernel/power/main.c
===================================================================
@@ -295,7 +295,7 @@ static ssize_t state_show(struct kset *k
 		if (pm_states[i] && valid_state(i))
 			s += sprintf(s,"%s ", pm_states[i]);
 	}
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	s += sprintf(s, "%s\n", "disk");
 #else
 	if (s != buf)
kernel/power/power.h +1 -1
Index: linux-2.6.23-rc1/kernel/power/power.h
===================================================================
@@ -13,7 +13,7 @@ struct swsusp_info {
 
 
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Keep some memory free so that I/O operations can succeed without paging
  * [Might this be more than 4 MB?]
kernel/sys.c +1 -1
Index: linux-2.6.23-rc1/kernel/sys.c
===================================================================
@@ -954,7 +954,7 @@ asmlinkage long sys_reboot(int magic1, i
 		unlock_kernel();
 		return -EINVAL;
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	case LINUX_REBOOT_CMD_SW_SUSPEND:
 		{
 			int ret = hibernate();
mm/Kconfig +2 -2
Index: linux-2.6.23-rc1/mm/Kconfig
===================================================================
@@ -116,11 +116,11 @@ config SPARSEMEM_EXTREME
 config MEMORY_HOTPLUG
 	bool "Allow for memory hot-add"
 	depends on SPARSEMEM || X86_64_ACPI_NUMA
-	depends on HOTPLUG && !SOFTWARE_SUSPEND && ARCH_ENABLE_MEMORY_HOTPLUG
+	depends on HOTPLUG && !HIBERNATION && ARCH_ENABLE_MEMORY_HOTPLUG
 	depends on (IA64 || X86 || PPC64 || SUPERH)
 
 comment "Memory hotplug is currently incompatible with Software Suspend"
-	depends on SPARSEMEM && HOTPLUG && SOFTWARE_SUSPEND
+	depends on SPARSEMEM && HOTPLUG && HIBERNATION
 
 config MEMORY_HOTPLUG_SPARSE
 	def_bool y
mm/swapfile.c +3 -3
Index: linux-2.6.23-rc1/mm/swapfile.c
===================================================================
@@ -425,7 +425,7 @@ void free_swap_and_cache(swp_entry_t ent
 	}
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Find the swap type that corresponds to given device (if any).
  *
@@ -951,7 +951,7 @@ sector_t map_swap_page(struct swap_info_
 	}
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Get the (PAGE_SIZE) block corresponding to given offset on the swapdev
  * corresponding to given index in swap_info (swap type).
@@ -966,7 +966,7 @@ sector_t swapdev_block(int swap_type, pg
 	sis = swap_info + swap_type;
 	return (sis->flags & SWP_WRITEOK) ? map_swap_page(sis, offset) : 0;
 }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
 
 /*
  * Free all of a swapdev's extent information
#39 lore raw

PATCH 2/2 Introduce CONFIG_SUSPEND

In reply to Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Introduce CONFIG_SUSPEND representing the ability to enter system sleep states, such as the ACPI S3 state, and allow the user to choose SUSPEND and HIBERNATION independently of each other.

Make HOTPLUG_CPU be selected automatically if SUSPEND or HIBERNATION has been chosen and the kernel is intended for SMP systems.

Also, introduce CONFIG_PM_SLEEP which is automatically selected if CONFIG_SUSPEND or CONFIG_HIBERNATION is set and make CONFIG_ACPI_SLEEP depend on it.

The top-level power management headers are modified to use the new definitions. Still, there are many other files in which CONFIG_PM can be replaced with CONFIG_PM_SLEEP or even with CONFIG_SUSPEND, but they can be updated in the future.

---
 drivers/acpi/Kconfig        |    2 +-
 drivers/base/power/Makefile |    6 +++---
 drivers/base/power/power.h  |    4 ++--
 include/acpi/acpi_bus.h     |    7 +++++++
 include/linux/freezer.h     |    6 +++---
 include/linux/pm.h          |    8 ++++----
 include/linux/suspend.h     |   16 ++++++++--------
 kernel/power/Kconfig        |   39 +++++++++++++++++++++++++++++++--------
 kernel/power/Makefile       |    3 ++-
 kernel/power/main.c         |   26 ++++++++++++++++++--------
 kernel/power/power.h        |   10 +++++++++-
 mm/page_alloc.c             |    4 ++--
 12 files changed, 90 insertions(+), 41 deletions(-)
kernel/power/Kconfig +31 -8
Index: linux-2.6.23-rc1/kernel/power/Kconfig
===================================================================
@@ -46,7 +46,7 @@ config PM_VERBOSE
 
 config DISABLE_CONSOLE_SUSPEND
 	bool "Keep console(s) enabled during suspend/resume (DANGEROUS)"
-	depends on PM_DEBUG
+	depends on PM_DEBUG && PM_SLEEP
 	default n
 	---help---
 	This option turns off the console suspend mechanism that prevents
@@ -57,7 +57,7 @@ config DISABLE_CONSOLE_SUSPEND
 
 config PM_TRACE
 	bool "Suspend/resume event tracing"
-	depends on PM_DEBUG && X86 && EXPERIMENTAL
+	depends on PM_DEBUG && X86 && PM_SLEEP && EXPERIMENTAL
 	default n
 	---help---
 	This enables some cheesy code to save the last PM event point in the
@@ -72,9 +72,37 @@ 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_SMP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+	depends on SMP
+	default y
+
+config SUSPEND_SMP
+	bool
+	depends on SUSPEND_SMP_POSSIBLE && PM_SLEEP
+	select HOTPLUG_CPU
+	default y
+
+config PM_SLEEP
+	bool
+	depends on SUSPEND || HIBERNATION
+	default y
+
+config SUSPEND
+	bool "Suspend"
+	depends on PM
+	depends on !SMP || SUSPEND_SMP_POSSIBLE
+	default y
+	---help---
+	  Allow the system to enter sleep states in which main memory is
+	  powered and thus its contents are preserved, such as the
+	  suspend-to-RAM state (i.e. the ACPI S3 state).
+
 config HIBERNATION
 	bool "Hibernation"
-	depends on PM && SWAP && (((X86 || PPC64_SWSUSP) && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP))
+	depends on PM && SWAP
+	depends on ((X86 || PPC64_SWSUSP || FRV || PPC32) && !SMP) || SUSPEND_SMP_POSSIBLE
 	---help---
 	  Enable the suspend to disk (STD) functionality, which is usually
 	  called "hibernation" in user interfaces.  STD checkpoints the
@@ -132,11 +160,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
kernel/power/Makefile +2 -1
Index: linux-2.6.23-rc1/kernel/power/Makefile
===================================================================
@@ -3,8 +3,9 @@ ifeq ($(CONFIG_PM_DEBUG),y)
 EXTRA_CFLAGS	+=	-DDEBUG
 endif
 
-obj-y				:= main.o process.o console.o
+obj-y				:= main.o
 obj-$(CONFIG_PM_LEGACY)		+= pm.o
+obj-$(CONFIG_PM_SLEEP)		+= process.o console.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o disk.o snapshot.o swap.o user.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
drivers/base/power/Makefile +3 -3
Index: linux-2.6.23-rc1/drivers/base/power/Makefile
===================================================================
@@ -1,6 +1,6 @@
-obj-y			:= shutdown.o
-obj-$(CONFIG_PM)	+= main.o suspend.o resume.o sysfs.o
-obj-$(CONFIG_PM_TRACE)	+= trace.o
+obj-y				:= shutdown.o
+obj-$(CONFIG_PM_SLEEP)	+= main.o suspend.o resume.o sysfs.o
+obj-$(CONFIG_PM_TRACE)		+= trace.o
 
 ifeq ($(CONFIG_DEBUG_DRIVER),y)
 EXTRA_CFLAGS += -DDEBUG
include/linux/suspend.h +8 -8
Index: linux-2.6.23-rc1/include/linux/suspend.h
===================================================================
@@ -10,7 +10,7 @@
 #include <linux/pm.h>
 #include <linux/mm.h>
 
-#if defined(CONFIG_PM) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
 extern int pm_prepare_console(void);
 extern void pm_restore_console(void);
 #else
@@ -77,7 +77,7 @@ struct platform_suspend_ops {
 	void (*finish)(void);
 };
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_SUSPEND
 /**
  * suspend_set_ops - set platform dependent suspend operations
  * @ops: The new suspend operations to set.
@@ -104,12 +104,12 @@ extern void arch_suspend_disable_irqs(vo
 extern void arch_suspend_enable_irqs(void);
 
 extern int pm_suspend(suspend_state_t state);
-#else /* CONFIG_PM */
+#else /* !CONFIG_SUSPEND */
 #define suspend_valid_only_mem	NULL
 
 static inline void suspend_set_ops(struct platform_suspend_ops *ops) {}
 static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
-#endif /* CONFIG_PM */
+#endif /* !CONFIG_SUSPEND */
 
 /* struct pbe is used for creating lists of pages that should be restored
  * atomically during the resume from disk, because the page frames they have
@@ -173,7 +173,6 @@ struct platform_hibernation_ops {
 	void (*restore_cleanup)(void);
 };
 
-#ifdef CONFIG_PM
 #ifdef CONFIG_HIBERNATION
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
@@ -201,6 +200,7 @@ static inline void hibernation_set_ops(s
 static inline int hibernate(void) { return -ENOSYS; }
 #endif /* CONFIG_HIBERNATION */
 
+#ifdef CONFIG_PM_SLEEP
 void save_processor_state(void);
 void restore_processor_state(void);
 struct saved_context;
@@ -225,7 +225,7 @@ static inline int unregister_pm_notifier
 		{ .notifier_call = fn, .priority = pri };	\
 	register_pm_notifier(&fn##_nb);			\
 }
-#else /* CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 
 static inline int register_pm_notifier(struct notifier_block *nb)
 {
@@ -238,9 +238,9 @@ static inline int unregister_pm_notifier
 }
 
 #define pm_notifier(fn, pri)	do { (void)(fn); } while (0)
-#endif /* CONFIG_PM */
+#endif /* !CONFIG_PM_SLEEP */
 
-#if !defined CONFIG_HIBERNATION || !defined(CONFIG_PM)
+#ifndef CONFIG_HIBERNATION
 static inline void register_nosave_region(unsigned long b, unsigned long e)
 {
 }
include/linux/pm.h +4 -4
Index: linux-2.6.23-rc1/include/linux/pm.h
===================================================================
@@ -175,7 +175,7 @@ typedef struct pm_message {
 struct dev_pm_info {
 	pm_message_t		power_state;
 	unsigned		can_wakeup:1;
-#ifdef	CONFIG_PM
+#ifdef	CONFIG_PM_SLEEP
 	unsigned		should_wakeup:1;
 	struct list_head	entry;
 #endif
@@ -185,7 +185,7 @@ extern int device_power_down(pm_message_
 extern void device_power_up(void);
 extern void device_resume(void);
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 extern int device_suspend(pm_message_t state);
 extern int device_prepare_suspend(pm_message_t state);
 
@@ -215,7 +215,7 @@ static inline int call_platform_enable_w
 	return 0;
 }
 
-#else /* !CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 
 static inline int device_suspend(pm_message_t state)
 {
@@ -232,7 +232,7 @@ static inline int call_platform_enable_w
 	return 0;
 }
 
-#endif
+#endif /* !CONFIG_PM_SLEEP */
 
 /* changes to device_may_wakeup take effect on the next pm state change.
  * by default, devices should wakeup if they can.
kernel/power/power.h +9 -1
Index: linux-2.6.23-rc1/kernel/power/power.h
===================================================================
@@ -176,9 +176,17 @@ struct timeval;
 extern void swsusp_show_speed(struct timeval *, struct timeval *,
 				unsigned int, char *);
 
+#ifdef CONFIG_SUSPEND
 /* kernel/power/main.c */
-extern int suspend_enter(suspend_state_t state);
 extern int suspend_devices_and_enter(suspend_state_t state);
+#else /* !CONFIG_SUSPEND */
+static inline int suspend_devices_and_enter(suspend_state_t state)
+{
+	return -ENOSYS;
+}
+#endif /* !CONFIG_SUSPEND */
+
+/* kernel/power/common.c */
 extern struct blocking_notifier_head pm_chain_head;
 
 static inline int pm_notifier_call_chain(unsigned long val)
kernel/power/main.c +18 -8
Index: linux-2.6.23-rc1/kernel/power/main.c
===================================================================
@@ -26,14 +26,16 @@
 
 BLOCKING_NOTIFIER_HEAD(pm_chain_head);
 
-/*This is just an arbitrary number */
-#define FREE_PAGE_NUMBER (100)
-
 DEFINE_MUTEX(pm_mutex);
 
 unsigned int pm_flags;
 EXPORT_SYMBOL(pm_flags);
 
+#ifdef CONFIG_SUSPEND
+
+/* This is just an arbitrary number */
+#define FREE_PAGE_NUMBER (100)
+
 static struct platform_suspend_ops *suspend_ops;
 
 /**
@@ -272,6 +274,8 @@ int pm_suspend(suspend_state_t state)
 
 EXPORT_SYMBOL(pm_suspend);
 
+#endif /* CONFIG_SUSPEND */
+
 decl_subsys(power,NULL,NULL);
 
 
@@ -288,13 +292,15 @@ decl_subsys(power,NULL,NULL);
 
 static ssize_t state_show(struct kset *kset, char *buf)
 {
+	char *s = buf;
+#ifdef CONFIG_SUSPEND
 	int i;
-	char * s = buf;
 
 	for (i = 0; i < PM_SUSPEND_MAX; i++) {
 		if (pm_states[i] && valid_state(i))
 			s += sprintf(s,"%s ", pm_states[i]);
 	}
+#endif
 #ifdef CONFIG_HIBERNATION
 	s += sprintf(s, "%s\n", "disk");
 #else
@@ -307,11 +313,13 @@ static ssize_t state_show(struct kset *k
 
 static ssize_t state_store(struct kset *kset, const char *buf, size_t n)
 {
+#ifdef CONFIG_SUSPEND
 	suspend_state_t state = PM_SUSPEND_STANDBY;
 	const char * const *s;
+#endif
 	char *p;
-	int error;
 	int len;
+	int error = -EINVAL;
 
 	p = memchr(buf, '\n', n);
 	len = p ? p - buf : n;
@@ -319,17 +327,19 @@ static ssize_t state_store(struct kset *
 	/* First, check if we are requested to hibernate */
 	if (len == 4 && !strncmp(buf, "disk", len)) {
 		error = hibernate();
-		return error ? error : n;
+  goto Exit;
 	}
 
+#ifdef CONFIG_SUSPEND
 	for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) {
 		if (*s && len == strlen(*s) && !strncmp(buf, *s, len))
 			break;
 	}
 	if (state < PM_SUSPEND_MAX && *s)
 		error = enter_state(state);
-	else
-		error = -EINVAL;
+#endif
+
+ Exit:
 	return error ? error : n;
 }
 
drivers/acpi/Kconfig +1 -1
Index: linux-2.6.23-rc1/drivers/acpi/Kconfig
===================================================================
@@ -44,7 +44,7 @@ if ACPI
 
 config ACPI_SLEEP
 	bool "Sleep States"
-	depends on X86 && (!SMP || SUSPEND_SMP)
+	depends on X86 && PM_SLEEP
 	default y
 	---help---
 	  This option adds support for ACPI suspend states. 
mm/page_alloc.c +2 -2
Index: linux-2.6.23-rc1/mm/page_alloc.c
===================================================================
@@ -726,7 +726,7 @@ static void __drain_pages(unsigned int c
 	}
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_HIBERNATION
 
 void mark_free_pages(struct zone *zone)
 {
@@ -772,7 +772,7 @@ void drain_local_pages(void)
 	__drain_pages(smp_processor_id());
 	local_irq_restore(flags);	
 }
-#endif /* CONFIG_PM */
+#endif /* CONFIG_HIBERNATION */
 
 /*
  * Free a 0-order page
drivers/base/power/power.h +2 -2
Index: linux-2.6.23-rc1/drivers/base/power/power.h
===================================================================
@@ -5,7 +5,7 @@
 extern void device_shutdown(void);
 
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 
 /*
  * main.c
@@ -62,7 +62,7 @@ extern int resume_device(struct device *
  */
 extern int suspend_device(struct device *, pm_message_t);
 
-#else /* CONFIG_PM */
+#else /* CONFIG_PM_SLEEP */
 
 
 static inline int device_pm_add(struct device * dev)
include/linux/freezer.h +3 -3
Index: linux-2.6.23-rc1/include/linux/freezer.h
===================================================================
@@ -6,7 +6,7 @@
 #include <linux/sched.h>
 #include <linux/wait.h>
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 /*
  * Check if a process has been frozen
  */
@@ -157,7 +157,7 @@ static inline void set_freezable(void)
 	} while (try_to_freeze());					\
 	__ret;								\
 })
-#else /* CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 static inline int frozen(struct task_struct *p) { return 0; }
 static inline int freezing(struct task_struct *p) { return 0; }
 static inline void set_freeze_flag(struct task_struct *p) {}
@@ -181,6 +181,6 @@ static inline void set_freezable(void) {
 #define wait_event_freezable_timeout(wq, condition, timeout)		\
 		wait_event_interruptible_timeout(wq, condition, timeout)
 
-#endif /* CONFIG_PM */
+#endif /* !CONFIG_PM_SLEEP */
 
 #endif	/* FREEZER_H_INCLUDED */
include/acpi/acpi_bus.h +7 -0
Index: linux-2.6.23-rc1/include/acpi/acpi_bus.h
===================================================================
@@ -365,7 +365,14 @@ acpi_handle acpi_get_child(acpi_handle, 
 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
 
+#ifdef CONFIG_ACPI_SLEEP
 int acpi_pm_device_sleep_state(struct device *, int, int *);
+#else /* !CONFIG_ACPI_SLEEP */
+static inline int acpi_pm_device_sleep_state(struct device *d, int w, int *p)
+{
+	return ACPI_STATE_D3;
+}
+#endif /* !CONFIG_ACPI_SLEEP */
 
 #endif				/* CONFIG_ACPI */
 
#56 lore raw

PATCH 2/2 Introduce CONFIG_SUSPEND

In reply to Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Introduce CONFIG_SUSPEND representing the ability to enter system sleep states, such as the ACPI S3 state, and allow the user to choose SUSPEND and HIBERNATION independently of each other.

Make HOTPLUG_CPU be selected automatically if SUSPEND or HIBERNATION has been chosen and the kernel is intended for SMP systems.

Also, introduce CONFIG_PM_SLEEP which is automatically selected if CONFIG_SUSPEND or CONFIG_HIBERNATION is set and make CONFIG_ACPI_SLEEP depend on it.

The top-level power management headers are modified to use the new definitions. Still, there are many other files in which CONFIG_PM can be replaced with CONFIG_PM_SLEEP or even with CONFIG_SUSPEND, but they can be updated in the future.

---
 drivers/acpi/Kconfig        |    2 +-
 drivers/base/power/Makefile |    6 +++---
 drivers/base/power/power.h  |    4 ++--
 include/acpi/acpi_bus.h     |    7 +++++++
 include/linux/freezer.h     |    6 +++---
 include/linux/pm.h          |    8 ++++----
 include/linux/suspend.h     |   16 ++++++++--------
 kernel/power/Kconfig        |   39 +++++++++++++++++++++++++++++++--------
 kernel/power/Makefile       |    3 ++-
 kernel/power/main.c         |   26 ++++++++++++++++++--------
 kernel/power/power.h        |   10 +++++++++-
 mm/page_alloc.c             |    4 ++--
 12 files changed, 90 insertions(+), 41 deletions(-)
kernel/power/Kconfig +31 -8
Index: linux-2.6.23-rc1/kernel/power/Kconfig
===================================================================
@@ -46,7 +46,7 @@ config PM_VERBOSE
 
 config DISABLE_CONSOLE_SUSPEND
 	bool "Keep console(s) enabled during suspend/resume (DANGEROUS)"
-	depends on PM_DEBUG
+	depends on PM_DEBUG && PM_SLEEP
 	default n
 	---help---
 	This option turns off the console suspend mechanism that prevents
@@ -57,7 +57,7 @@ config DISABLE_CONSOLE_SUSPEND
 
 config PM_TRACE
 	bool "Suspend/resume event tracing"
-	depends on PM_DEBUG && X86 && EXPERIMENTAL
+	depends on PM_DEBUG && X86 && PM_SLEEP && EXPERIMENTAL
 	default n
 	---help---
 	This enables some cheesy code to save the last PM event point in the
@@ -72,9 +72,37 @@ 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_SMP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+	depends on SMP
+	default y
+
+config SUSPEND_SMP
+	bool
+	depends on SUSPEND_SMP_POSSIBLE && PM_SLEEP
+	select HOTPLUG_CPU
+	default y
+
+config PM_SLEEP
+	bool
+	depends on SUSPEND || HIBERNATION
+	default y
+
+config SUSPEND
+	bool "Suspend"
+	depends on PM
+	depends on !SMP || SUSPEND_SMP_POSSIBLE
+	default y
+	---help---
+	  Allow the system to enter sleep states in which main memory is
+	  powered and thus its contents are preserved, such as the
+	  suspend-to-RAM state (i.e. the ACPI S3 state).
+
 config HIBERNATION
 	bool "Hibernation"
-	depends on PM && SWAP && (((X86 || PPC64_SWSUSP) && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP))
+	depends on PM && SWAP
+	depends on ((X86 || PPC64_SWSUSP || FRV || PPC32) && !SMP) || SUSPEND_SMP_POSSIBLE
 	---help---
 	  Enable the suspend to disk (STD) functionality, which is usually
 	  called "hibernation" in user interfaces.  STD checkpoints the
@@ -132,11 +160,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
kernel/power/Makefile +2 -1
Index: linux-2.6.23-rc1/kernel/power/Makefile
===================================================================
@@ -3,8 +3,9 @@ ifeq ($(CONFIG_PM_DEBUG),y)
 EXTRA_CFLAGS	+=	-DDEBUG
 endif
 
-obj-y				:= main.o process.o console.o
+obj-y				:= main.o
 obj-$(CONFIG_PM_LEGACY)		+= pm.o
+obj-$(CONFIG_PM_SLEEP)		+= process.o console.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o disk.o snapshot.o swap.o user.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
drivers/base/power/Makefile +3 -3
Index: linux-2.6.23-rc1/drivers/base/power/Makefile
===================================================================
@@ -1,6 +1,6 @@
-obj-y			:= shutdown.o
-obj-$(CONFIG_PM)	+= main.o suspend.o resume.o sysfs.o
-obj-$(CONFIG_PM_TRACE)	+= trace.o
+obj-y				:= shutdown.o
+obj-$(CONFIG_PM_SLEEP)	+= main.o suspend.o resume.o sysfs.o
+obj-$(CONFIG_PM_TRACE)		+= trace.o
 
 ifeq ($(CONFIG_DEBUG_DRIVER),y)
 EXTRA_CFLAGS += -DDEBUG
include/linux/suspend.h +8 -8
Index: linux-2.6.23-rc1/include/linux/suspend.h
===================================================================
@@ -10,7 +10,7 @@
 #include <linux/pm.h>
 #include <linux/mm.h>
 
-#if defined(CONFIG_PM) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
 extern int pm_prepare_console(void);
 extern void pm_restore_console(void);
 #else
@@ -77,7 +77,7 @@ struct platform_suspend_ops {
 	void (*finish)(void);
 };
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_SUSPEND
 /**
  * suspend_set_ops - set platform dependent suspend operations
  * @ops: The new suspend operations to set.
@@ -104,12 +104,12 @@ extern void arch_suspend_disable_irqs(vo
 extern void arch_suspend_enable_irqs(void);
 
 extern int pm_suspend(suspend_state_t state);
-#else /* CONFIG_PM */
+#else /* !CONFIG_SUSPEND */
 #define suspend_valid_only_mem	NULL
 
 static inline void suspend_set_ops(struct platform_suspend_ops *ops) {}
 static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
-#endif /* CONFIG_PM */
+#endif /* !CONFIG_SUSPEND */
 
 /* struct pbe is used for creating lists of pages that should be restored
  * atomically during the resume from disk, because the page frames they have
@@ -173,7 +173,6 @@ struct platform_hibernation_ops {
 	void (*restore_cleanup)(void);
 };
 
-#ifdef CONFIG_PM
 #ifdef CONFIG_HIBERNATION
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
@@ -201,6 +200,7 @@ static inline void hibernation_set_ops(s
 static inline int hibernate(void) { return -ENOSYS; }
 #endif /* CONFIG_HIBERNATION */
 
+#ifdef CONFIG_PM_SLEEP
 void save_processor_state(void);
 void restore_processor_state(void);
 struct saved_context;
@@ -225,7 +225,7 @@ static inline int unregister_pm_notifier
 		{ .notifier_call = fn, .priority = pri };	\
 	register_pm_notifier(&fn##_nb);			\
 }
-#else /* CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 
 static inline int register_pm_notifier(struct notifier_block *nb)
 {
@@ -238,9 +238,9 @@ static inline int unregister_pm_notifier
 }
 
 #define pm_notifier(fn, pri)	do { (void)(fn); } while (0)
-#endif /* CONFIG_PM */
+#endif /* !CONFIG_PM_SLEEP */
 
-#if !defined CONFIG_HIBERNATION || !defined(CONFIG_PM)
+#ifndef CONFIG_HIBERNATION
 static inline void register_nosave_region(unsigned long b, unsigned long e)
 {
 }
include/linux/pm.h +4 -4
Index: linux-2.6.23-rc1/include/linux/pm.h
===================================================================
@@ -175,7 +175,7 @@ typedef struct pm_message {
 struct dev_pm_info {
 	pm_message_t		power_state;
 	unsigned		can_wakeup:1;
-#ifdef	CONFIG_PM
+#ifdef	CONFIG_PM_SLEEP
 	unsigned		should_wakeup:1;
 	struct list_head	entry;
 #endif
@@ -185,7 +185,7 @@ extern int device_power_down(pm_message_
 extern void device_power_up(void);
 extern void device_resume(void);
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 extern int device_suspend(pm_message_t state);
 extern int device_prepare_suspend(pm_message_t state);
 
@@ -215,7 +215,7 @@ static inline int call_platform_enable_w
 	return 0;
 }
 
-#else /* !CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 
 static inline int device_suspend(pm_message_t state)
 {
@@ -232,7 +232,7 @@ static inline int call_platform_enable_w
 	return 0;
 }
 
-#endif
+#endif /* !CONFIG_PM_SLEEP */
 
 /* changes to device_may_wakeup take effect on the next pm state change.
  * by default, devices should wakeup if they can.
kernel/power/power.h +9 -1
Index: linux-2.6.23-rc1/kernel/power/power.h
===================================================================
@@ -176,9 +176,17 @@ struct timeval;
 extern void swsusp_show_speed(struct timeval *, struct timeval *,
 				unsigned int, char *);
 
+#ifdef CONFIG_SUSPEND
 /* kernel/power/main.c */
-extern int suspend_enter(suspend_state_t state);
 extern int suspend_devices_and_enter(suspend_state_t state);
+#else /* !CONFIG_SUSPEND */
+static inline int suspend_devices_and_enter(suspend_state_t state)
+{
+	return -ENOSYS;
+}
+#endif /* !CONFIG_SUSPEND */
+
+/* kernel/power/common.c */
 extern struct blocking_notifier_head pm_chain_head;
 
 static inline int pm_notifier_call_chain(unsigned long val)
kernel/power/main.c +18 -8
Index: linux-2.6.23-rc1/kernel/power/main.c
===================================================================
@@ -26,14 +26,16 @@
 
 BLOCKING_NOTIFIER_HEAD(pm_chain_head);
 
-/*This is just an arbitrary number */
-#define FREE_PAGE_NUMBER (100)
-
 DEFINE_MUTEX(pm_mutex);
 
 unsigned int pm_flags;
 EXPORT_SYMBOL(pm_flags);
 
+#ifdef CONFIG_SUSPEND
+
+/* This is just an arbitrary number */
+#define FREE_PAGE_NUMBER (100)
+
 static struct platform_suspend_ops *suspend_ops;
 
 /**
@@ -272,6 +274,8 @@ int pm_suspend(suspend_state_t state)
 
 EXPORT_SYMBOL(pm_suspend);
 
+#endif /* CONFIG_SUSPEND */
+
 decl_subsys(power,NULL,NULL);
 
 
@@ -288,13 +292,15 @@ decl_subsys(power,NULL,NULL);
 
 static ssize_t state_show(struct kset *kset, char *buf)
 {
+	char *s = buf;
+#ifdef CONFIG_SUSPEND
 	int i;
-	char * s = buf;
 
 	for (i = 0; i < PM_SUSPEND_MAX; i++) {
 		if (pm_states[i] && valid_state(i))
 			s += sprintf(s,"%s ", pm_states[i]);
 	}
+#endif
 #ifdef CONFIG_HIBERNATION
 	s += sprintf(s, "%s\n", "disk");
 #else
@@ -307,11 +313,13 @@ static ssize_t state_show(struct kset *k
 
 static ssize_t state_store(struct kset *kset, const char *buf, size_t n)
 {
+#ifdef CONFIG_SUSPEND
 	suspend_state_t state = PM_SUSPEND_STANDBY;
 	const char * const *s;
+#endif
 	char *p;
-	int error;
 	int len;
+	int error = -EINVAL;
 
 	p = memchr(buf, '\n', n);
 	len = p ? p - buf : n;
@@ -319,17 +327,19 @@ static ssize_t state_store(struct kset *
 	/* First, check if we are requested to hibernate */
 	if (len == 4 && !strncmp(buf, "disk", len)) {
 		error = hibernate();
-		return error ? error : n;
+  goto Exit;
 	}
 
+#ifdef CONFIG_SUSPEND
 	for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) {
 		if (*s && len == strlen(*s) && !strncmp(buf, *s, len))
 			break;
 	}
 	if (state < PM_SUSPEND_MAX && *s)
 		error = enter_state(state);
-	else
-		error = -EINVAL;
+#endif
+
+ Exit:
 	return error ? error : n;
 }
 
drivers/acpi/Kconfig +1 -1
Index: linux-2.6.23-rc1/drivers/acpi/Kconfig
===================================================================
@@ -44,7 +44,7 @@ if ACPI
 
 config ACPI_SLEEP
 	bool "Sleep States"
-	depends on X86 && (!SMP || SUSPEND_SMP)
+	depends on X86 && PM_SLEEP
 	default y
 	---help---
 	  This option adds support for ACPI suspend states. 
mm/page_alloc.c +2 -2
Index: linux-2.6.23-rc1/mm/page_alloc.c
===================================================================
@@ -726,7 +726,7 @@ static void __drain_pages(unsigned int c
 	}
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_HIBERNATION
 
 void mark_free_pages(struct zone *zone)
 {
@@ -772,7 +772,7 @@ void drain_local_pages(void)
 	__drain_pages(smp_processor_id());
 	local_irq_restore(flags);	
 }
-#endif /* CONFIG_PM */
+#endif /* CONFIG_HIBERNATION */
 
 /*
  * Free a 0-order page
drivers/base/power/power.h +2 -2
Index: linux-2.6.23-rc1/drivers/base/power/power.h
===================================================================
@@ -5,7 +5,7 @@
 extern void device_shutdown(void);
 
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 
 /*
  * main.c
@@ -62,7 +62,7 @@ extern int resume_device(struct device *
  */
 extern int suspend_device(struct device *, pm_message_t);
 
-#else /* CONFIG_PM */
+#else /* CONFIG_PM_SLEEP */
 
 
 static inline int device_pm_add(struct device * dev)
include/linux/freezer.h +3 -3
Index: linux-2.6.23-rc1/include/linux/freezer.h
===================================================================
@@ -6,7 +6,7 @@
 #include <linux/sched.h>
 #include <linux/wait.h>
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 /*
  * Check if a process has been frozen
  */
@@ -157,7 +157,7 @@ static inline void set_freezable(void)
 	} while (try_to_freeze());					\
 	__ret;								\
 })
-#else /* CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 static inline int frozen(struct task_struct *p) { return 0; }
 static inline int freezing(struct task_struct *p) { return 0; }
 static inline void set_freeze_flag(struct task_struct *p) {}
@@ -181,6 +181,6 @@ static inline void set_freezable(void) {
 #define wait_event_freezable_timeout(wq, condition, timeout)		\
 		wait_event_interruptible_timeout(wq, condition, timeout)
 
-#endif /* CONFIG_PM */
+#endif /* !CONFIG_PM_SLEEP */
 
 #endif	/* FREEZER_H_INCLUDED */
include/acpi/acpi_bus.h +7 -0
Index: linux-2.6.23-rc1/include/acpi/acpi_bus.h
===================================================================
@@ -365,7 +365,14 @@ acpi_handle acpi_get_child(acpi_handle, 
 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
 
+#ifdef CONFIG_ACPI_SLEEP
 int acpi_pm_device_sleep_state(struct device *, int, int *);
+#else /* !CONFIG_ACPI_SLEEP */
+static inline int acpi_pm_device_sleep_state(struct device *d, int w, int *p)
+{
+	return ACPI_STATE_D3;
+}
+#endif /* !CONFIG_ACPI_SLEEP */
 
 #endif				/* CONFIG_ACPI */
 
#40 lore raw

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

In reply to Rafael J. Wysocki

kernel/power/Kconfig config PM_TRACE · line 93

Quoted 3 lines · Rafael J. Wysocki

...

kernel/power/Kconfig +2 -0
+config SUSPEND
+	bool "Suspend"

  "Suspend to RAM"

Quoted 4 lines

...
config HIBERNATION
bool "Hibernation"
... "Hibernation (Suspend to disk)"

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#41 lore raw

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

In reply to Rafael J. Wysocki

kernel/power/Kconfig config PM_TRACE · line 93

Quoted 3 lines · Rafael J. Wysocki

...

kernel/power/Kconfig +2 -0
+config SUSPEND
+	bool "Suspend"

  "Suspend to RAM"

Quoted 4 lines

...
config HIBERNATION
bool "Hibernation"
... "Hibernation (Suspend to disk)"

cu
Adrian

Signature · 9 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#42 lore raw

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

Quoted 5 lines · Adrian Bunk

kernel/power/Kconfig config PM_TRACE · line 93

Quoted 3 lines · Rafael J. Wysocki

...

kernel/power/Kconfig +2 -0
+config SUSPEND
+	bool "Suspend"

  "Suspend to RAM"

Not only. This also includes "standby".

Quoted 7 lines
Quoted 4 lines

...
config HIBERNATION
bool "Hibernation"
... "Hibernation (Suspend to disk)"

cu
Adrian

Greetings,
Rafael

Signature · 5 lines
"Premature optimization is the root of all evil." - Donald Knuth
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#55 lore raw

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

In reply to Adrian Bunk
Quoted 5 lines · Adrian Bunk

kernel/power/Kconfig config PM_TRACE · line 93

Quoted 3 lines · Rafael J. Wysocki

...

kernel/power/Kconfig +2 -0
+config SUSPEND
+	bool "Suspend"

  "Suspend to RAM"

Not only. This also includes "standby".

Quoted 7 lines
Quoted 4 lines

...
config HIBERNATION
bool "Hibernation"
... "Hibernation (Suspend to disk)"

cu
Adrian

Greetings,
Rafael

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

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

In reply to Rafael J. Wysocki
Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines · Adrian Bunk

kernel/power/Kconfig config PM_TRACE · line 93

Quoted 3 lines · Rafael J. Wysocki

...

kernel/power/Kconfig +2 -0
+config SUSPEND
+	bool "Suspend"

  "Suspend to RAM"

Not only. This also includes "standby".

Whatever it includes - please tell it to the user in the prompt.

Technical issues are important, but it's often forgotten how many problems people run into because the description of a kconfig option could have been better.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

...
config HIBERNATION
bool "Hibernation"
... "Hibernation (Suspend to disk)"

Quoted 9 lines
Quoted 2 lines

cu
Adrian

Greetings,
Rafael

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

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#44 lore raw

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

In reply to Rafael J. Wysocki
Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines · Adrian Bunk

kernel/power/Kconfig config PM_TRACE · line 93

Quoted 3 lines · Rafael J. Wysocki

...

kernel/power/Kconfig +2 -0
+config SUSPEND
+	bool "Suspend"

  "Suspend to RAM"

Not only. This also includes "standby".

Whatever it includes - please tell it to the user in the prompt.

Technical issues are important, but it's often forgotten how many problems people run into because the description of a kconfig option could have been better.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

...
config HIBERNATION
bool "Hibernation"
... "Hibernation (Suspend to disk)"

Quoted 9 lines
Quoted 2 lines

cu
Adrian

Greetings,
Rafael

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

cu
Adrian

Signature · 9 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#57 lore raw

cover Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated)

In reply to Rafael J. Wysocki
Quoted 12 lines · Rafael J. Wysocki
Quoted 10 lines · Linus Torvalds
Quoted 3 lines · Rafael J. Wysocki

OK, I'll prepare a patch to introduce CONFIG_SUSPEND, but that will require quite a bit of (compilation) testing on different architectures.

Sure. I'm not too worried, the fallout should be of the trivial kind.

Also, mind basing it on the (independent) cleanups that Adrian already sent out. This is all intertwined..

Quoted 8 lines

OK, it took more time than I had hoped, but I wanted CONFIG_HIBERNATION and CONFIG_SUSPEND to be really independent of each other.

The two patches in the next messages implement the idea:
* replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION
* introduce CONFIG_SUSPEND that selects CONFIG_HOTPLUG_CPU, if necessary, and make it possible to choose suspend and hibernation independently of each other.

Unfortunately, the patches that I have posted are against 2.6.23-rc1 with the suspend and hibernation patchset applied
(http://www.sisk.pl/kernel/hibernation_and_suspend/2.6.23-rc1/patches/) .

Sorry for that.

The corresponding patches on top of the current -git are in the next two messages.

They do the following:
* replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION
* introduce CONFIG_SUSPEND that selects CONFIG_HOTPLUG_CPU, if necessary, and make it possible to choose suspend and hibernation independently of each other
* update the top-level PM-related headers and the ACPI code related to suspend and hibernation to use the new definitions

Greetings,
Rafael

#58 lore raw

PATCH 1/2 Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION (updated)

From: Rafael J. Wysocki <[email protected]>

Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION to avoid confusion (among other things, with CONFIG_SUSPEND introduced in the next patch).

---
 arch/i386/Kconfig.debug                 |    4 ++--
 arch/i386/kernel/e820.c                 |    2 +-
 arch/i386/mm/init.c                     |    2 +-
 arch/i386/power/Makefile                |    2 +-
 arch/powerpc/Kconfig.debug              |    2 +-
 arch/powerpc/configs/lite5200_defconfig |    2 +-
 arch/powerpc/configs/pmac32_defconfig   |    2 +-
 arch/powerpc/kernel/Makefile            |    6 +++---
 arch/ppc/configs/TQM8540_defconfig      |    2 +-
 arch/ppc/configs/TQM8541_defconfig      |    2 +-
 arch/ppc/configs/TQM8555_defconfig      |    2 +-
 arch/ppc/configs/TQM8560_defconfig      |    2 +-
 arch/ppc/configs/ev64360_defconfig      |    2 +-
 arch/ppc/configs/ml300_defconfig        |    2 +-
 arch/ppc/configs/ml403_defconfig        |    2 +-
 arch/ppc/configs/mpc834x_sys_defconfig  |    2 +-
 arch/ppc/configs/prep_defconfig         |    2 +-
 arch/sparc64/Kconfig.debug              |    2 +-
 arch/x86_64/defconfig                   |    2 +-
 arch/x86_64/kernel/Makefile             |    2 +-
 arch/x86_64/kernel/suspend.c            |    4 ++--
 drivers/acpi/sleep/main.c               |    6 +++---
 drivers/acpi/sleep/proc.c               |    2 +-
 drivers/i2c/chips/tps65010.c            |    2 +-
 include/asm-i386/e820.h                 |    2 +-
 include/linux/suspend.h                 |    8 ++++----
 kernel/power/Kconfig                    |    6 +++---
 kernel/power/Makefile                   |    2 +-
 kernel/power/main.c                     |    2 +-
 kernel/power/power.h                    |    2 +-
 kernel/sys.c                            |    2 +-
 mm/Kconfig                              |    4 ++--
 mm/swapfile.c                           |    6 +++---
 33 files changed, 47 insertions(+), 47 deletions(-)
arch/i386/Kconfig.debug +2 -2
Index: linux-2.6/arch/i386/Kconfig.debug
===================================================================
@@ -36,11 +36,11 @@ config DEBUG_STACK_USAGE
 	  This option will slow down process creation somewhat.
 
 comment "Page alloc debug is incompatible with Software Suspend on i386"
-	depends on DEBUG_KERNEL && SOFTWARE_SUSPEND
+	depends on DEBUG_KERNEL && HIBERNATION
 
 config DEBUG_PAGEALLOC
 	bool "Debug page memory allocations"
-	depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND && !HUGETLBFS
+	depends on DEBUG_KERNEL && !HIBERNATION && !HUGETLBFS
 	help
 	  Unmap pages from the kernel linear mapping after free_pages().
 	  This results in a large slowdown, but helps to find certain types
arch/i386/kernel/e820.c +1 -1
Index: linux-2.6/arch/i386/kernel/e820.c
===================================================================
@@ -321,7 +321,7 @@ static int __init request_standard_resou
 
 subsys_initcall(request_standard_resources);
 
-#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
+#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
 /**
  * e820_mark_nosave_regions - Find the ranges of physical addresses that do not
  * correspond to e820 RAM areas and mark the corresponding pages as nosave for
arch/i386/mm/init.c +1 -1
Index: linux-2.6/arch/i386/mm/init.c
===================================================================
@@ -432,7 +432,7 @@ static void __init pagetable_init (void)
 	paravirt_pagetable_setup_done(pgd_base);
 }
 
-#if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_ACPI)
+#if defined(CONFIG_HIBERNATION) || defined(CONFIG_ACPI)
 /*
  * Swap suspend & friends need this for resume because things like the intel-agp
  * driver might have split up a kernel 4MB mapping.
arch/i386/power/Makefile +1 -1
Index: linux-2.6/arch/i386/power/Makefile
===================================================================
@@ -1,2 +1,2 @@
 obj-$(CONFIG_PM)		+= cpu.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o suspend.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o
arch/powerpc/Kconfig.debug +1 -1
Index: linux-2.6/arch/powerpc/Kconfig.debug
===================================================================
@@ -20,7 +20,7 @@ config DEBUG_STACK_USAGE
 
 config DEBUG_PAGEALLOC
         bool "Debug page memory allocations"
-        depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
+        depends on DEBUG_KERNEL && !HIBERNATION
         help
           Unmap pages from the kernel linear mapping after free_pages().
           This results in a large slowdown, but helps to find certain types
arch/powerpc/configs/lite5200_defconfig +1 -1
Index: linux-2.6/arch/powerpc/configs/lite5200_defconfig
===================================================================
@@ -196,7 +196,7 @@ CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
 # CONFIG_PM_SYSFS_DEPRECATED is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 # CONFIG_WANT_DEVICE_TREE is not set
 CONFIG_ISA_DMA_API=y
arch/powerpc/configs/pmac32_defconfig +1 -1
Index: linux-2.6/arch/powerpc/configs/pmac32_defconfig
===================================================================
@@ -218,7 +218,7 @@ CONFIG_PM=y
 CONFIG_PM_DEBUG=y
 # CONFIG_DISABLE_CONSOLE_SUSPEND is not set
 CONFIG_PM_SYSFS_DEPRECATED=y
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 CONFIG_APM_EMULATION=y
 CONFIG_SECCOMP=y
arch/powerpc/kernel/Makefile +3 -3
Index: linux-2.6/arch/powerpc/kernel/Makefile
===================================================================
@@ -37,9 +37,9 @@ obj-$(CONFIG_GENERIC_TBSYNC)	+= smp-tbsy
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_6xx)		+= idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
 obj-$(CONFIG_TAU)		+= tau_6xx.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o suspend.o
-obj32-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_32.o
-obj64-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_64.o swsusp_asm64.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o
+obj32-$(CONFIG_HIBERNATION) += swsusp_32.o
+obj64-$(CONFIG_HIBERNATION) += swsusp_64.o swsusp_asm64.o
 obj32-$(CONFIG_MODULES)		+= module_32.o
 
 ifeq ($(CONFIG_PPC_MERGE),y)
arch/ppc/configs/TQM8540_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/TQM8540_defconfig
===================================================================
@@ -136,7 +136,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/TQM8541_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/TQM8541_defconfig
===================================================================
@@ -138,7 +138,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/TQM8555_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/TQM8555_defconfig
===================================================================
@@ -138,7 +138,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/TQM8560_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/TQM8560_defconfig
===================================================================
@@ -137,7 +137,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/ev64360_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/ev64360_defconfig
===================================================================
@@ -142,7 +142,7 @@ CONFIG_BINFMT_MISC=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyMM0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/ml300_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/ml300_defconfig
===================================================================
@@ -148,7 +148,7 @@ CONFIG_BINFMT_ELF=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,9600"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/ml403_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/ml403_defconfig
===================================================================
@@ -149,7 +149,7 @@ CONFIG_BINFMT_ELF=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,9600"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/mpc834x_sys_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/mpc834x_sys_defconfig
===================================================================
@@ -130,7 +130,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/prep_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/prep_defconfig
===================================================================
@@ -166,7 +166,7 @@ CONFIG_PROC_PREPRESIDUAL=y
 CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 # CONFIG_SECCOMP is not set
 CONFIG_ISA_DMA_API=y
arch/sparc64/Kconfig.debug +1 -1
Index: linux-2.6/arch/sparc64/Kconfig.debug
===================================================================
@@ -29,7 +29,7 @@ config DEBUG_BOOTMEM
 
 config DEBUG_PAGEALLOC
 	bool "Debug page memory allocations"
-	depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
+	depends on DEBUG_KERNEL && !HIBERNATION
 	help
 	  Unmap pages from the kernel linear mapping after free_pages().
 	  This results in a large slowdown, but helps to find certain types
arch/x86_64/defconfig +1 -1
Index: linux-2.6/arch/x86_64/defconfig
===================================================================
@@ -199,7 +199,7 @@ CONFIG_GENERIC_PENDING_IRQ=y
 CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 CONFIG_SUSPEND_SMP=y
 
arch/x86_64/kernel/Makefile +1 -1
Index: linux-2.6/arch/x86_64/kernel/Makefile
===================================================================
@@ -26,7 +26,7 @@ obj-y				+= io_apic.o mpparse.o genapic.
 obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o crash.o
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_PM)		+= suspend.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend_asm.o
+obj-$(CONFIG_HIBERNATION)	+= suspend_asm.o
 obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 obj-$(CONFIG_IOMMU)		+= pci-gart.o aperture.o
arch/x86_64/kernel/suspend.c +2 -2
Index: linux-2.6/arch/x86_64/kernel/suspend.c
===================================================================
@@ -146,7 +146,7 @@ void fix_processor_context(void)
 
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /* Defined in arch/x86_64/kernel/suspend_asm.S */
 extern int restore_image(void);
 
@@ -236,4 +236,4 @@ int pfn_is_nosave(unsigned long pfn)
 	unsigned long nosave_end_pfn = PAGE_ALIGN(__pa_symbol(&__nosave_end)) >> PAGE_SHIFT;
 	return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
 }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
drivers/acpi/sleep/main.c +3 -3
Index: linux-2.6/drivers/acpi/sleep/main.c
===================================================================
@@ -202,7 +202,7 @@ static struct pm_ops acpi_pm_ops = {
 	.finish = acpi_pm_finish,
 };
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 static int acpi_hibernation_prepare(void)
 {
 	return acpi_sleep_prepare(ACPI_STATE_S4);
@@ -254,7 +254,7 @@ static struct hibernation_ops acpi_hiber
 	.pre_restore = acpi_hibernation_pre_restore,
 	.restore_cleanup = acpi_hibernation_restore_cleanup,
 };
-#endif				/* CONFIG_SOFTWARE_SUSPEND */
+#endif				/* CONFIG_HIBERNATION */
 
 /**
  *	acpi_pm_device_sleep_state - return preferred power state of ACPI device
@@ -374,7 +374,7 @@ int __init acpi_sleep_init(void)
 
 	pm_set_ops(&acpi_pm_ops);
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	if (sleep_states[ACPI_STATE_S4])
 		hibernation_set_ops(&acpi_hibernation_ops);
 #else
drivers/acpi/sleep/proc.c +1 -1
Index: linux-2.6/drivers/acpi/sleep/proc.c
===================================================================
@@ -66,7 +66,7 @@ acpi_system_write_sleep(struct file *fil
 		goto Done;
 	}
 	state = simple_strtoul(str, NULL, 0);
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	if (state == 4) {
 		error = hibernate();
 		goto Done;
drivers/i2c/chips/tps65010.c +1 -1
Index: linux-2.6/drivers/i2c/chips/tps65010.c
===================================================================
@@ -352,7 +352,7 @@ static void tps65010_interrupt(struct tp
 			/* REVISIT:  this might need its own workqueue
 			 * plus tweaks including deadlock avoidance ...
 			 * also needs to get error handling and probably
-			 * an #ifdef CONFIG_SOFTWARE_SUSPEND
+			 * an #ifdef CONFIG_HIBERNATION
 			 */
 			hibernate();
 #endif
include/asm-i386/e820.h +1 -1
Index: linux-2.6/include/asm-i386/e820.h
===================================================================
@@ -47,7 +47,7 @@ extern void e820_register_memory(void);
 extern void limit_regions(unsigned long long size);
 extern void print_memory_map(char *who);
 
-#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
+#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
 extern void e820_mark_nosave_regions(void);
 #else
 static inline void e820_mark_nosave_regions(void)
include/linux/suspend.h +4 -4
Index: linux-2.6/include/linux/suspend.h
===================================================================
@@ -55,7 +55,7 @@ struct hibernation_ops {
 };
 
 #ifdef CONFIG_PM
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
 static inline void register_nosave_region(unsigned long b, unsigned long e)
@@ -73,14 +73,14 @@ extern unsigned long get_safe_page(gfp_t
 
 extern void hibernation_set_ops(struct hibernation_ops *ops);
 extern int hibernate(void);
-#else /* CONFIG_SOFTWARE_SUSPEND */
+#else /* CONFIG_HIBERNATION */
 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
 static inline void swsusp_set_page_free(struct page *p) {}
 static inline void swsusp_unset_page_free(struct page *p) {}
 
 static inline void hibernation_set_ops(struct hibernation_ops *ops) {}
 static inline int hibernate(void) { return -ENOSYS; }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
 
 void save_processor_state(void);
 void restore_processor_state(void);
@@ -121,7 +121,7 @@ static inline int unregister_pm_notifier
 #define pm_notifier(fn, pri)	do { (void)(fn); } while (0)
 #endif /* CONFIG_PM */
 
-#if !defined CONFIG_SOFTWARE_SUSPEND || !defined(CONFIG_PM)
+#if !defined CONFIG_HIBERNATION || !defined(CONFIG_PM)
 static inline void register_nosave_region(unsigned long b, unsigned long e)
 {
 }
kernel/power/Kconfig +3 -3
Index: linux-2.6/kernel/power/Kconfig
===================================================================
@@ -72,8 +72,8 @@ 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 SOFTWARE_SUSPEND
-	bool "Software Suspend (Hibernation)"
+config HIBERNATION
+	bool "Hibernation"
 	depends on PM && SWAP && (((X86 || PPC64_SWSUSP) && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP))
 	---help---
 	  Enable the suspend to disk (STD) functionality, which is usually
@@ -112,7 +112,7 @@ config SOFTWARE_SUSPEND
 
 config PM_STD_PARTITION
 	string "Default resume partition"
-	depends on SOFTWARE_SUSPEND
+	depends on HIBERNATION
 	default ""
 	---help---
 	  The default resume partition is the partition that the suspend-
kernel/power/Makefile +1 -1
Index: linux-2.6/kernel/power/Makefile
===================================================================
@@ -5,6 +5,6 @@ endif
 
 obj-y				:= main.o process.o console.o
 obj-$(CONFIG_PM_LEGACY)		+= pm.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o disk.o snapshot.o swap.o user.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o disk.o snapshot.o swap.o user.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
kernel/power/main.c +1 -1
Index: linux-2.6/kernel/power/main.c
===================================================================
@@ -292,7 +292,7 @@ static ssize_t state_show(struct kset *k
 		if (pm_states[i] && valid_state(i))
 			s += sprintf(s,"%s ", pm_states[i]);
 	}
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	s += sprintf(s, "%s\n", "disk");
 #else
 	if (s != buf)
kernel/power/power.h +1 -1
Index: linux-2.6/kernel/power/power.h
===================================================================
@@ -13,7 +13,7 @@ struct swsusp_info {
 
 
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Keep some memory free so that I/O operations can succeed without paging
  * [Might this be more than 4 MB?]
kernel/sys.c +1 -1
Index: linux-2.6/kernel/sys.c
===================================================================
@@ -954,7 +954,7 @@ asmlinkage long sys_reboot(int magic1, i
 		unlock_kernel();
 		return -EINVAL;
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	case LINUX_REBOOT_CMD_SW_SUSPEND:
 		{
 			int ret = hibernate();
mm/Kconfig +2 -2
Index: linux-2.6/mm/Kconfig
===================================================================
@@ -116,11 +116,11 @@ config SPARSEMEM_EXTREME
 config MEMORY_HOTPLUG
 	bool "Allow for memory hot-add"
 	depends on SPARSEMEM || X86_64_ACPI_NUMA
-	depends on HOTPLUG && !SOFTWARE_SUSPEND && ARCH_ENABLE_MEMORY_HOTPLUG
+	depends on HOTPLUG && !HIBERNATION && ARCH_ENABLE_MEMORY_HOTPLUG
 	depends on (IA64 || X86 || PPC64 || SUPERH)
 
 comment "Memory hotplug is currently incompatible with Software Suspend"
-	depends on SPARSEMEM && HOTPLUG && SOFTWARE_SUSPEND
+	depends on SPARSEMEM && HOTPLUG && HIBERNATION
 
 config MEMORY_HOTPLUG_SPARSE
 	def_bool y
mm/swapfile.c +3 -3
Index: linux-2.6/mm/swapfile.c
===================================================================
@@ -425,7 +425,7 @@ void free_swap_and_cache(swp_entry_t ent
 	}
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Find the swap type that corresponds to given device (if any).
  *
@@ -951,7 +951,7 @@ sector_t map_swap_page(struct swap_info_
 	}
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Get the (PAGE_SIZE) block corresponding to given offset on the swapdev
  * corresponding to given index in swap_info (swap type).
@@ -966,7 +966,7 @@ sector_t swapdev_block(int swap_type, pg
 	sis = swap_info + swap_type;
 	return (sis->flags & SWP_WRITEOK) ? map_swap_page(sis, offset) : 0;
 }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
 
 /*
  * Free all of a swapdev's extent information
#60 lore raw

PATCH 2/2 Introduce CONFIG_SUSPEND (updated)

In reply to Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Introduce CONFIG_SUSPEND representing the ability to enter system sleep states, such as the ACPI S3 state, and allow the user to choose SUSPEND and HIBERNATION independently of each other.

Make HOTPLUG_CPU be selected automatically if SUSPEND or HIBERNATION has been chosen and the kernel is intended for SMP systems.

Also, introduce CONFIG_PM_SLEEP which is automatically selected if CONFIG_SUSPEND or CONFIG_HIBERNATION is set and use it to select the code needed for both suspend and hibernation.

The top-level power management headers and the ACPI code related to suspend and hibernation are modified to use the new definitions (the changes in drivers/acpi/sleep/main.c are, mostly, moving code to reduce the number of ifdefs). Still, there are many other files in which CONFIG_PM can be replaced with CONFIG_PM_SLEEP or even with CONFIG_SUSPEND, but they can be updated in the future.

---
 drivers/acpi/Kconfig        |    8 +++
 drivers/acpi/sleep/Makefile |    2 
 drivers/acpi/sleep/main.c   |   94 +++++++++++++++++++++++---------------------
 drivers/acpi/sleep/proc.c   |   10 ++--
 drivers/acpi/sleep/sleep.h  |    2 
 drivers/base/power/Makefile |    2 
 drivers/base/power/power.h  |    4 -
 include/acpi/acpi_bus.h     |    9 ++++
 include/acpi/acpi_drivers.h |    4 +
 include/linux/freezer.h     |    6 +-
 include/linux/pm.h          |   15 +++++--
 include/linux/suspend.h     |   10 ++--
 kernel/power/Kconfig        |   39 ++++++++++++++----
 kernel/power/Makefile       |    3 -
 kernel/power/main.c         |   26 ++++++++----
 kernel/power/power.h        |   10 ++++
 mm/page_alloc.c             |    4 -
 17 files changed, 163 insertions(+), 85 deletions(-)
kernel/power/Kconfig +31 -8
Index: linux-2.6/kernel/power/Kconfig
===================================================================
@@ -46,7 +46,7 @@ config PM_VERBOSE
 
 config DISABLE_CONSOLE_SUSPEND
 	bool "Keep console(s) enabled during suspend/resume (DANGEROUS)"
-	depends on PM_DEBUG
+	depends on PM_DEBUG && PM_SLEEP
 	default n
 	---help---
 	This option turns off the console suspend mechanism that prevents
@@ -57,7 +57,7 @@ config DISABLE_CONSOLE_SUSPEND
 
 config PM_TRACE
 	bool "Suspend/resume event tracing"
-	depends on PM_DEBUG && X86 && EXPERIMENTAL
+	depends on PM_DEBUG && X86 && PM_SLEEP && EXPERIMENTAL
 	default n
 	---help---
 	This enables some cheesy code to save the last PM event point in the
@@ -72,9 +72,37 @@ 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_SMP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+	depends on SMP
+	default y
+
+config SUSPEND_SMP
+	bool
+	depends on SUSPEND_SMP_POSSIBLE && PM_SLEEP
+	select HOTPLUG_CPU
+	default y
+
+config PM_SLEEP
+	bool
+	depends on SUSPEND || HIBERNATION
+	default y
+
+config SUSPEND
+	bool "Suspend to RAM and standby"
+	depends on PM
+	depends on !SMP || SUSPEND_SMP_POSSIBLE
+	default y
+	---help---
+	  Allow the system to enter sleep states in which main memory is
+	  powered and thus its contents are preserved, such as the
+	  suspend-to-RAM state (i.e. the ACPI S3 state).
+
 config HIBERNATION
 	bool "Hibernation"
-	depends on PM && SWAP && (((X86 || PPC64_SWSUSP) && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP))
+	depends on PM && SWAP
+	depends on ((X86 || PPC64_SWSUSP || FRV || PPC32) && !SMP) || SUSPEND_SMP_POSSIBLE
 	---help---
 	  Enable the suspend to disk (STD) functionality, which is usually
 	  called "hibernation" in user interfaces.  STD checkpoints the
@@ -132,11 +160,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
kernel/power/Makefile +2 -1
Index: linux-2.6/kernel/power/Makefile
===================================================================
@@ -3,8 +3,9 @@ ifeq ($(CONFIG_PM_DEBUG),y)
 EXTRA_CFLAGS	+=	-DDEBUG
 endif
 
-obj-y				:= main.o process.o console.o
+obj-y				:= main.o
 obj-$(CONFIG_PM_LEGACY)		+= pm.o
+obj-$(CONFIG_PM_SLEEP)		+= process.o console.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o disk.o snapshot.o swap.o user.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
drivers/base/power/Makefile +1 -1
Index: linux-2.6/drivers/base/power/Makefile
===================================================================
@@ -1,5 +1,5 @@
 obj-y			:= shutdown.o
-obj-$(CONFIG_PM)	+= main.o suspend.o resume.o sysfs.o
+obj-$(CONFIG_PM_SLEEP)	+= main.o suspend.o resume.o sysfs.o
 obj-$(CONFIG_PM_TRACE)	+= trace.o
 
 ifeq ($(CONFIG_DEBUG_DRIVER),y)
include/linux/suspend.h +5 -5
Index: linux-2.6/include/linux/suspend.h
===================================================================
@@ -24,7 +24,7 @@ struct pbe {
 extern void drain_local_pages(void);
 extern void mark_free_pages(struct zone *zone);
 
-#if defined(CONFIG_PM) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
 extern int pm_prepare_console(void);
 extern void pm_restore_console(void);
 #else
@@ -54,7 +54,6 @@ struct hibernation_ops {
 	void (*restore_cleanup)(void);
 };
 
-#ifdef CONFIG_PM
 #ifdef CONFIG_HIBERNATION
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
@@ -82,6 +81,7 @@ static inline void hibernation_set_ops(s
 static inline int hibernate(void) { return -ENOSYS; }
 #endif /* CONFIG_HIBERNATION */
 
+#ifdef CONFIG_PM_SLEEP
 void save_processor_state(void);
 void restore_processor_state(void);
 struct saved_context;
@@ -106,7 +106,7 @@ static inline int unregister_pm_notifier
 		{ .notifier_call = fn, .priority = pri };	\
 	register_pm_notifier(&fn##_nb);			\
 }
-#else /* CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 
 static inline int register_pm_notifier(struct notifier_block *nb)
 {
@@ -119,9 +119,9 @@ static inline int unregister_pm_notifier
 }
 
 #define pm_notifier(fn, pri)	do { (void)(fn); } while (0)
-#endif /* CONFIG_PM */
+#endif /* !CONFIG_PM_SLEEP */
 
-#if !defined CONFIG_HIBERNATION || !defined(CONFIG_PM)
+#ifndef CONFIG_HIBERNATION
 static inline void register_nosave_region(unsigned long b, unsigned long e)
 {
 }
include/linux/pm.h +11 -4
Index: linux-2.6/include/linux/pm.h
===================================================================
@@ -165,6 +165,7 @@ struct pm_ops {
 	int (*finish)(suspend_state_t state);
 };
 
+#ifdef CONFIG_SUSPEND
 extern struct pm_ops *pm_ops;
 
 /**
@@ -193,6 +194,12 @@ extern void arch_suspend_disable_irqs(vo
 extern void arch_suspend_enable_irqs(void);
 
 extern int pm_suspend(suspend_state_t state);
+#else /* !CONFIG_SUSPEND */
+#define suspend_valid_only_mem	NULL
+
+static inline void pm_set_ops(struct pm_ops *pm_ops) {}
+static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
+#endif /* !CONFIG_SUSPEND */
 
 /*
  * Device power management
@@ -266,7 +273,7 @@ typedef struct pm_message {
 struct dev_pm_info {
 	pm_message_t		power_state;
 	unsigned		can_wakeup:1;
-#ifdef	CONFIG_PM
+#ifdef	CONFIG_PM_SLEEP
 	unsigned		should_wakeup:1;
 	struct list_head	entry;
 #endif
@@ -276,7 +283,7 @@ extern int device_power_down(pm_message_
 extern void device_power_up(void);
 extern void device_resume(void);
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 extern int device_suspend(pm_message_t state);
 extern int device_prepare_suspend(pm_message_t state);
 
@@ -306,7 +313,7 @@ static inline int call_platform_enable_w
 	return 0;
 }
 
-#else /* !CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 
 static inline int device_suspend(pm_message_t state)
 {
@@ -323,7 +330,7 @@ static inline int call_platform_enable_w
 	return 0;
 }
 
-#endif
+#endif /* !CONFIG_PM_SLEEP */
 
 /* changes to device_may_wakeup take effect on the next pm state change.
  * by default, devices should wakeup if they can.
kernel/power/power.h +9 -1
Index: linux-2.6/kernel/power/power.h
===================================================================
@@ -176,9 +176,17 @@ struct timeval;
 extern void swsusp_show_speed(struct timeval *, struct timeval *,
 				unsigned int, char *);
 
+#ifdef CONFIG_SUSPEND
 /* kernel/power/main.c */
-extern int suspend_enter(suspend_state_t state);
 extern int suspend_devices_and_enter(suspend_state_t state);
+#else /* !CONFIG_SUSPEND */
+static inline int suspend_devices_and_enter(suspend_state_t state)
+{
+	return -ENOSYS;
+}
+#endif /* !CONFIG_SUSPEND */
+
+/* kernel/power/common.c */
 extern struct blocking_notifier_head pm_chain_head;
 
 static inline int pm_notifier_call_chain(unsigned long val)
kernel/power/main.c +18 -8
Index: linux-2.6/kernel/power/main.c
===================================================================
@@ -25,11 +25,13 @@
 
 BLOCKING_NOTIFIER_HEAD(pm_chain_head);
 
-/*This is just an arbitrary number */
-#define FREE_PAGE_NUMBER (100)
-
 DEFINE_MUTEX(pm_mutex);
 
+#ifdef CONFIG_SUSPEND
+
+/* This is just an arbitrary number */
+#define FREE_PAGE_NUMBER (100)
+
 struct pm_ops *pm_ops;
 
 /**
@@ -269,6 +271,8 @@ int pm_suspend(suspend_state_t state)
 
 EXPORT_SYMBOL(pm_suspend);
 
+#endif /* CONFIG_SUSPEND */
+
 decl_subsys(power,NULL,NULL);
 
 
@@ -285,13 +289,15 @@ decl_subsys(power,NULL,NULL);
 
 static ssize_t state_show(struct kset *kset, char *buf)
 {
+	char *s = buf;
+#ifdef CONFIG_SUSPEND
 	int i;
-	char * s = buf;
 
 	for (i = 0; i < PM_SUSPEND_MAX; i++) {
 		if (pm_states[i] && valid_state(i))
 			s += sprintf(s,"%s ", pm_states[i]);
 	}
+#endif
 #ifdef CONFIG_HIBERNATION
 	s += sprintf(s, "%s\n", "disk");
 #else
@@ -304,11 +310,13 @@ static ssize_t state_show(struct kset *k
 
 static ssize_t state_store(struct kset *kset, const char *buf, size_t n)
 {
+#ifdef CONFIG_SUSPEND
 	suspend_state_t state = PM_SUSPEND_STANDBY;
 	const char * const *s;
+#endif
 	char *p;
-	int error;
 	int len;
+	int error = -EINVAL;
 
 	p = memchr(buf, '\n', n);
 	len = p ? p - buf : n;
@@ -316,17 +324,19 @@ static ssize_t state_store(struct kset *
 	/* First, check if we are requested to hibernate */
 	if (len == 4 && !strncmp(buf, "disk", len)) {
 		error = hibernate();
-		return error ? error : n;
+  goto Exit;
 	}
 
+#ifdef CONFIG_SUSPEND
 	for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) {
 		if (*s && len == strlen(*s) && !strncmp(buf, *s, len))
 			break;
 	}
 	if (state < PM_SUSPEND_MAX && *s)
 		error = enter_state(state);
-	else
-		error = -EINVAL;
+#endif
+
+ Exit:
 	return error ? error : n;
 }
 
mm/page_alloc.c +2 -2
Index: linux-2.6/mm/page_alloc.c
===================================================================
@@ -726,7 +726,7 @@ static void __drain_pages(unsigned int c
 	}
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_HIBERNATION
 
 void mark_free_pages(struct zone *zone)
 {
@@ -772,7 +772,7 @@ void drain_local_pages(void)
 	__drain_pages(smp_processor_id());
 	local_irq_restore(flags);	
 }
-#endif /* CONFIG_PM */
+#endif /* CONFIG_HIBERNATION */
 
 /*
  * Free a 0-order page
drivers/base/power/power.h +2 -2
Index: linux-2.6/drivers/base/power/power.h
===================================================================
@@ -5,7 +5,7 @@
 extern void device_shutdown(void);
 
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 
 /*
  * main.c
@@ -62,7 +62,7 @@ extern int resume_device(struct device *
  */
 extern int suspend_device(struct device *, pm_message_t);
 
-#else /* CONFIG_PM */
+#else /* CONFIG_PM_SLEEP */
 
 
 static inline int device_pm_add(struct device * dev)
include/linux/freezer.h +3 -3
Index: linux-2.6/include/linux/freezer.h
===================================================================
@@ -5,7 +5,7 @@
 
 #include <linux/sched.h>
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 /*
  * Check if a process has been frozen
  */
@@ -126,7 +126,7 @@ static inline void set_freezable(void)
 	current->flags &= ~PF_NOFREEZE;
 }
 
-#else
+#else /* !CONFIG_PM_SLEEP */
 static inline int frozen(struct task_struct *p) { return 0; }
 static inline int freezing(struct task_struct *p) { return 0; }
 static inline void set_freeze_flag(struct task_struct *p) {}
@@ -143,6 +143,6 @@ static inline void freezer_do_not_count(
 static inline void freezer_count(void) {}
 static inline int freezer_should_skip(struct task_struct *p) { return 0; }
 static inline void set_freezable(void) {}
-#endif
+#endif /* !CONFIG_PM_SLEEP */
 
 #endif	/* FREEZER_H_INCLUDED */
include/acpi/acpi_bus.h +9 -0
Index: linux-2.6/include/acpi/acpi_bus.h
===================================================================
@@ -366,7 +366,16 @@ acpi_handle acpi_get_child(acpi_handle, 
 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
 
+#ifdef CONFIG_PM_SLEEP
 int acpi_pm_device_sleep_state(struct device *, int, int *);
+#else /* !CONFIG_PM_SLEEP */
+static inline int acpi_pm_device_sleep_state(struct device *d, int w, int *p)
+{
+	if (p)
+		*p = ACPI_STATE_D0;
+	return ACPI_STATE_D3;
+}
+#endif /* !CONFIG_PM_SLEEP */
 
 #endif				/* CONFIG_ACPI */
 
drivers/acpi/sleep/Makefile +1 -1
Index: linux-2.6/drivers/acpi/sleep/Makefile
===================================================================
@@ -1,5 +1,5 @@
 obj-y					:= poweroff.o wakeup.o
-obj-y					+= main.o
+obj-$(CONFIG_PM_SLEEP)			+= main.o
 obj-$(CONFIG_X86)			+= proc.o
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
drivers/acpi/Kconfig +8 -0
Index: linux-2.6/drivers/acpi/Kconfig
===================================================================
@@ -63,6 +63,14 @@ config ACPI_PROCFS
 
 	  Say N to delete /proc/acpi/ files that have moved to /sys/
 
+config ACPI_PROCFS_SLEEP
+	bool "/proc/acpi/sleep (deprecated)"
+	depends on PM_SLEEP && ACPI_PROCFS
+	default n
+	---help---
+	  Create /proc/acpi/sleep
+	  Deprecated by /sys/power/state
+
 config ACPI_AC
 	tristate "AC Adapter"
 	depends on X86
drivers/acpi/sleep/proc.c +5 -5
Index: linux-2.6/drivers/acpi/sleep/proc.c
===================================================================
@@ -23,7 +23,7 @@
  */
 
 ACPI_MODULE_NAME("sleep")
-#ifdef	CONFIG_ACPI_PROCFS
+#ifdef	CONFIG_ACPI_PROCFS_SLEEP
 static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset)
 {
 	int i;
@@ -76,7 +76,7 @@ acpi_system_write_sleep(struct file *fil
       Done:
 	return error ? error : count;
 }
-#endif				/* CONFIG_ACPI_PROCFS */
+#endif				/* CONFIG_ACPI_PROCFS_SLEEP */
 
 #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE)
 /* use /sys/class/rtc/rtcX/wakealarm instead; it's not ACPI-specific */
@@ -471,7 +471,7 @@ static const struct file_operations acpi
 	.release = single_release,
 };
 
-#ifdef	CONFIG_ACPI_PROCFS
+#ifdef	CONFIG_ACPI_PROCFS_SLEEP
 static const struct file_operations acpi_system_sleep_fops = {
 	.open = acpi_system_sleep_open_fs,
 	.read = seq_read,
@@ -479,7 +479,7 @@ static const struct file_operations acpi
 	.llseek = seq_lseek,
 	.release = single_release,
 };
-#endif				/* CONFIG_ACPI_PROCFS */
+#endif				/* CONFIG_ACPI_PROCFS_SLEEP */
 
 #ifdef	HAVE_ACPI_LEGACY_ALARM
 static const struct file_operations acpi_system_alarm_fops = {
@@ -506,7 +506,7 @@ static int __init acpi_sleep_proc_init(v
 	if (acpi_disabled)
 		return 0;
 
-#ifdef	CONFIG_ACPI_PROCFS
+#ifdef	CONFIG_ACPI_PROCFS_SLEEP
 	/* 'sleep' [R/W] */
 	entry =
 	    create_proc_entry("sleep", S_IFREG | S_IRUGO | S_IWUSR,
include/acpi/acpi_drivers.h +4 -0
Index: linux-2.6/include/acpi/acpi_drivers.h
===================================================================
@@ -147,6 +147,10 @@ static inline void unregister_hotplug_do
 /*--------------------------------------------------------------------------
                                   Suspend/Resume
   -------------------------------------------------------------------------- */
+#ifdef CONFIG_PM_SLEEP
 extern int acpi_sleep_init(void);
+#else
+static inline int acpi_sleep_init(void) { return 0; }
+#endif
 
 #endif /*__ACPI_DRIVERS_H__*/
drivers/acpi/sleep/main.c +50 -44

149 lines not on this page · raw message

drivers/acpi/sleep/sleep.h +2 -0
Index: linux-2.6/drivers/acpi/sleep/sleep.h
===================================================================
@@ -6,3 +6,5 @@ extern void acpi_enable_wakeup_device_pr
 extern void acpi_enable_wakeup_device(u8 sleep_state);
 extern void acpi_disable_wakeup_device(u8 sleep_state);
 extern void acpi_gpe_sleep_prepare(u32 sleep_state);
+
+extern int acpi_sleep_prepare(u32 acpi_state);
#87 lore raw

cover Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated)

In reply to Rafael J. Wysocki
Quoted 12 lines · Rafael J. Wysocki
Quoted 10 lines · Linus Torvalds
Quoted 3 lines · Rafael J. Wysocki

OK, I'll prepare a patch to introduce CONFIG_SUSPEND, but that will require quite a bit of (compilation) testing on different architectures.

Sure. I'm not too worried, the fallout should be of the trivial kind.

Also, mind basing it on the (independent) cleanups that Adrian already sent out. This is all intertwined..

Quoted 8 lines

OK, it took more time than I had hoped, but I wanted CONFIG_HIBERNATION and CONFIG_SUSPEND to be really independent of each other.

The two patches in the next messages implement the idea:
* replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION
* introduce CONFIG_SUSPEND that selects CONFIG_HOTPLUG_CPU, if necessary, and make it possible to choose suspend and hibernation independently of each other.

Unfortunately, the patches that I have posted are against 2.6.23-rc1 with the suspend and hibernation patchset applied
(http://www.sisk.pl/kernel/hibernation_and_suspend/2.6.23-rc1/patches/) .

Sorry for that.

The corresponding patches on top of the current -git are in the next two messages.

They do the following:
* replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION
* introduce CONFIG_SUSPEND that selects CONFIG_HOTPLUG_CPU, if necessary, and make it possible to choose suspend and hibernation independently of each other
* update the top-level PM-related headers and the ACPI code related to suspend and hibernation to use the new definitions

Greetings,
Rafael

#59 lore raw

PATCH 1/2 Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION (updated)

In reply to Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION to avoid confusion (among other things, with CONFIG_SUSPEND introduced in the next patch).

---
 arch/i386/Kconfig.debug                 |    4 ++--
 arch/i386/kernel/e820.c                 |    2 +-
 arch/i386/mm/init.c                     |    2 +-
 arch/i386/power/Makefile                |    2 +-
 arch/powerpc/Kconfig.debug              |    2 +-
 arch/powerpc/configs/lite5200_defconfig |    2 +-
 arch/powerpc/configs/pmac32_defconfig   |    2 +-
 arch/powerpc/kernel/Makefile            |    6 +++---
 arch/ppc/configs/TQM8540_defconfig      |    2 +-
 arch/ppc/configs/TQM8541_defconfig      |    2 +-
 arch/ppc/configs/TQM8555_defconfig      |    2 +-
 arch/ppc/configs/TQM8560_defconfig      |    2 +-
 arch/ppc/configs/ev64360_defconfig      |    2 +-
 arch/ppc/configs/ml300_defconfig        |    2 +-
 arch/ppc/configs/ml403_defconfig        |    2 +-
 arch/ppc/configs/mpc834x_sys_defconfig  |    2 +-
 arch/ppc/configs/prep_defconfig         |    2 +-
 arch/sparc64/Kconfig.debug              |    2 +-
 arch/x86_64/defconfig                   |    2 +-
 arch/x86_64/kernel/Makefile             |    2 +-
 arch/x86_64/kernel/suspend.c            |    4 ++--
 drivers/acpi/sleep/main.c               |    6 +++---
 drivers/acpi/sleep/proc.c               |    2 +-
 drivers/i2c/chips/tps65010.c            |    2 +-
 include/asm-i386/e820.h                 |    2 +-
 include/linux/suspend.h                 |    8 ++++----
 kernel/power/Kconfig                    |    6 +++---
 kernel/power/Makefile                   |    2 +-
 kernel/power/main.c                     |    2 +-
 kernel/power/power.h                    |    2 +-
 kernel/sys.c                            |    2 +-
 mm/Kconfig                              |    4 ++--
 mm/swapfile.c                           |    6 +++---
 33 files changed, 47 insertions(+), 47 deletions(-)
arch/i386/Kconfig.debug +2 -2
Index: linux-2.6/arch/i386/Kconfig.debug
===================================================================
@@ -36,11 +36,11 @@ config DEBUG_STACK_USAGE
 	  This option will slow down process creation somewhat.
 
 comment "Page alloc debug is incompatible with Software Suspend on i386"
-	depends on DEBUG_KERNEL && SOFTWARE_SUSPEND
+	depends on DEBUG_KERNEL && HIBERNATION
 
 config DEBUG_PAGEALLOC
 	bool "Debug page memory allocations"
-	depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND && !HUGETLBFS
+	depends on DEBUG_KERNEL && !HIBERNATION && !HUGETLBFS
 	help
 	  Unmap pages from the kernel linear mapping after free_pages().
 	  This results in a large slowdown, but helps to find certain types
arch/i386/kernel/e820.c +1 -1
Index: linux-2.6/arch/i386/kernel/e820.c
===================================================================
@@ -321,7 +321,7 @@ static int __init request_standard_resou
 
 subsys_initcall(request_standard_resources);
 
-#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
+#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
 /**
  * e820_mark_nosave_regions - Find the ranges of physical addresses that do not
  * correspond to e820 RAM areas and mark the corresponding pages as nosave for
arch/i386/mm/init.c +1 -1
Index: linux-2.6/arch/i386/mm/init.c
===================================================================
@@ -432,7 +432,7 @@ static void __init pagetable_init (void)
 	paravirt_pagetable_setup_done(pgd_base);
 }
 
-#if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_ACPI)
+#if defined(CONFIG_HIBERNATION) || defined(CONFIG_ACPI)
 /*
  * Swap suspend & friends need this for resume because things like the intel-agp
  * driver might have split up a kernel 4MB mapping.
arch/i386/power/Makefile +1 -1
Index: linux-2.6/arch/i386/power/Makefile
===================================================================
@@ -1,2 +1,2 @@
 obj-$(CONFIG_PM)		+= cpu.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o suspend.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o
arch/powerpc/Kconfig.debug +1 -1
Index: linux-2.6/arch/powerpc/Kconfig.debug
===================================================================
@@ -20,7 +20,7 @@ config DEBUG_STACK_USAGE
 
 config DEBUG_PAGEALLOC
         bool "Debug page memory allocations"
-        depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
+        depends on DEBUG_KERNEL && !HIBERNATION
         help
           Unmap pages from the kernel linear mapping after free_pages().
           This results in a large slowdown, but helps to find certain types
arch/powerpc/configs/lite5200_defconfig +1 -1
Index: linux-2.6/arch/powerpc/configs/lite5200_defconfig
===================================================================
@@ -196,7 +196,7 @@ CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
 # CONFIG_PM_SYSFS_DEPRECATED is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 # CONFIG_WANT_DEVICE_TREE is not set
 CONFIG_ISA_DMA_API=y
arch/powerpc/configs/pmac32_defconfig +1 -1
Index: linux-2.6/arch/powerpc/configs/pmac32_defconfig
===================================================================
@@ -218,7 +218,7 @@ CONFIG_PM=y
 CONFIG_PM_DEBUG=y
 # CONFIG_DISABLE_CONSOLE_SUSPEND is not set
 CONFIG_PM_SYSFS_DEPRECATED=y
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 CONFIG_APM_EMULATION=y
 CONFIG_SECCOMP=y
arch/powerpc/kernel/Makefile +3 -3
Index: linux-2.6/arch/powerpc/kernel/Makefile
===================================================================
@@ -37,9 +37,9 @@ obj-$(CONFIG_GENERIC_TBSYNC)	+= smp-tbsy
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_6xx)		+= idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
 obj-$(CONFIG_TAU)		+= tau_6xx.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o suspend.o
-obj32-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_32.o
-obj64-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_64.o swsusp_asm64.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o
+obj32-$(CONFIG_HIBERNATION) += swsusp_32.o
+obj64-$(CONFIG_HIBERNATION) += swsusp_64.o swsusp_asm64.o
 obj32-$(CONFIG_MODULES)		+= module_32.o
 
 ifeq ($(CONFIG_PPC_MERGE),y)
arch/ppc/configs/TQM8540_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/TQM8540_defconfig
===================================================================
@@ -136,7 +136,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/TQM8541_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/TQM8541_defconfig
===================================================================
@@ -138,7 +138,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/TQM8555_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/TQM8555_defconfig
===================================================================
@@ -138,7 +138,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/TQM8560_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/TQM8560_defconfig
===================================================================
@@ -137,7 +137,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/ev64360_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/ev64360_defconfig
===================================================================
@@ -142,7 +142,7 @@ CONFIG_BINFMT_MISC=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyMM0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/ml300_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/ml300_defconfig
===================================================================
@@ -148,7 +148,7 @@ CONFIG_BINFMT_ELF=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,9600"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/ml403_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/ml403_defconfig
===================================================================
@@ -149,7 +149,7 @@ CONFIG_BINFMT_ELF=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,9600"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/mpc834x_sys_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/mpc834x_sys_defconfig
===================================================================
@@ -130,7 +130,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
arch/ppc/configs/prep_defconfig +1 -1
Index: linux-2.6/arch/ppc/configs/prep_defconfig
===================================================================
@@ -166,7 +166,7 @@ CONFIG_PROC_PREPRESIDUAL=y
 CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 # CONFIG_SECCOMP is not set
 CONFIG_ISA_DMA_API=y
arch/sparc64/Kconfig.debug +1 -1
Index: linux-2.6/arch/sparc64/Kconfig.debug
===================================================================
@@ -29,7 +29,7 @@ config DEBUG_BOOTMEM
 
 config DEBUG_PAGEALLOC
 	bool "Debug page memory allocations"
-	depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
+	depends on DEBUG_KERNEL && !HIBERNATION
 	help
 	  Unmap pages from the kernel linear mapping after free_pages().
 	  This results in a large slowdown, but helps to find certain types
arch/x86_64/defconfig +1 -1
Index: linux-2.6/arch/x86_64/defconfig
===================================================================
@@ -199,7 +199,7 @@ CONFIG_GENERIC_PENDING_IRQ=y
 CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 CONFIG_SUSPEND_SMP=y
 
arch/x86_64/kernel/Makefile +1 -1
Index: linux-2.6/arch/x86_64/kernel/Makefile
===================================================================
@@ -26,7 +26,7 @@ obj-y				+= io_apic.o mpparse.o genapic.
 obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o crash.o
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_PM)		+= suspend.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend_asm.o
+obj-$(CONFIG_HIBERNATION)	+= suspend_asm.o
 obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 obj-$(CONFIG_IOMMU)		+= pci-gart.o aperture.o
arch/x86_64/kernel/suspend.c +2 -2
Index: linux-2.6/arch/x86_64/kernel/suspend.c
===================================================================
@@ -146,7 +146,7 @@ void fix_processor_context(void)
 
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /* Defined in arch/x86_64/kernel/suspend_asm.S */
 extern int restore_image(void);
 
@@ -236,4 +236,4 @@ int pfn_is_nosave(unsigned long pfn)
 	unsigned long nosave_end_pfn = PAGE_ALIGN(__pa_symbol(&__nosave_end)) >> PAGE_SHIFT;
 	return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
 }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
drivers/acpi/sleep/main.c +3 -3
Index: linux-2.6/drivers/acpi/sleep/main.c
===================================================================
@@ -202,7 +202,7 @@ static struct pm_ops acpi_pm_ops = {
 	.finish = acpi_pm_finish,
 };
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 static int acpi_hibernation_prepare(void)
 {
 	return acpi_sleep_prepare(ACPI_STATE_S4);
@@ -254,7 +254,7 @@ static struct hibernation_ops acpi_hiber
 	.pre_restore = acpi_hibernation_pre_restore,
 	.restore_cleanup = acpi_hibernation_restore_cleanup,
 };
-#endif				/* CONFIG_SOFTWARE_SUSPEND */
+#endif				/* CONFIG_HIBERNATION */
 
 /**
  *	acpi_pm_device_sleep_state - return preferred power state of ACPI device
@@ -374,7 +374,7 @@ int __init acpi_sleep_init(void)
 
 	pm_set_ops(&acpi_pm_ops);
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	if (sleep_states[ACPI_STATE_S4])
 		hibernation_set_ops(&acpi_hibernation_ops);
 #else
drivers/acpi/sleep/proc.c +1 -1
Index: linux-2.6/drivers/acpi/sleep/proc.c
===================================================================
@@ -66,7 +66,7 @@ acpi_system_write_sleep(struct file *fil
 		goto Done;
 	}
 	state = simple_strtoul(str, NULL, 0);
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	if (state == 4) {
 		error = hibernate();
 		goto Done;
drivers/i2c/chips/tps65010.c +1 -1
Index: linux-2.6/drivers/i2c/chips/tps65010.c
===================================================================
@@ -352,7 +352,7 @@ static void tps65010_interrupt(struct tp
 			/* REVISIT:  this might need its own workqueue
 			 * plus tweaks including deadlock avoidance ...
 			 * also needs to get error handling and probably
-			 * an #ifdef CONFIG_SOFTWARE_SUSPEND
+			 * an #ifdef CONFIG_HIBERNATION
 			 */
 			hibernate();
 #endif
include/asm-i386/e820.h +1 -1
Index: linux-2.6/include/asm-i386/e820.h
===================================================================
@@ -47,7 +47,7 @@ extern void e820_register_memory(void);
 extern void limit_regions(unsigned long long size);
 extern void print_memory_map(char *who);
 
-#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
+#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
 extern void e820_mark_nosave_regions(void);
 #else
 static inline void e820_mark_nosave_regions(void)
include/linux/suspend.h +4 -4
Index: linux-2.6/include/linux/suspend.h
===================================================================
@@ -55,7 +55,7 @@ struct hibernation_ops {
 };
 
 #ifdef CONFIG_PM
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
 static inline void register_nosave_region(unsigned long b, unsigned long e)
@@ -73,14 +73,14 @@ extern unsigned long get_safe_page(gfp_t
 
 extern void hibernation_set_ops(struct hibernation_ops *ops);
 extern int hibernate(void);
-#else /* CONFIG_SOFTWARE_SUSPEND */
+#else /* CONFIG_HIBERNATION */
 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
 static inline void swsusp_set_page_free(struct page *p) {}
 static inline void swsusp_unset_page_free(struct page *p) {}
 
 static inline void hibernation_set_ops(struct hibernation_ops *ops) {}
 static inline int hibernate(void) { return -ENOSYS; }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
 
 void save_processor_state(void);
 void restore_processor_state(void);
@@ -121,7 +121,7 @@ static inline int unregister_pm_notifier
 #define pm_notifier(fn, pri)	do { (void)(fn); } while (0)
 #endif /* CONFIG_PM */
 
-#if !defined CONFIG_SOFTWARE_SUSPEND || !defined(CONFIG_PM)
+#if !defined CONFIG_HIBERNATION || !defined(CONFIG_PM)
 static inline void register_nosave_region(unsigned long b, unsigned long e)
 {
 }
kernel/power/Kconfig +3 -3
Index: linux-2.6/kernel/power/Kconfig
===================================================================
@@ -72,8 +72,8 @@ 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 SOFTWARE_SUSPEND
-	bool "Software Suspend (Hibernation)"
+config HIBERNATION
+	bool "Hibernation"
 	depends on PM && SWAP && (((X86 || PPC64_SWSUSP) && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP))
 	---help---
 	  Enable the suspend to disk (STD) functionality, which is usually
@@ -112,7 +112,7 @@ config SOFTWARE_SUSPEND
 
 config PM_STD_PARTITION
 	string "Default resume partition"
-	depends on SOFTWARE_SUSPEND
+	depends on HIBERNATION
 	default ""
 	---help---
 	  The default resume partition is the partition that the suspend-
kernel/power/Makefile +1 -1
Index: linux-2.6/kernel/power/Makefile
===================================================================
@@ -5,6 +5,6 @@ endif
 
 obj-y				:= main.o process.o console.o
 obj-$(CONFIG_PM_LEGACY)		+= pm.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o disk.o snapshot.o swap.o user.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o disk.o snapshot.o swap.o user.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
kernel/power/main.c +1 -1
Index: linux-2.6/kernel/power/main.c
===================================================================
@@ -292,7 +292,7 @@ static ssize_t state_show(struct kset *k
 		if (pm_states[i] && valid_state(i))
 			s += sprintf(s,"%s ", pm_states[i]);
 	}
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	s += sprintf(s, "%s\n", "disk");
 #else
 	if (s != buf)
kernel/power/power.h +1 -1
Index: linux-2.6/kernel/power/power.h
===================================================================
@@ -13,7 +13,7 @@ struct swsusp_info {
 
 
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Keep some memory free so that I/O operations can succeed without paging
  * [Might this be more than 4 MB?]
kernel/sys.c +1 -1
Index: linux-2.6/kernel/sys.c
===================================================================
@@ -954,7 +954,7 @@ asmlinkage long sys_reboot(int magic1, i
 		unlock_kernel();
 		return -EINVAL;
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	case LINUX_REBOOT_CMD_SW_SUSPEND:
 		{
 			int ret = hibernate();
mm/Kconfig +2 -2
Index: linux-2.6/mm/Kconfig
===================================================================
@@ -116,11 +116,11 @@ config SPARSEMEM_EXTREME
 config MEMORY_HOTPLUG
 	bool "Allow for memory hot-add"
 	depends on SPARSEMEM || X86_64_ACPI_NUMA
-	depends on HOTPLUG && !SOFTWARE_SUSPEND && ARCH_ENABLE_MEMORY_HOTPLUG
+	depends on HOTPLUG && !HIBERNATION && ARCH_ENABLE_MEMORY_HOTPLUG
 	depends on (IA64 || X86 || PPC64 || SUPERH)
 
 comment "Memory hotplug is currently incompatible with Software Suspend"
-	depends on SPARSEMEM && HOTPLUG && SOFTWARE_SUSPEND
+	depends on SPARSEMEM && HOTPLUG && HIBERNATION
 
 config MEMORY_HOTPLUG_SPARSE
 	def_bool y
mm/swapfile.c +3 -3
Index: linux-2.6/mm/swapfile.c
===================================================================
@@ -425,7 +425,7 @@ void free_swap_and_cache(swp_entry_t ent
 	}
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Find the swap type that corresponds to given device (if any).
  *
@@ -951,7 +951,7 @@ sector_t map_swap_page(struct swap_info_
 	}
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Get the (PAGE_SIZE) block corresponding to given offset on the swapdev
  * corresponding to given index in swap_info (swap type).
@@ -966,7 +966,7 @@ sector_t swapdev_block(int swap_type, pg
 	sis = swap_info + swap_type;
 	return (sis->flags & SWP_WRITEOK) ? map_swap_page(sis, offset) : 0;
 }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
 
 /*
  * Free all of a swapdev's extent information
#68 lore raw

PATCH 2/2 Introduce CONFIG_SUSPEND (updated)

In reply to Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Introduce CONFIG_SUSPEND representing the ability to enter system sleep states, such as the ACPI S3 state, and allow the user to choose SUSPEND and HIBERNATION independently of each other.

Make HOTPLUG_CPU be selected automatically if SUSPEND or HIBERNATION has been chosen and the kernel is intended for SMP systems.

Also, introduce CONFIG_PM_SLEEP which is automatically selected if CONFIG_SUSPEND or CONFIG_HIBERNATION is set and use it to select the code needed for both suspend and hibernation.

The top-level power management headers and the ACPI code related to suspend and hibernation are modified to use the new definitions (the changes in drivers/acpi/sleep/main.c are, mostly, moving code to reduce the number of ifdefs). Still, there are many other files in which CONFIG_PM can be replaced with CONFIG_PM_SLEEP or even with CONFIG_SUSPEND, but they can be updated in the future.

---
 drivers/acpi/Kconfig        |    8 +++
 drivers/acpi/sleep/Makefile |    2 
 drivers/acpi/sleep/main.c   |   94 +++++++++++++++++++++++---------------------
 drivers/acpi/sleep/proc.c   |   10 ++--
 drivers/acpi/sleep/sleep.h  |    2 
 drivers/base/power/Makefile |    2 
 drivers/base/power/power.h  |    4 -
 include/acpi/acpi_bus.h     |    9 ++++
 include/acpi/acpi_drivers.h |    4 +
 include/linux/freezer.h     |    6 +-
 include/linux/pm.h          |   15 +++++--
 include/linux/suspend.h     |   10 ++--
 kernel/power/Kconfig        |   39 ++++++++++++++----
 kernel/power/Makefile       |    3 -
 kernel/power/main.c         |   26 ++++++++----
 kernel/power/power.h        |   10 ++++
 mm/page_alloc.c             |    4 -
 17 files changed, 163 insertions(+), 85 deletions(-)
kernel/power/Kconfig +31 -8
Index: linux-2.6/kernel/power/Kconfig
===================================================================
@@ -46,7 +46,7 @@ config PM_VERBOSE
 
 config DISABLE_CONSOLE_SUSPEND
 	bool "Keep console(s) enabled during suspend/resume (DANGEROUS)"
-	depends on PM_DEBUG
+	depends on PM_DEBUG && PM_SLEEP
 	default n
 	---help---
 	This option turns off the console suspend mechanism that prevents
@@ -57,7 +57,7 @@ config DISABLE_CONSOLE_SUSPEND
 
 config PM_TRACE
 	bool "Suspend/resume event tracing"
-	depends on PM_DEBUG && X86 && EXPERIMENTAL
+	depends on PM_DEBUG && X86 && PM_SLEEP && EXPERIMENTAL
 	default n
 	---help---
 	This enables some cheesy code to save the last PM event point in the
@@ -72,9 +72,37 @@ 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_SMP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+	depends on SMP
+	default y
+
+config SUSPEND_SMP
+	bool
+	depends on SUSPEND_SMP_POSSIBLE && PM_SLEEP
+	select HOTPLUG_CPU
+	default y
+
+config PM_SLEEP
+	bool
+	depends on SUSPEND || HIBERNATION
+	default y
+
+config SUSPEND
+	bool "Suspend to RAM and standby"
+	depends on PM
+	depends on !SMP || SUSPEND_SMP_POSSIBLE
+	default y
+	---help---
+	  Allow the system to enter sleep states in which main memory is
+	  powered and thus its contents are preserved, such as the
+	  suspend-to-RAM state (i.e. the ACPI S3 state).
+
 config HIBERNATION
 	bool "Hibernation"
-	depends on PM && SWAP && (((X86 || PPC64_SWSUSP) && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP))
+	depends on PM && SWAP
+	depends on ((X86 || PPC64_SWSUSP || FRV || PPC32) && !SMP) || SUSPEND_SMP_POSSIBLE
 	---help---
 	  Enable the suspend to disk (STD) functionality, which is usually
 	  called "hibernation" in user interfaces.  STD checkpoints the
@@ -132,11 +160,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
kernel/power/Makefile +2 -1
Index: linux-2.6/kernel/power/Makefile
===================================================================
@@ -3,8 +3,9 @@ ifeq ($(CONFIG_PM_DEBUG),y)
 EXTRA_CFLAGS	+=	-DDEBUG
 endif
 
-obj-y				:= main.o process.o console.o
+obj-y				:= main.o
 obj-$(CONFIG_PM_LEGACY)		+= pm.o
+obj-$(CONFIG_PM_SLEEP)		+= process.o console.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o disk.o snapshot.o swap.o user.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
drivers/base/power/Makefile +1 -1
Index: linux-2.6/drivers/base/power/Makefile
===================================================================
@@ -1,5 +1,5 @@
 obj-y			:= shutdown.o
-obj-$(CONFIG_PM)	+= main.o suspend.o resume.o sysfs.o
+obj-$(CONFIG_PM_SLEEP)	+= main.o suspend.o resume.o sysfs.o
 obj-$(CONFIG_PM_TRACE)	+= trace.o
 
 ifeq ($(CONFIG_DEBUG_DRIVER),y)
include/linux/suspend.h +5 -5
Index: linux-2.6/include/linux/suspend.h
===================================================================
@@ -24,7 +24,7 @@ struct pbe {
 extern void drain_local_pages(void);
 extern void mark_free_pages(struct zone *zone);
 
-#if defined(CONFIG_PM) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
 extern int pm_prepare_console(void);
 extern void pm_restore_console(void);
 #else
@@ -54,7 +54,6 @@ struct hibernation_ops {
 	void (*restore_cleanup)(void);
 };
 
-#ifdef CONFIG_PM
 #ifdef CONFIG_HIBERNATION
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
@@ -82,6 +81,7 @@ static inline void hibernation_set_ops(s
 static inline int hibernate(void) { return -ENOSYS; }
 #endif /* CONFIG_HIBERNATION */
 
+#ifdef CONFIG_PM_SLEEP
 void save_processor_state(void);
 void restore_processor_state(void);
 struct saved_context;
@@ -106,7 +106,7 @@ static inline int unregister_pm_notifier
 		{ .notifier_call = fn, .priority = pri };	\
 	register_pm_notifier(&fn##_nb);			\
 }
-#else /* CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 
 static inline int register_pm_notifier(struct notifier_block *nb)
 {
@@ -119,9 +119,9 @@ static inline int unregister_pm_notifier
 }
 
 #define pm_notifier(fn, pri)	do { (void)(fn); } while (0)
-#endif /* CONFIG_PM */
+#endif /* !CONFIG_PM_SLEEP */
 
-#if !defined CONFIG_HIBERNATION || !defined(CONFIG_PM)
+#ifndef CONFIG_HIBERNATION
 static inline void register_nosave_region(unsigned long b, unsigned long e)
 {
 }
include/linux/pm.h +11 -4
Index: linux-2.6/include/linux/pm.h
===================================================================
@@ -165,6 +165,7 @@ struct pm_ops {
 	int (*finish)(suspend_state_t state);
 };
 
+#ifdef CONFIG_SUSPEND
 extern struct pm_ops *pm_ops;
 
 /**
@@ -193,6 +194,12 @@ extern void arch_suspend_disable_irqs(vo
 extern void arch_suspend_enable_irqs(void);
 
 extern int pm_suspend(suspend_state_t state);
+#else /* !CONFIG_SUSPEND */
+#define suspend_valid_only_mem	NULL
+
+static inline void pm_set_ops(struct pm_ops *pm_ops) {}
+static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
+#endif /* !CONFIG_SUSPEND */
 
 /*
  * Device power management
@@ -266,7 +273,7 @@ typedef struct pm_message {
 struct dev_pm_info {
 	pm_message_t		power_state;
 	unsigned		can_wakeup:1;
-#ifdef	CONFIG_PM
+#ifdef	CONFIG_PM_SLEEP
 	unsigned		should_wakeup:1;
 	struct list_head	entry;
 #endif
@@ -276,7 +283,7 @@ extern int device_power_down(pm_message_
 extern void device_power_up(void);
 extern void device_resume(void);
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 extern int device_suspend(pm_message_t state);
 extern int device_prepare_suspend(pm_message_t state);
 
@@ -306,7 +313,7 @@ static inline int call_platform_enable_w
 	return 0;
 }
 
-#else /* !CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 
 static inline int device_suspend(pm_message_t state)
 {
@@ -323,7 +330,7 @@ static inline int call_platform_enable_w
 	return 0;
 }
 
-#endif
+#endif /* !CONFIG_PM_SLEEP */
 
 /* changes to device_may_wakeup take effect on the next pm state change.
  * by default, devices should wakeup if they can.
kernel/power/power.h +9 -1
Index: linux-2.6/kernel/power/power.h
===================================================================
@@ -176,9 +176,17 @@ struct timeval;
 extern void swsusp_show_speed(struct timeval *, struct timeval *,
 				unsigned int, char *);
 
+#ifdef CONFIG_SUSPEND
 /* kernel/power/main.c */
-extern int suspend_enter(suspend_state_t state);
 extern int suspend_devices_and_enter(suspend_state_t state);
+#else /* !CONFIG_SUSPEND */
+static inline int suspend_devices_and_enter(suspend_state_t state)
+{
+	return -ENOSYS;
+}
+#endif /* !CONFIG_SUSPEND */
+
+/* kernel/power/common.c */
 extern struct blocking_notifier_head pm_chain_head;
 
 static inline int pm_notifier_call_chain(unsigned long val)
kernel/power/main.c +18 -8
Index: linux-2.6/kernel/power/main.c
===================================================================
@@ -25,11 +25,13 @@
 
 BLOCKING_NOTIFIER_HEAD(pm_chain_head);
 
-/*This is just an arbitrary number */
-#define FREE_PAGE_NUMBER (100)
-
 DEFINE_MUTEX(pm_mutex);
 
+#ifdef CONFIG_SUSPEND
+
+/* This is just an arbitrary number */
+#define FREE_PAGE_NUMBER (100)
+
 struct pm_ops *pm_ops;
 
 /**
@@ -269,6 +271,8 @@ int pm_suspend(suspend_state_t state)
 
 EXPORT_SYMBOL(pm_suspend);
 
+#endif /* CONFIG_SUSPEND */
+
 decl_subsys(power,NULL,NULL);
 
 
@@ -285,13 +289,15 @@ decl_subsys(power,NULL,NULL);
 
 static ssize_t state_show(struct kset *kset, char *buf)
 {
+	char *s = buf;
+#ifdef CONFIG_SUSPEND
 	int i;
-	char * s = buf;
 
 	for (i = 0; i < PM_SUSPEND_MAX; i++) {
 		if (pm_states[i] && valid_state(i))
 			s += sprintf(s,"%s ", pm_states[i]);
 	}
+#endif
 #ifdef CONFIG_HIBERNATION
 	s += sprintf(s, "%s\n", "disk");
 #else
@@ -304,11 +310,13 @@ static ssize_t state_show(struct kset *k
 
 static ssize_t state_store(struct kset *kset, const char *buf, size_t n)
 {
+#ifdef CONFIG_SUSPEND
 	suspend_state_t state = PM_SUSPEND_STANDBY;
 	const char * const *s;
+#endif
 	char *p;
-	int error;
 	int len;
+	int error = -EINVAL;
 
 	p = memchr(buf, '\n', n);
 	len = p ? p - buf : n;
@@ -316,17 +324,19 @@ static ssize_t state_store(struct kset *
 	/* First, check if we are requested to hibernate */
 	if (len == 4 && !strncmp(buf, "disk", len)) {
 		error = hibernate();
-		return error ? error : n;
+  goto Exit;
 	}
 
+#ifdef CONFIG_SUSPEND
 	for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) {
 		if (*s && len == strlen(*s) && !strncmp(buf, *s, len))
 			break;
 	}
 	if (state < PM_SUSPEND_MAX && *s)
 		error = enter_state(state);
-	else
-		error = -EINVAL;
+#endif
+
+ Exit:
 	return error ? error : n;
 }
 
mm/page_alloc.c +2 -2
Index: linux-2.6/mm/page_alloc.c
===================================================================
@@ -726,7 +726,7 @@ static void __drain_pages(unsigned int c
 	}
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_HIBERNATION
 
 void mark_free_pages(struct zone *zone)
 {
@@ -772,7 +772,7 @@ void drain_local_pages(void)
 	__drain_pages(smp_processor_id());
 	local_irq_restore(flags);	
 }
-#endif /* CONFIG_PM */
+#endif /* CONFIG_HIBERNATION */
 
 /*
  * Free a 0-order page
drivers/base/power/power.h +2 -2
Index: linux-2.6/drivers/base/power/power.h
===================================================================
@@ -5,7 +5,7 @@
 extern void device_shutdown(void);
 
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 
 /*
  * main.c
@@ -62,7 +62,7 @@ extern int resume_device(struct device *
  */
 extern int suspend_device(struct device *, pm_message_t);
 
-#else /* CONFIG_PM */
+#else /* CONFIG_PM_SLEEP */
 
 
 static inline int device_pm_add(struct device * dev)
include/linux/freezer.h +3 -3
Index: linux-2.6/include/linux/freezer.h
===================================================================
@@ -5,7 +5,7 @@
 
 #include <linux/sched.h>
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 /*
  * Check if a process has been frozen
  */
@@ -126,7 +126,7 @@ static inline void set_freezable(void)
 	current->flags &= ~PF_NOFREEZE;
 }
 
-#else
+#else /* !CONFIG_PM_SLEEP */
 static inline int frozen(struct task_struct *p) { return 0; }
 static inline int freezing(struct task_struct *p) { return 0; }
 static inline void set_freeze_flag(struct task_struct *p) {}
@@ -143,6 +143,6 @@ static inline void freezer_do_not_count(
 static inline void freezer_count(void) {}
 static inline int freezer_should_skip(struct task_struct *p) { return 0; }
 static inline void set_freezable(void) {}
-#endif
+#endif /* !CONFIG_PM_SLEEP */
 
 #endif	/* FREEZER_H_INCLUDED */
include/acpi/acpi_bus.h +9 -0
Index: linux-2.6/include/acpi/acpi_bus.h
===================================================================
@@ -366,7 +366,16 @@ acpi_handle acpi_get_child(acpi_handle, 
 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
 
+#ifdef CONFIG_PM_SLEEP
 int acpi_pm_device_sleep_state(struct device *, int, int *);
+#else /* !CONFIG_PM_SLEEP */
+static inline int acpi_pm_device_sleep_state(struct device *d, int w, int *p)
+{
+	if (p)
+		*p = ACPI_STATE_D0;
+	return ACPI_STATE_D3;
+}
+#endif /* !CONFIG_PM_SLEEP */
 
 #endif				/* CONFIG_ACPI */
 
drivers/acpi/sleep/Makefile +1 -1
Index: linux-2.6/drivers/acpi/sleep/Makefile
===================================================================
@@ -1,5 +1,5 @@
 obj-y					:= poweroff.o wakeup.o
-obj-y					+= main.o
+obj-$(CONFIG_PM_SLEEP)			+= main.o
 obj-$(CONFIG_X86)			+= proc.o
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
drivers/acpi/Kconfig +8 -0
Index: linux-2.6/drivers/acpi/Kconfig
===================================================================
@@ -63,6 +63,14 @@ config ACPI_PROCFS
 
 	  Say N to delete /proc/acpi/ files that have moved to /sys/
 
+config ACPI_PROCFS_SLEEP
+	bool "/proc/acpi/sleep (deprecated)"
+	depends on PM_SLEEP && ACPI_PROCFS
+	default n
+	---help---
+	  Create /proc/acpi/sleep
+	  Deprecated by /sys/power/state
+
 config ACPI_AC
 	tristate "AC Adapter"
 	depends on X86
drivers/acpi/sleep/proc.c +5 -5
Index: linux-2.6/drivers/acpi/sleep/proc.c
===================================================================
@@ -23,7 +23,7 @@
  */
 
 ACPI_MODULE_NAME("sleep")
-#ifdef	CONFIG_ACPI_PROCFS
+#ifdef	CONFIG_ACPI_PROCFS_SLEEP
 static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset)
 {
 	int i;
@@ -76,7 +76,7 @@ acpi_system_write_sleep(struct file *fil
       Done:
 	return error ? error : count;
 }
-#endif				/* CONFIG_ACPI_PROCFS */
+#endif				/* CONFIG_ACPI_PROCFS_SLEEP */
 
 #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE)
 /* use /sys/class/rtc/rtcX/wakealarm instead; it's not ACPI-specific */
@@ -471,7 +471,7 @@ static const struct file_operations acpi
 	.release = single_release,
 };
 
-#ifdef	CONFIG_ACPI_PROCFS
+#ifdef	CONFIG_ACPI_PROCFS_SLEEP
 static const struct file_operations acpi_system_sleep_fops = {
 	.open = acpi_system_sleep_open_fs,
 	.read = seq_read,
@@ -479,7 +479,7 @@ static const struct file_operations acpi
 	.llseek = seq_lseek,
 	.release = single_release,
 };
-#endif				/* CONFIG_ACPI_PROCFS */
+#endif				/* CONFIG_ACPI_PROCFS_SLEEP */
 
 #ifdef	HAVE_ACPI_LEGACY_ALARM
 static const struct file_operations acpi_system_alarm_fops = {
@@ -506,7 +506,7 @@ static int __init acpi_sleep_proc_init(v
 	if (acpi_disabled)
 		return 0;
 
-#ifdef	CONFIG_ACPI_PROCFS
+#ifdef	CONFIG_ACPI_PROCFS_SLEEP
 	/* 'sleep' [R/W] */
 	entry =
 	    create_proc_entry("sleep", S_IFREG | S_IRUGO | S_IWUSR,
include/acpi/acpi_drivers.h +4 -0
Index: linux-2.6/include/acpi/acpi_drivers.h
===================================================================
@@ -147,6 +147,10 @@ static inline void unregister_hotplug_do
 /*--------------------------------------------------------------------------
                                   Suspend/Resume
   -------------------------------------------------------------------------- */
+#ifdef CONFIG_PM_SLEEP
 extern int acpi_sleep_init(void);
+#else
+static inline int acpi_sleep_init(void) { return 0; }
+#endif
 
 #endif /*__ACPI_DRIVERS_H__*/
drivers/acpi/sleep/main.c +50 -44

149 lines not on this page · raw message

drivers/acpi/sleep/sleep.h +2 -0
Index: linux-2.6/drivers/acpi/sleep/sleep.h
===================================================================
@@ -6,3 +6,5 @@ extern void acpi_enable_wakeup_device_pr
 extern void acpi_enable_wakeup_device(u8 sleep_state);
 extern void acpi_disable_wakeup_device(u8 sleep_state);
 extern void acpi_gpe_sleep_prepare(u32 sleep_state);
+
+extern int acpi_sleep_prepare(u32 acpi_state);
#45 lore raw

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

In reply to Adrian Bunk
Quoted 8 lines · Adrian Bunk
Quoted 7 lines · Rafael J. Wysocki
Quoted 5 lines · Adrian Bunk

kernel/power/Kconfig config PM_TRACE · line 93

Quoted 3 lines · Rafael J. Wysocki

...

kernel/power/Kconfig +2 -0
+config SUSPEND
+	bool "Suspend"

  "Suspend to RAM"

Quoted 7 lines
Quoted 1 line

Not only. This also includes "standby".

Whatever it includes - please tell it to the user in the prompt.

Technical issues are important, but it's often forgotten how many problems people run into because the description of a kconfig option could have been better.

Sure. Please see the updated patch I've just sent. :-)

Greetings,
Rafael
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#46 lore raw

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Adrian Bunk
Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines · Adrian Bunk

kernel/power/Kconfig config PM_TRACE · line 93

Quoted 3 lines · Rafael J. Wysocki

...

kernel/power/Kconfig +2 -0
+config SUSPEND
+	bool "Suspend"

"Suspend to RAM"

Not only. This also includes "standby".

Quoted 7 lines
Quoted 5 lines

Whatever it includes - please tell it to the user in the prompt.

Technical issues are important, but it's often forgotten how many problems people run into because the description of a kconfig option could have been better.

Sure. Please see the updated patch I've just sent. :-)

So are you guys using:

"standby" = idle state, ~0.5 seconds
"suspend" = sleep to ram, ~10 seconds
"hibernate" = sleep to disk, ~30 seconds

If so - you rock. This is the common nomenclature I've been pushing for a few months now in GNOME, KDE and general userspace. I've written up a spec here:
http://cvs.gnome.org/viewcvs/*checkout*/gnome-power-manager/docs/sleep-names.html

Richard.

#47 lore raw

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

In reply to Rafael J. Wysocki
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Adrian Bunk
Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines · Adrian Bunk

kernel/power/Kconfig config PM_TRACE · line 93

Quoted 3 lines · Rafael J. Wysocki

...

kernel/power/Kconfig +2 -0
+config SUSPEND
+	bool "Suspend"

"Suspend to RAM"

Not only. This also includes "standby".

Quoted 7 lines
Quoted 5 lines

Whatever it includes - please tell it to the user in the prompt.

Technical issues are important, but it's often forgotten how many problems people run into because the description of a kconfig option could have been better.

Sure. Please see the updated patch I've just sent. :-)

So are you guys using:

"standby" = idle state, ~0.5 seconds
"suspend" = sleep to ram, ~10 seconds
"hibernate" = sleep to disk, ~30 seconds

If so - you rock. This is the common nomenclature I've been pushing for a few months now in GNOME, KDE and general userspace. I've written up a spec here:
http://cvs.gnome.org/viewcvs/*checkout*/gnome-power-manager/docs/sleep-names.html

Richard.

#54 lore raw

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

In reply to Adrian Bunk
Quoted 8 lines · Adrian Bunk
Quoted 7 lines · Rafael J. Wysocki
Quoted 5 lines · Adrian Bunk

kernel/power/Kconfig config PM_TRACE · line 93

Quoted 3 lines · Rafael J. Wysocki

...

kernel/power/Kconfig +2 -0
+config SUSPEND
+	bool "Suspend"

  "Suspend to RAM"

Quoted 7 lines
Quoted 1 line

Not only. This also includes "standby".

Whatever it includes - please tell it to the user in the prompt.

Technical issues are important, but it's often forgotten how many problems people run into because the description of a kconfig option could have been better.

Sure. Please see the updated patch I've just sent. :-)

Greetings,
Rafael

#48 lore raw

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

In reply to Richard Hughes
Quoted 18 lines · Richard Hughes
Quoted 17 lines · Rafael J. Wysocki
Quoted 15 lines · Adrian Bunk
Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines · Adrian Bunk

kernel/power/Kconfig config PM_TRACE · line 93

Quoted 3 lines · Rafael J. Wysocki

...

kernel/power/Kconfig +2 -0
+config SUSPEND
+	bool "Suspend"

"Suspend to RAM"

Not only. This also includes "standby".

Whatever it includes - please tell it to the user in the prompt.

Technical issues are important, but it's often forgotten how many problems people run into because the description of a kconfig option could have been better.

Quoted 7 lines
Quoted 1 line

Sure. Please see the updated patch I've just sent. :-)

So are you guys using:

"standby" = idle state, ~0.5 seconds
"suspend" = sleep to ram, ~10 seconds
"hibernate" = sleep to disk, ~30 seconds

Something like this, but "suspend" is not reserved as a name of specific state.

The second state is usually referred to as "suspend to RAM" or "STR" and is denoted by "mem" in /sys/power/state, if implemented. Moreover, "standby" and "mem" are both entered using the same code path, so they may generally be referred to as "suspend" states.

The times aren't strictly defined for "mem" and "standby", too. The general rule is that the times for "mem" are greater then for "standby" and the power drawn in "mem" is smaller than the power drawn in "standby", but the exact values will always depend on the platform. Apart from this, if the platform supports only one "suspend" state, it decides if that's "mem" or "standby".

On ACPI systems "standby" and "mem" correspond to the S1 and S3 sleep states, respectively.

Greetings,
Rafael

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

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

In reply to Richard Hughes
Quoted 18 lines · Richard Hughes
Quoted 17 lines · Rafael J. Wysocki
Quoted 15 lines · Adrian Bunk
Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines · Adrian Bunk

kernel/power/Kconfig config PM_TRACE · line 93

Quoted 3 lines · Rafael J. Wysocki

...

kernel/power/Kconfig +2 -0
+config SUSPEND
+	bool "Suspend"

"Suspend to RAM"

Not only. This also includes "standby".

Whatever it includes - please tell it to the user in the prompt.

Technical issues are important, but it's often forgotten how many problems people run into because the description of a kconfig option could have been better.

Quoted 7 lines
Quoted 1 line

Sure. Please see the updated patch I've just sent. :-)

So are you guys using:

"standby" = idle state, ~0.5 seconds
"suspend" = sleep to ram, ~10 seconds
"hibernate" = sleep to disk, ~30 seconds

Something like this, but "suspend" is not reserved as a name of specific state.

The second state is usually referred to as "suspend to RAM" or "STR" and is denoted by "mem" in /sys/power/state, if implemented. Moreover, "standby" and "mem" are both entered using the same code path, so they may generally be referred to as "suspend" states.

The times aren't strictly defined for "mem" and "standby", too. The general rule is that the times for "mem" are greater then for "standby" and the power drawn in "mem" is smaller than the power drawn in "standby", but the exact values will always depend on the platform. Apart from this, if the platform supports only one "suspend" state, it decides if that's "mem" or "standby".

On ACPI systems "standby" and "mem" correspond to the S1 and S3 sleep states, respectively.

Greetings,
Rafael

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

Re: [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated)

In reply to Rafael J. Wysocki

Ok, I took this, and modified Len's patch to re-introduce ACPI_SLEEP on top of it (I took the easy way out, and just made PM_SLEEP imply ACPI_SLEEP, which should make everything come out right. I could have dropped ACPI_SLEEP entirely in favour of PM_SLEEP, but that would have implied changing more of Len's patch than I was really comfy with).

Len, Rafael, please do check that the end result looks ok.

I suspect ACPI could now take the PM_SLEEP/SUSPEND/HIBERNATE details into account, and that some of the code is not necessary when HIBERNATE is not selected, for example, but I'm not at all sure that it's worth it being very fine-grained.

Linus

#52 lore raw

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

In reply to Richard Hughes
Quoted 10 lines · Richard Hughes

So are you guys using:

"standby" = idle state, ~0.5 seconds
"suspend" = sleep to ram, ~10 seconds
"hibernate" = sleep to disk, ~30 seconds

If so - you rock. This is the common nomenclature I've been pushing for a few months now in GNOME, KDE and general userspace. I've written up a spec here:
http://cvs.gnome.org/viewcvs/*checkout*/gnome-power-manager/docs/sleep-names.html

Well, those times don't quite work for my PowerBook. If we fixed suspend-to-RAM to reinitialize devices in parallel then it would easily hit 0.5 second transition times, but even now it's only at most 2 seconds. Also once in a while I'll be too hasty plugging my USB devices and manage to hardlock one of the USB busses, but that's an isolated USB driver suspend issue.

And it's certainly not called "standby", because the box can literally remain asleep for 7 days on a full charge, versus about 5 hours when just idle with wireless, backlight, and HDD off.

Cheers,
Kyle Moffett

#53 lore raw

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

In reply to Richard Hughes
Quoted 10 lines · Richard Hughes

So are you guys using:

"standby" = idle state, ~0.5 seconds
"suspend" = sleep to ram, ~10 seconds
"hibernate" = sleep to disk, ~30 seconds

If so - you rock. This is the common nomenclature I've been pushing for a few months now in GNOME, KDE and general userspace. I've written up a spec here:
http://cvs.gnome.org/viewcvs/*checkout*/gnome-power-manager/docs/sleep-names.html

Well, those times don't quite work for my PowerBook. If we fixed suspend-to-RAM to reinitialize devices in parallel then it would easily hit 0.5 second transition times, but even now it's only at most 2 seconds. Also once in a while I'll be too hasty plugging my USB devices and manage to hardlock one of the USB busses, but that's an isolated USB driver suspend issue.

And it's certainly not called "standby", because the box can literally remain asleep for 7 days on a full charge, versus about 5 hours when just idle with wireless, backlight, and HDD off.

Cheers,
Kyle Moffett

#70 lore raw

Re: [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated)

In reply to Linus Torvalds
Quoted 8 lines · Linus Torvalds

Ok, I took this, and modified Len's patch to re-introduce ACPI_SLEEP on top of it (I took the easy way out, and just made PM_SLEEP imply ACPI_SLEEP, which should make everything come out right. I could have dropped ACPI_SLEEP entirely in favour of PM_SLEEP, but that would have implied changing more of Len's patch than I was really comfy with).

Len, Rafael, please do check that the end result looks ok.

I only found two really minor issues covered by the appended patch (on top of the current -git).

Quoted 4 lines

I suspect ACPI could now take the PM_SLEEP/SUSPEND/HIBERNATE details into account, and that some of the code is not necessary when HIBERNATE is not selected, for example, but I'm not at all sure that it's worth it being very fine-grained.

Well, IMO, for now let's make sure everything works as is. :-)

Greetings,
Rafael

---
(1) I think it's better to use CONFIG_ACPI_SLEEP instead of CONFIG_PM_SLEEP in include/acpi/acpi_bus.h , too, for consistency.

(2) x86_64 defconfig is outdated

---
 arch/x86_64/defconfig   |    3 ---
 include/acpi/acpi_bus.h |    6 +++---
 2 files changed, 3 insertions(+), 6 deletions(-)
include/acpi/acpi_bus.h +3 -3
Index: linux-2.6/include/acpi/acpi_bus.h
===================================================================
@@ -366,16 +366,16 @@ acpi_handle acpi_get_child(acpi_handle, 
 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
 
-#ifdef CONFIG_PM_SLEEP
+#ifdef CONFIG_ACPI_SLEEP
 int acpi_pm_device_sleep_state(struct device *, int, int *);
-#else /* !CONFIG_PM_SLEEP */
+#else /* !CONFIG_ACPI_SLEEP */
 static inline int acpi_pm_device_sleep_state(struct device *d, int w, int *p)
 {
 	if (p)
 		*p = ACPI_STATE_D0;
 	return ACPI_STATE_D3;
 }
-#endif /* !CONFIG_PM_SLEEP */
+#endif /* !CONFIG_ACPI_SLEEP */
 
 #endif				/* CONFIG_ACPI */
 
arch/x86_64/defconfig +0 -3
Index: linux-2.6/arch/x86_64/defconfig
===================================================================
@@ -207,9 +207,6 @@ CONFIG_SUSPEND_SMP=y
 # ACPI (Advanced Configuration and Power Interface) Support
 #
 CONFIG_ACPI=y
-CONFIG_ACPI_SLEEP=y
-CONFIG_ACPI_SLEEP_PROC_FS=y
-CONFIG_ACPI_SLEEP_PROC_SLEEP=y
 CONFIG_ACPI_PROCFS=y
 CONFIG_ACPI_AC=y
 CONFIG_ACPI_BATTERY=y
#71 lore raw

Re: [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated)

In reply to Linus Torvalds
Quoted 8 lines · Linus Torvalds

Ok, I took this, and modified Len's patch to re-introduce ACPI_SLEEP on top of it (I took the easy way out, and just made PM_SLEEP imply ACPI_SLEEP, which should make everything come out right. I could have dropped ACPI_SLEEP entirely in favour of PM_SLEEP, but that would have implied changing more of Len's patch than I was really comfy with).

Len, Rafael, please do check that the end result looks ok.

I only found two really minor issues covered by the appended patch (on top of the current -git).

Quoted 4 lines

I suspect ACPI could now take the PM_SLEEP/SUSPEND/HIBERNATE details into account, and that some of the code is not necessary when HIBERNATE is not selected, for example, but I'm not at all sure that it's worth it being very fine-grained.

Well, IMO, for now let's make sure everything works as is. :-)

Greetings,
Rafael

---
(1) I think it's better to use CONFIG_ACPI_SLEEP instead of CONFIG_PM_SLEEP in include/acpi/acpi_bus.h , too, for consistency.

(2) x86_64 defconfig is outdated

---
 arch/x86_64/defconfig   |    3 ---
 include/acpi/acpi_bus.h |    6 +++---
 2 files changed, 3 insertions(+), 6 deletions(-)
include/acpi/acpi_bus.h +3 -3
Index: linux-2.6/include/acpi/acpi_bus.h
===================================================================
@@ -366,16 +366,16 @@ acpi_handle acpi_get_child(acpi_handle, 
 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
 
-#ifdef CONFIG_PM_SLEEP
+#ifdef CONFIG_ACPI_SLEEP
 int acpi_pm_device_sleep_state(struct device *, int, int *);
-#else /* !CONFIG_PM_SLEEP */
+#else /* !CONFIG_ACPI_SLEEP */
 static inline int acpi_pm_device_sleep_state(struct device *d, int w, int *p)
 {
 	if (p)
 		*p = ACPI_STATE_D0;
 	return ACPI_STATE_D3;
 }
-#endif /* !CONFIG_PM_SLEEP */
+#endif /* !CONFIG_ACPI_SLEEP */
 
 #endif				/* CONFIG_ACPI */
 
arch/x86_64/defconfig +0 -3
Index: linux-2.6/arch/x86_64/defconfig
===================================================================
@@ -207,9 +207,6 @@ CONFIG_SUSPEND_SMP=y
 # ACPI (Advanced Configuration and Power Interface) Support
 #
 CONFIG_ACPI=y
-CONFIG_ACPI_SLEEP=y
-CONFIG_ACPI_SLEEP_PROC_FS=y
-CONFIG_ACPI_SLEEP_PROC_SLEEP=y
 CONFIG_ACPI_PROCFS=y
 CONFIG_ACPI_AC=y
 CONFIG_ACPI_BATTERY=y
#23 lore raw

Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU

In reply to Adrian Bunk

Hi!

Quoted 9 lines
Quoted 1 line

Wait, doesn't HOTPLUG_CPU also depend on EXPERIMENTAL?

Damn, I started thinking about it, and then forgot about it when finishing the patch.

My thoughts were:
Is HOTPLUG_CPU still an experimental feature, or has it become a well-tested no longer experimental feature now that it's used on most recent laptops?

It is complex :-(.

HOTPLUG_CPU is pretty solid for the case how _suspend_ uses it (ie drivers quiescent).

It is also known broken for _other_ uses. (There was flamewar about that recently).

I'm not sure how to express that in Kconfig language without uglyness... We probably could split HOTPLUG_CPU into HOTPLUG_CPU_SUSPEND_ONLY (not experimental) and HOTPLUG_CPU (enables /sysfs interface)... but I do not think that is good idea. (It would also make suspend debugging a bit harder).

Pavel

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

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

In reply to Rafael J. Wysocki

Hi!

Quoted 23 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 1 line

Not only. This also includes "standby".

Whatever it includes - please tell it to the user in the prompt.

Technical issues are important, but it's often forgotten how many problems people run into because the description of a kconfig option could have been better.

Quoted 7 lines
Quoted 1 line

Sure. Please see the updated patch I've just sent. :-)

So are you guys using:

"standby" = idle state, ~0.5 seconds
"suspend" = sleep to ram, ~10 seconds
"hibernate" = sleep to disk, ~30 seconds

Something like this, but "suspend" is not reserved as a name of specific state.

The second state is usually referred to as "suspend to RAM" or "STR" and is denoted by "mem" in /sys/power/state, if implemented. Moreover, "standby" and "mem" are both entered using the same code path, so they may generally be referred to as "suspend" states.

Quoted 8 lines

The times aren't strictly defined for "mem" and "standby", too. The general rule is that the times for "mem" are greater then for "standby" and the power drawn in "mem" is smaller than the power drawn in "standby", but the exact values will always depend on the platform. Apart from this, if the platform supports only one "suspend" state, it decides if that's "mem" or "standby".

On ACPI systems "standby" and "mem" correspond to the S1 and S3 sleep states, respectively.

And I'd expect ~2seconds for both "standby" and "mem" on ACPI system. ACPI S1 is just "for windows ME compatibility, do not use" -- it draws too much power, and is not really faster.
Pavel

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

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND

In reply to Rafael J. Wysocki

Hi!

Quoted 23 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 1 line

Not only. This also includes "standby".

Whatever it includes - please tell it to the user in the prompt.

Technical issues are important, but it's often forgotten how many problems people run into because the description of a kconfig option could have been better.

Quoted 7 lines
Quoted 1 line

Sure. Please see the updated patch I've just sent. :-)

So are you guys using:

"standby" = idle state, ~0.5 seconds
"suspend" = sleep to ram, ~10 seconds
"hibernate" = sleep to disk, ~30 seconds

Something like this, but "suspend" is not reserved as a name of specific state.

The second state is usually referred to as "suspend to RAM" or "STR" and is denoted by "mem" in /sys/power/state, if implemented. Moreover, "standby" and "mem" are both entered using the same code path, so they may generally be referred to as "suspend" states.

Quoted 8 lines

The times aren't strictly defined for "mem" and "standby", too. The general rule is that the times for "mem" are greater then for "standby" and the power drawn in "mem" is smaller than the power drawn in "standby", but the exact values will always depend on the platform. Apart from this, if the platform supports only one "suspend" state, it decides if that's "mem" or "standby".

On ACPI systems "standby" and "mem" correspond to the S1 and S3 sleep states, respectively.

And I'd expect ~2seconds for both "standby" and "mem" on ACPI system. ACPI S1 is just "for windows ME compatibility, do not use" -- it draws too much power, and is not really faster.
Pavel

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

Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)

In reply to Linus Torvalds
Quoted 3 lines · Linus Torvalds

So I think the real issue is that we allow that "suspend_devices_and_enter()" code to be compiled without HOTPLUG_CPU in the first place. It's not supposed to work that way.

I don't see how CONFIG_HOTPLUG_CPU justifies its own existence. This e-mail thread would have never happened if it were simply included in CONFIG_SMP, always.

I agree, of course, that ACPI should never have had to work-around this by selecting HOTPLUG_CPU. But even though it is now done at the right layer, I don't see why PM should have to
be bothered with selecting HOTPLUG_CPU either --
it should just come with SMP.

-Len

author reviewer
#72 lore raw

Re: [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated)

In reply to Linus Torvalds
Quoted 8 lines · Linus Torvalds

Ok, I took this, and modified Len's patch to re-introduce ACPI_SLEEP on top of it (I took the easy way out, and just made PM_SLEEP imply ACPI_SLEEP, which should make everything come out right. I could have dropped ACPI_SLEEP entirely in favour of PM_SLEEP, but that would have implied changing more of Len's patch than I was really comfy with).

Len, Rafael, please do check that the end result looks ok.

SUSPEND depends only on (!SMP || SUSPEND_SMP_POSSIBLE). This means that while we limit the architectures it can build on if they are SMP, it can build on any !SMP architecture -- which probably isn't what we want.

I think the right way to go is your SUSPEND_UP_POSSIBLE suggestion. Honestly, I though it was overly verbose when I first read it, but I like it better now, especially since it works;-) I'll reply w/ an incremental patch.

Quoted 4 lines

I suspect ACPI could now take the PM_SLEEP/SUSPEND/HIBERNATE details into account, and that some of the code is not necessary when HIBERNATE is not selected, for example, but I'm not at all sure that it's worth it being very fine-grained.

As you know, I don't think that it is worth dedicated config options to save 16KB on an SMP+ACPI kernel. The prospect of adding code to slice that 16KB into finer grain savings seems even less worthwhile.

-Len

author reviewer
#73 lore raw

PATCH 1/1 create CONFIG_SUSPEND_UP_POSSIBLE

In reply to Linus Torvalds

From: Linus Torvalds <[email protected]>

Without this change, it is possible to build CONFIG_HIBERNATE on all !SMP architectures, but not necessarily their SMP versions.

I don't know for sure if the architecture list under SUSPEND_UP_POSSIBLE is correct. For now it simply matches the list for SUSPEND_SMP_POSSIBLE.

---
 Kconfig |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/power/Kconfig +6 -1
index 412859f..ccf6576 100644
@@ -72,6 +72,11 @@ 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 (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+	default y
+
 config SUSPEND_SMP_POSSIBLE
 	bool
 	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
@@ -92,7 +97,7 @@ config PM_SLEEP
 config SUSPEND
 	bool "Suspend to RAM and standby"
 	depends on PM
-	depends on !SMP || SUSPEND_SMP_POSSIBLE
+	depends on (!SMP && SUSPEND_UP_POSSIBLE) || (SMP && SUSPEND_SMP_POSSIBLE)
 	default y
 	---help---
 	  Allow the system to enter sleep states in which main memory is
author reviewer
#74 lore raw

Re: [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated)

In reply to Linus Torvalds
Quoted 8 lines · Linus Torvalds

Ok, I took this, and modified Len's patch to re-introduce ACPI_SLEEP on top of it (I took the easy way out, and just made PM_SLEEP imply ACPI_SLEEP, which should make everything come out right. I could have dropped ACPI_SLEEP entirely in favour of PM_SLEEP, but that would have implied changing more of Len's patch than I was really comfy with).

Len, Rafael, please do check that the end result looks ok.

SUSPEND depends only on (!SMP || SUSPEND_SMP_POSSIBLE). This means that while we limit the architectures it can build on if they are SMP, it can build on any !SMP architecture -- which probably isn't what we want.

I think the right way to go is your SUSPEND_UP_POSSIBLE suggestion. Honestly, I though it was overly verbose when I first read it, but I like it better now, especially since it works;-) I'll reply w/ an incremental patch.

Quoted 4 lines

I suspect ACPI could now take the PM_SLEEP/SUSPEND/HIBERNATE details into account, and that some of the code is not necessary when HIBERNATE is not selected, for example, but I'm not at all sure that it's worth it being very fine-grained.

As you know, I don't think that it is worth dedicated config options to save 16KB on an SMP+ACPI kernel. The prospect of adding code to slice that 16KB into finer grain savings seems even less worthwhile.

-Len

author reviewer
#75 lore raw

PATCH 1/1 create CONFIG_SUSPEND_UP_POSSIBLE

In reply to Linus Torvalds

From: Linus Torvalds <[email protected]>

Without this change, it is possible to build CONFIG_HIBERNATE on all !SMP architectures, but not necessarily their SMP versions.

I don't know for sure if the architecture list under SUSPEND_UP_POSSIBLE is correct. For now it simply matches the list for SUSPEND_SMP_POSSIBLE.

---
 Kconfig |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/power/Kconfig +6 -1
index 412859f..ccf6576 100644
@@ -72,6 +72,11 @@ 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 (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+	default y
+
 config SUSPEND_SMP_POSSIBLE
 	bool
 	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
@@ -92,7 +97,7 @@ config PM_SLEEP
 config SUSPEND
 	bool "Suspend to RAM and standby"
 	depends on PM
-	depends on !SMP || SUSPEND_SMP_POSSIBLE
+	depends on (!SMP && SUSPEND_UP_POSSIBLE) || (SMP && SUSPEND_SMP_POSSIBLE)
 	default y
 	---help---
 	  Allow the system to enter sleep states in which main memory is
#89 lore raw

Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)

In reply to Len Brown
Quoted 10 lines · Len Brown
Quoted 3 lines · Linus Torvalds

So I think the real issue is that we allow that "suspend_devices_and_enter()" code to be compiled without HOTPLUG_CPU in the first place. It's not supposed to work that way.

I don't see how CONFIG_HOTPLUG_CPU justifies its own existence. This e-mail thread would have never happened if it were simply included in CONFIG_SMP, always.

Quoted 5 lines

I agree, of course, that ACPI should never have had to work-around this by selecting HOTPLUG_CPU. But even though it is now done at the right layer, I don't see why PM should have to
be bothered with selecting HOTPLUG_CPU either --
it should just come with SMP.

why do you need hotplug just becouse you have muliple cpus? if you never have any intention of useing suspend and your hardware doesn't support hotplugging, why should you have to include the code for it?

Dvaid Lang

author reviewer
#61 lore raw

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)

In reply to Rafael J. Wysocki
Quoted 3 lines · Rafael J. Wysocki

Still, there are many other files in which CONFIG_PM can be replaced with CONFIG_PM_SLEEP or even with CONFIG_SUSPEND, but they can be updated in the future.

There is #ifdef CONFIG_PM
around all the .suspend and .resume methods.

Technically they are PM_DEVICE_STATES or something, that could really be under PM, and both SUSPEND and HIBERNATE would depend on PM_DEVICE_STATES, but it is also possible to have PM_DEVICE_STATES without SUSPEND and HIBERNATE.

oh no, I just suggested more instead of fewer config options:-O

but i agree, this can wait a bit...

-Len

#90 lore raw

Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)

In reply to [email protected]
Quoted 18 lines · On Mon 2007-07-30 21:09:33, [email protected] wrote:
Quoted 10 lines · Len Brown
Quoted 3 lines · Linus Torvalds

So I think the real issue is that we allow that "suspend_devices_and_enter()" code to be compiled without HOTPLUG_CPU in the first place. It's not supposed to work that way.

I don't see how CONFIG_HOTPLUG_CPU justifies its own existence. This e-mail thread would have never happened if it were simply included in CONFIG_SMP, always.

Quoted 5 lines

I agree, of course, that ACPI should never have had to work-around this by selecting HOTPLUG_CPU. But even though it is now done at the right layer, I don't see why PM should have to
be bothered with selecting HOTPLUG_CPU either --
it should just come with SMP.

Quoted 3 lines

why do you need hotplug just becouse you have muliple cpus? if you never have any intention of useing suspend and your hardware doesn't support hotplugging, why should you have to include the code for it?

Because otherwise we have way too many config options, and there are basically no downsides? Too many options => too little testing of each permutation...
Pavel

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

Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE

In reply to Len Brown

Hi!

Quoted 2 lines

Without this change, it is possible to build CONFIG_HIBERNATE on all !SMP architectures, but not necessarily their SMP versions.

Did you want to say "CONFIG_SUSPEND"?

Quoted 3 lines

I don't know for sure if the architecture list under SUSPEND_UP_POSSIBLE is correct. For now it simply matches the list for SUSPEND_SMP_POSSIBLE.

I do not think it is.

Quoted 10 lines
---
 Kconfig |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/power/Kconfig +0 -0
index 412859f..ccf6576 100644

kernel/power/Kconfig config PM_TRACE · line 77

Quoted 6 lines
kernel/power/Kconfig +3 -0
@@ -72,6 +72,11 @@ 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 (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES ||

At least ARM can do suspend, too... probably others. I was under impression that SUSPEND is "supported" by all the architectures, just some of them veto it at runtime (using pm_ops or how was it renamed).
Pavel

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

Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE

In reply to Len Brown

Hi!

Quoted 2 lines

Without this change, it is possible to build CONFIG_HIBERNATE on all !SMP architectures, but not necessarily their SMP versions.

Did you want to say "CONFIG_SUSPEND"?

Quoted 3 lines

I don't know for sure if the architecture list under SUSPEND_UP_POSSIBLE is correct. For now it simply matches the list for SUSPEND_SMP_POSSIBLE.

I do not think it is.

Quoted 10 lines
---
 Kconfig |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/power/Kconfig +0 -0
index 412859f..ccf6576 100644

kernel/power/Kconfig config PM_TRACE · line 77

Quoted 6 lines
kernel/power/Kconfig +3 -0
@@ -72,6 +72,11 @@ 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 (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES ||

At least ARM can do suspend, too... probably others. I was under impression that SUSPEND is "supported" by all the architectures, just some of them veto it at runtime (using pm_ops or how was it renamed).
Pavel

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

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)

In reply to Len Brown
Quoted 5 lines · Len Brown
Quoted 3 lines · Rafael J. Wysocki

Still, there are many other files in which CONFIG_PM can be replaced with CONFIG_PM_SLEEP or even with CONFIG_SUSPEND, but they can be updated in the future.

Quoted 7 lines

There is #ifdef CONFIG_PM
around all the .suspend and .resume methods.

Technically they are PM_DEVICE_STATES or something, that could really be under PM, and both SUSPEND and HIBERNATE would depend on PM_DEVICE_STATES, but it is also possible to have PM_DEVICE_STATES without SUSPEND and HIBERNATE.

Well, the people on linux-pm seem to agree that the .suspend() and .resume() callbacks are not suitable for runtime power management, so having them built without SUSPEND or HIBERNATION wouldn't be very useful. ;-)

Greetings,
Rafael

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

Re: [linux-pm] Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)

Am Dienstag 31 Juli 2007 schrieb Rafael J. Wysocki:

Quoted 3 lines

Well, the people on linux-pm seem to agree that the .suspend() and .resume() callbacks are not suitable for runtime power management, so having them built without SUSPEND or HIBERNATION wouldn't be very useful. ;-)

These are what USB runtime power management uses. How many code paths for power management do you want to introduce?

Regards
Oliver

#67 lore raw

Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)

In reply to Len Brown
Quoted 5 lines · Len Brown
Quoted 3 lines · Rafael J. Wysocki

Still, there are many other files in which CONFIG_PM can be replaced with CONFIG_PM_SLEEP or even with CONFIG_SUSPEND, but they can be updated in the future.

Quoted 7 lines

There is #ifdef CONFIG_PM
around all the .suspend and .resume methods.

Technically they are PM_DEVICE_STATES or something, that could really be under PM, and both SUSPEND and HIBERNATE would depend on PM_DEVICE_STATES, but it is also possible to have PM_DEVICE_STATES without SUSPEND and HIBERNATE.

Well, the people on linux-pm seem to agree that the .suspend() and .resume() callbacks are not suitable for runtime power management, so having them built without SUSPEND or HIBERNATION wouldn't be very useful. ;-)

Greetings,
Rafael

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

Re: Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)

In reply to Rafael J. Wysocki

Am Dienstag 31 Juli 2007 schrieb Rafael J. Wysocki:

Quoted 3 lines

Well, the people on linux-pm seem to agree that the .suspend() and .resume() callbacks are not suitable for runtime power management, so having them built without SUSPEND or HIBERNATION wouldn't be very useful. ;-)

These are what USB runtime power management uses. How many code paths for power management do you want to introduce?

Regards
Oliver

#78 lore raw

Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE

In reply to Pavel Machek
Quoted 5 lines · Pavel Machek

Hi!

Quoted 2 lines

Without this change, it is possible to build CONFIG_HIBERNATE on all !SMP architectures, but not necessarily their SMP versions.

Quoted 7 lines

Did you want to say "CONFIG_SUSPEND"?

Quoted 3 lines

I don't know for sure if the architecture list under SUSPEND_UP_POSSIBLE is correct. For now it simply matches the list for SUSPEND_SMP_POSSIBLE.

I do not think it is.

No, it's not.

Quoted 13 lines
Quoted 13 lines
---
 Kconfig |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/power/Kconfig +0 -0
index 412859f..ccf6576 100644
@@ -72,6 +72,11 @@ config PM_TRACE
 	CAUTION: this option will cause your machine's real-time clock to be
 	set to an invalid time after a resume.
 
Quoted 5 lines

kernel/power/Kconfig config PM_TRACE

Quoted 3 lines
kernel/power/Kconfig +3 -0
+config SUSPEND_UP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES ||

At least ARM can do suspend, too... probably others.

ARM, frv, sh, mips and blackfin (AFAICS).

Quoted 2 lines

I was under impression that SUSPEND is "supported" by all the architectures, just some of them veto it at runtime (using pm_ops or how was it renamed).

Historically, suspend support was implied by CONFIG_PM.

For now, it's not much point in using CONFIG_PM at all if the arch in question doesn't support suspending or hibernation, so I thought it would be better to leave it unrestricted.

Greetings,
Rafael

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

Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE

In reply to Pavel Machek
Quoted 5 lines · Pavel Machek

Hi!

Quoted 2 lines

Without this change, it is possible to build CONFIG_HIBERNATE on all !SMP architectures, but not necessarily their SMP versions.

Quoted 7 lines

Did you want to say "CONFIG_SUSPEND"?

Quoted 3 lines

I don't know for sure if the architecture list under SUSPEND_UP_POSSIBLE is correct. For now it simply matches the list for SUSPEND_SMP_POSSIBLE.

I do not think it is.

No, it's not.

Quoted 13 lines
Quoted 13 lines
---
 Kconfig |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/power/Kconfig +0 -0
index 412859f..ccf6576 100644
@@ -72,6 +72,11 @@ config PM_TRACE
 	CAUTION: this option will cause your machine's real-time clock to be
 	set to an invalid time after a resume.
 
Quoted 5 lines

kernel/power/Kconfig config PM_TRACE

Quoted 3 lines
kernel/power/Kconfig +3 -0
+config SUSPEND_UP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES ||

At least ARM can do suspend, too... probably others.

ARM, frv, sh, mips and blackfin (AFAICS).

Quoted 2 lines

I was under impression that SUSPEND is "supported" by all the architectures, just some of them veto it at runtime (using pm_ops or how was it renamed).

Historically, suspend support was implied by CONFIG_PM.

For now, it's not much point in using CONFIG_PM at all if the arch in question doesn't support suspending or hibernation, so I thought it would be better to leave it unrestricted.

Greetings,
Rafael

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

Re: [linux-pm] Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)

In reply to Oliver Neukum
Quoted 7 lines · Oliver Neukum

Am Dienstag 31 Juli 2007 schrieb Rafael J. Wysocki:

Quoted 3 lines

Well, the people on linux-pm seem to agree that the .suspend() and .resume() callbacks are not suitable for runtime power management, so having them built without SUSPEND or HIBERNATION wouldn't be very useful. ;-)

These are what USB runtime power management uses.

To be precise, I think the rule should be that if some code is needed for anything else than suspend/hibernation, it should be under plain CONFIG_PM. Still, if something is only needed for suspend/hibernation, it should go under CONFIG_PM_SLEEP or CONFIG_SUSPEND/HIBERNATION, depending on what it's needed for.

Now, AFAICS, for the majority of drivers .suspend() and .resume() are only needed for suspend/hibernation and really should be used for suspending only (some other callbacks are needed for hibernation).

Quoted 1 line

How many code paths for power management do you want to introduce?

At least one more, for hibernation.

That also depends on what approach to the runtime power management is widely accepted. For now, USB is in the vanguard. :-)

Greetings,
Rafael

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

Re: Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)

In reply to Oliver Neukum
Quoted 7 lines · Oliver Neukum

Am Dienstag 31 Juli 2007 schrieb Rafael J. Wysocki:

Quoted 3 lines

Well, the people on linux-pm seem to agree that the .suspend() and .resume() callbacks are not suitable for runtime power management, so having them built without SUSPEND or HIBERNATION wouldn't be very useful. ;-)

These are what USB runtime power management uses.

To be precise, I think the rule should be that if some code is needed for anything else than suspend/hibernation, it should be under plain CONFIG_PM. Still, if something is only needed for suspend/hibernation, it should go under CONFIG_PM_SLEEP or CONFIG_SUSPEND/HIBERNATION, depending on what it's needed for.

Now, AFAICS, for the majority of drivers .suspend() and .resume() are only needed for suspend/hibernation and really should be used for suspending only (some other callbacks are needed for hibernation).

Quoted 1 line

How many code paths for power management do you want to introduce?

At least one more, for hibernation.

That also depends on what approach to the runtime power management is widely accepted. For now, USB is in the vanguard. :-)

Greetings,
Rafael

Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
#118 lore raw
In reply to Jan Dittmer
Quoted 8 lines · Jan Dittmer
Quoted 5 lines · Andreas Schwab
Quoted 2 lines · Jan Dittmer

Len Brown wrote:
FATAL: drivers/acpi/button: sizeof(struct acpi_device_id)=20 is not a modulo of the size of section __mod_acpi_device_table=144.

Are you cross-compiling? The definition of kernel_ulong_t won't work on x86.

Yes, sorry, should have mentioned that. Build system is x86. Still, it didn't happen before the recent acpi merge.

I also have the same error, which I didn't have in 2.6.22:

FATAL: drivers/acpi/ac: sizeof(struct acpi_device_id)=20 is not a modulo of the size of section __mod_acpi_device_table=48. Fix definition of struct acpi_device_id in mod_devicetable.h make[1]: *** [__modpost] Error 1

Build system is x86_64. I'm not cross-compiling, as the target machine (not the build machine) is also x86_64.

- Yasha

author reviewer
#84 lore raw

PATCH 1/1 ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again)

In reply to Linus Torvalds

From: Len Brown <[email protected]>

CONFIG_ACPI_PROCFS_SLEEP is a NO-OP -- delete it (again).

Apparently 296699de6bdc717189a331ab6bbe90e05c94db06 creating CONFIG_SUSPEND and CONFIG_PM_SLEEP was based on an out-dated version of drivers/acpi/Kconfig, as it erroneously restored this recently deleted config option.

---

drivers/acpi/Kconfig +0 -8
index 934d639..f1372de 100644
@@ -68,14 +68,6 @@ config ACPI_PROCFS
 
 	  Say N to delete /proc/acpi/ files that have moved to /sys/
 
-config ACPI_PROCFS_SLEEP
-	bool "/proc/acpi/sleep (deprecated)"
-	depends on PM_SLEEP && ACPI_PROCFS
-	default n
-	---help---
-	  Create /proc/acpi/sleep
-	  Deprecated by /sys/power/state
-
 config ACPI_AC
 	tristate "AC Adapter"
 	depends on X86
#85 lore raw

Re: [PATCH] ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again)

Quoted 7 lines · Len Brown

From: Len Brown <[email protected]>

CONFIG_ACPI_PROCFS_SLEEP is a NO-OP -- delete it (again).

Apparently 296699de6bdc717189a331ab6bbe90e05c94db06 creating CONFIG_SUSPEND and CONFIG_PM_SLEEP was based on an out-dated version of drivers/acpi/Kconfig, as it erroneously restored this recently deleted config option.

Some chunks of code in drivers/acpi/sleep/proc.c depend on CONFIG_ACPI_PROCFS_SLEEP. Do you also intend to remove that code?

Greetings,
Rafael

#86 lore raw

Re: [PATCH] ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again)

In reply to Len Brown
Quoted 7 lines · Len Brown

From: Len Brown <[email protected]>

CONFIG_ACPI_PROCFS_SLEEP is a NO-OP -- delete it (again).

Apparently 296699de6bdc717189a331ab6bbe90e05c94db06 creating CONFIG_SUSPEND and CONFIG_PM_SLEEP was based on an out-dated version of drivers/acpi/Kconfig, as it erroneously restored this recently deleted config option.

Some chunks of code in drivers/acpi/sleep/proc.c depend on CONFIG_ACPI_PROCFS_SLEEP. Do you also intend to remove that code?

Greetings,
Rafael

#103 lore raw

Re: scripts/mod/file2alias.c cross compile problem

In reply to Adrian Bunk
Quoted 33 lines · Adrian Bunk
Quoted 8 lines · Tony
Quoted 5 lines

So it seems on ia64 with gcc 3.3.6 there's some 8 byte alignment of the array members?

Sam and the ia64 maintainers Cc'ed - they might know better what's going on here.

This ia64 maintainer is baffled ... but I don't see the problem here (perhaps because my build machine has gcc 3.4.6).

I found what causes this problem, and it only occurs during cross compilation.

The struct is:

#define ACPI_ID_LEN 9

struct acpi_device_id {
	 __u8 id[ACPI_ID_LEN];
	kernel_ulong_t driver_data;
};

When compiling for ia64, this results in:

struct acpi_device_id {
	__u8 id[9];
	uint64_t driver_data;
};
Quoted 6 lines

sizeof(struct acpi_device_id) for ia64 is due to different padding after id[] 20 bytes on i386 but 24 bytes on ia64.

scripts/mod/file2alias.c is compiled with HOSTCC and ensures that kernel_ulong_t is correct (in this case uint64_t for ia64), but it can't cope with different padding on different architectures.

This one should workaround it. Is this acceptable for now? Don't know how to fix this in a cleaner way (but I am sure it's possible... ). Maybe an IA64 guy who is more used to such things has a better idea and could have a look at this if there is time...

Thomas

-------------

Cross-compilation between e.g. i386 -> 64bit could break -> work around it

Adrian Bunk: scripts/mod/file2alias.c is compiled with HOSTCC and ensures that kernel_ulong_t is correct, but it can't cope with different padding on different architectures.

---
 include/linux/mod_devicetable.h |    2 ++
 1 file changed, 2 insertions(+)

Index: torvalds/include/linux/mod_devicetable.h =================================--- torvalds.orig/include/linux/mod_devicetable.h +++ torvalds/include/linux/mod_devicetable.h
@@ -160,9 +160,11 @@ struct ap_device_id {
#define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01

#define ACPI_ID_LEN 9
+#define FILLUP_LEN 7 /* dirty fix for i386 -> 64bit cross-compilation */

struct acpi_device_id {
__u8 id[ACPI_ID_LEN];
+ __u8 dummy[FILLUP_LEN];
kernel_ulong_t driver_data;
};

#104 lore raw

RE: scripts/mod/file2alias.c cross compile problem

Quoted 3 lines

Adrian Bunk: scripts/mod/file2alias.c is compiled with HOSTCC and ensures that kernel_ulong_t is correct, but it can't cope with different padding on different architectures.

Surely this is the root cause ... you can't expect that the alignment rules of HOSTCC to make any sense for an arbitraty target.

Review

Quoted 7 lines
(quoted diff) +2 -0
+#define FILLUP_LEN	7 /* dirty fix for i386 -> 64bit cross-compilation */
 
 struct acpi_device_id {
 	__u8 id[ACPI_ID_LEN];
+	__u8 dummy[FILLUP_LEN];
 	kernel_ulong_t driver_data;
 };

What's so special about this structure that we get an error? Surely there are many kernel structures with different alignment/padding when built with i386 complier compared with ia64 compiler. We can't go around manually padding them all (it wastes time, and also wastes memory on the 32-bit systems that don't need this padding).

-Tony

#105 lore raw

Re: scripts/mod/file2alias.c cross compile problem

Quoted 9 lines · Tony

Review

Quoted 7 lines
(quoted diff) +2 -0
+#define FILLUP_LEN	7 /* dirty fix for i386 -> 64bit cross-compilation */
 
 struct acpi_device_id {
 	__u8 id[ACPI_ID_LEN];
+	__u8 dummy[FILLUP_LEN];
 	kernel_ulong_t driver_data;
 };

What's so special about this structure that we get an error?

It's special because it's a device_id structure, and those structures must come out identical using either the host or the target compiler.

Andreas.

Signature · 8 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#106 lore raw

RE: scripts/mod/file2alias.c cross compile problem

Quoted 10 lines
Quoted 7 lines

Review

Quoted 5 lines

struct acpi_device_id {

(quoted diff) +1 -0
 	__u8 id[ACPI_ID_LEN];
+	__u8 dummy[FILLUP_LEN];
 	kernel_ulong_t driver_data;
 };

What's so special about this structure that we get an error?

It's special because it's a device_id structure, and those structures must come out identical using either the host or the target compiler.

That didn't help me understand. Are device_id structures visible in some user-level API? If so, then I can see why they'd need to be the same (but then I'd be confused why this structure uses a "kernel_ulong_t" type).

-Tony

#107 lore raw

Re: scripts/mod/file2alias.c cross compile problem

Quoted 8 lines · Tony
Quoted 8 lines
Quoted 7 lines

Review

Quoted 5 lines

struct acpi_device_id {

(quoted diff) +1 -0
 	__u8 id[ACPI_ID_LEN];
+	__u8 dummy[FILLUP_LEN];
 	kernel_ulong_t driver_data;
 };

What's so special about this structure that we get an error?

Quoted 7 lines
Quoted 2 lines

It's special because it's a device_id structure, and those structures must come out identical using either the host or the target compiler.

That didn't help me understand. Are device_id structures visible in some user-level API? If so, then I can see why they'd need to be the same (but then I'd be confused why this structure uses a "kernel_ulong_t" type).

I second this. For anything visible in userspace from include/* we require usage of the kernel specific __u8, __u16, __u32, __u64 typedefs but for device_id we accept kernel_ulong_t which result in the following crap in file2alias.c:

/* We use the ELF typedefs for kernel_ulong_t but bite the bullet and
* use either stdint.h or inttypes.h for the rest. */
#if KERNEL_ELFCLASS == ELFCLASS32
typedef Elf32_Addr kernel_ulong_t;
#define BITS_PER_LONG 32
#else
typedef Elf64_Addr kernel_ulong_t;
#define BITS_PER_LONG 64
#endif

And we ought to have __u64 available.
See for example types.h from asm-i386:
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) typedef __signed__ long long __s64; typedef unsigned long long __u64;
#endif

Sam

#108 lore raw

Re: scripts/mod/file2alias.c cross compile problem

Quoted 17 lines · Sam Ravnborg

I second this. For anything visible in userspace from include/* we require usage of the kernel specific __u8, __u16, __u32, __u64 typedefs but for device_id we accept kernel_ulong_t which result in the following crap in file2alias.c:

/* We use the ELF typedefs for kernel_ulong_t but bite the bullet and
* use either stdint.h or inttypes.h for the rest. */
#if KERNEL_ELFCLASS = ELFCLASS32
typedef Elf32_Addr kernel_ulong_t;
#define BITS_PER_LONG 32
#else
typedef Elf64_Addr kernel_ulong_t;
#define BITS_PER_LONG 64
#endif

Quoted 6 lines

And we ought to have __u64 available.
See for example types.h from asm-i386:
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) typedef __signed__ long long __s64; typedef unsigned long long __u64;
#endif

You are talking about something different than the current problem.

The current problem is that when crosscompiling we get a different _padding_ due to file2alias.c being compiled with HOSTCC.

What you are talking about is a different issue, and I can't talk about it since I don't understand these interactions between modpost and depmod.

Quoted 1 line

Sam

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#109 lore raw

Re: scripts/mod/file2alias.c cross compile problem

Quoted 26 lines · Adrian Bunk
Quoted 17 lines · Sam Ravnborg

I second this. For anything visible in userspace from include/* we require usage of the kernel specific __u8, __u16, __u32, __u64 typedefs but for device_id we accept kernel_ulong_t which result in the following crap in file2alias.c:

/* We use the ELF typedefs for kernel_ulong_t but bite the bullet and
* use either stdint.h or inttypes.h for the rest. */
#if KERNEL_ELFCLASS == ELFCLASS32
typedef Elf32_Addr kernel_ulong_t;
#define BITS_PER_LONG 32
#else
typedef Elf64_Addr kernel_ulong_t;
#define BITS_PER_LONG 64
#endif

Quoted 6 lines

And we ought to have __u64 available.
See for example types.h from asm-i386:
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) typedef __signed__ long long __s64; typedef unsigned long long __u64;
#endif

Quoted 4 lines

You are talking about something different than the current problem.

The current problem is that when crosscompiling we get a different _padding_ due to file2alias.c being compiled with HOSTCC.

I am well aware of that.
My point was that we are dealing with userspace - in this case depmod. So I wondered why we had special (as in less strict) rules here.

Sam

#110 lore raw

Re: scripts/mod/file2alias.c cross compile problem

Quoted 3 lines · Sam Ravnborg

I am well aware of that.
My point was that we are dealing with userspace - in this case depmod. So I wondered why we had special (as in less strict) rules here.

In reality it's a pointer...

#111 lore raw

RE: scripts/mod/file2alias.c cross compile problem

In reply to Luck, Tony
Quoted 9 lines · Tony
Quoted 3 lines

Adrian Bunk: scripts/mod/file2alias.c is compiled with HOSTCC and ensures that kernel_ulong_t is correct, but it can't cope with different padding on different architectures.

Surely this is the root cause ... you can't expect that the alignment rules of HOSTCC to make any sense for an arbitraty target.

Quoted 2 lines

+#define FILLUP_LEN 7 /* dirty fix for i386 -> 64bit cross-compilation */

Quoted 7 lines

Review

Quoted 5 lines

struct acpi_device_id {

(quoted diff) +1 -0
 	__u8 id[ACPI_ID_LEN];
+	__u8 dummy[FILLUP_LEN];
 	kernel_ulong_t driver_data;
 };

What's so special about this structure that we get an error?

It's in mod_devicetable.h: see comment at top of that file. These structures serve dual purpose: to describe the capabilities of the driver to the kernel probing functions, *and* to export them to userspace tables. The former purpose is why there's a data pointer in there.

scripts/mod/file2alias is the program that reads this: although it can be altered to parse 32-vs-64, Adrian's fix is the simplest.

Hope that clarifies,
Rusty.

#112 lore raw

Re: scripts/mod/file2alias.c cross compile problem

Quoted 3 lines · Rusty Russell

...
scripts/mod/file2alias is the program that reads this: although it can be altered to parse 32-vs-64, Adrian's fix is the simplest.

s/Adrian/Thomas/

Quoted 2 lines

Hope that clarifies,
Rusty.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
author reviewer
#80 lore raw

Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE

In reply to Pavel Machek
Quoted 6 lines · Pavel Machek

Hi!

Quoted 2 lines

Without this change, it is possible to build CONFIG_HIBERNATE on all !SMP architectures, but not necessarily their SMP versions.

Did you want to say "CONFIG_SUSPEND"?

Yes.

Quoted 19 lines
Quoted 3 lines

I don't know for sure if the architecture list under SUSPEND_UP_POSSIBLE is correct. For now it simply matches the list for SUSPEND_SMP_POSSIBLE.

I do not think it is.

Quoted 13 lines
---
 Kconfig |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/power/Kconfig +0 -0
index 412859f..ccf6576 100644
@@ -72,6 +72,11 @@ config PM_TRACE
 	CAUTION: this option will cause your machine's real-time clock to be
 	set to an invalid time after a resume.
 
Quoted 7 lines

kernel/power/Kconfig config PM_TRACE

Quoted 3 lines
kernel/power/Kconfig +3 -0
+config SUSPEND_UP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES ||

At least ARM can do suspend, too... probably others. I was under impression that SUSPEND is "supported" by all the architectures, just some of them veto it at runtime (using pm_ops or how was it renamed).

The reason this entire thread started is because Linus, Jeff and others said that they didn't want code magically compiled into their kernel that they did not explicitly ask for -- even if the savings were small and that kernel was already something rather beefy, such as ACPI+SMP.

The current code is simply broken, because it allows SUSPEND on IA64 if UP, but not on SMP. It should really be neither.

Further, the only requirement to enable CONFIG_SUSPEND by default is PM && CONFIG_SMP=n, and that doesn't make much sense -- particularly since many of the non X86 architectures are small and according to the logic above, if SUSPEND (and PM_SLEEP, which it enables) adds any code to those kernels when they don't need it,
then it would be a regression.

thus my patch, if there is a list for SMP, there should be a list for !SMP. If the list is incomplete, we need to fix it.

-Len

author reviewer
#81 lore raw

Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE

In reply to Pavel Machek
Quoted 6 lines · Pavel Machek

Hi!

Quoted 2 lines

Without this change, it is possible to build CONFIG_HIBERNATE on all !SMP architectures, but not necessarily their SMP versions.

Did you want to say "CONFIG_SUSPEND"?

Yes.

Quoted 19 lines
Quoted 3 lines

I don't know for sure if the architecture list under SUSPEND_UP_POSSIBLE is correct. For now it simply matches the list for SUSPEND_SMP_POSSIBLE.

I do not think it is.

Quoted 13 lines
---
 Kconfig |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/power/Kconfig +0 -0
index 412859f..ccf6576 100644
@@ -72,6 +72,11 @@ config PM_TRACE
 	CAUTION: this option will cause your machine's real-time clock to be
 	set to an invalid time after a resume.
 
Quoted 7 lines

kernel/power/Kconfig config PM_TRACE

Quoted 3 lines
kernel/power/Kconfig +3 -0
+config SUSPEND_UP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES ||

At least ARM can do suspend, too... probably others. I was under impression that SUSPEND is "supported" by all the architectures, just some of them veto it at runtime (using pm_ops or how was it renamed).

The reason this entire thread started is because Linus, Jeff and others said that they didn't want code magically compiled into their kernel that they did not explicitly ask for -- even if the savings were small and that kernel was already something rather beefy, such as ACPI+SMP.

The current code is simply broken, because it allows SUSPEND on IA64 if UP, but not on SMP. It should really be neither.

Further, the only requirement to enable CONFIG_SUSPEND by default is PM && CONFIG_SMP=n, and that doesn't make much sense -- particularly since many of the non X86 architectures are small and according to the logic above, if SUSPEND (and PM_SLEEP, which it enables) adds any code to those kernels when they don't need it,
then it would be a regression.

thus my patch, if there is a list for SMP, there should be a list for !SMP. If the list is incomplete, we need to fix it.

-Len

#82 lore raw

Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE

Quoted 37 lines · Len Brown
Quoted 6 lines · Pavel Machek

Hi!

Quoted 2 lines

Without this change, it is possible to build CONFIG_HIBERNATE on all !SMP architectures, but not necessarily their SMP versions.

Did you want to say "CONFIG_SUSPEND"?

Yes.

Quoted 19 lines
Quoted 3 lines

I don't know for sure if the architecture list under SUSPEND_UP_POSSIBLE is correct. For now it simply matches the list for SUSPEND_SMP_POSSIBLE.

I do not think it is.

Quoted 13 lines
---
 Kconfig |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/power/Kconfig +0 -0
index 412859f..ccf6576 100644
@@ -72,6 +72,11 @@ config PM_TRACE
 	CAUTION: this option will cause your machine's real-time clock to be
 	set to an invalid time after a resume.
 
Quoted 7 lines

kernel/power/Kconfig config PM_TRACE

Quoted 3 lines
kernel/power/Kconfig +3 -0
+config SUSPEND_UP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES ||

At least ARM can do suspend, too... probably others. I was under impression that SUSPEND is "supported" by all the architectures, just some of them veto it at runtime (using pm_ops or how was it renamed).

Quoted 7 lines

The reason this entire thread started is because Linus, Jeff and others said that they didn't want code magically compiled into their kernel that they did not explicitly ask for -- even if the savings were small and that kernel was already something rather beefy, such as ACPI+SMP.

The current code is simply broken, because it allows SUSPEND on IA64 if UP, but not on SMP. It should really be neither.

Actually, it should be both, AFAICT. Suspend infrastructure should be there, just returing -EINVAL... that's how it worked in 2.6.22 IIRC.

Pavel

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

Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE

In reply to Len Brown
Quoted 37 lines · Len Brown
Quoted 6 lines · Pavel Machek

Hi!

Quoted 2 lines

Without this change, it is possible to build CONFIG_HIBERNATE on all !SMP architectures, but not necessarily their SMP versions.

Did you want to say "CONFIG_SUSPEND"?

Yes.

Quoted 19 lines
Quoted 3 lines

I don't know for sure if the architecture list under SUSPEND_UP_POSSIBLE is correct. For now it simply matches the list for SUSPEND_SMP_POSSIBLE.

I do not think it is.

Quoted 13 lines
---
 Kconfig |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/power/Kconfig +0 -0
index 412859f..ccf6576 100644
@@ -72,6 +72,11 @@ config PM_TRACE
 	CAUTION: this option will cause your machine's real-time clock to be
 	set to an invalid time after a resume.
 
Quoted 7 lines

kernel/power/Kconfig config PM_TRACE

Quoted 3 lines
kernel/power/Kconfig +3 -0
+config SUSPEND_UP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES ||

At least ARM can do suspend, too... probably others. I was under impression that SUSPEND is "supported" by all the architectures, just some of them veto it at runtime (using pm_ops or how was it renamed).

Quoted 7 lines

The reason this entire thread started is because Linus, Jeff and others said that they didn't want code magically compiled into their kernel that they did not explicitly ask for -- even if the savings were small and that kernel was already something rather beefy, such as ACPI+SMP.

The current code is simply broken, because it allows SUSPEND on IA64 if UP, but not on SMP. It should really be neither.

Actually, it should be both, AFAICT. Suspend infrastructure should be there, just returing -EINVAL... that's how it worked in 2.6.22 IIRC.

Pavel

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

RE: scripts/mod/file2alias.c cross compile problem

In reply to Rusty Russell
Quoted 18 lines · Rusty Russell
Quoted 9 lines · Tony
Quoted 3 lines

Adrian Bunk: scripts/mod/file2alias.c is compiled with HOSTCC and ensures that kernel_ulong_t is correct, but it can't cope with different padding on different architectures.

Surely this is the root cause ... you can't expect that the alignment rules of HOSTCC to make any sense for an arbitraty target.

Quoted 2 lines

+#define FILLUP_LEN 7 /* dirty fix for i386 -> 64bit cross-compilation */

Quoted 7 lines

Review

Quoted 5 lines

struct acpi_device_id {

(quoted diff) +1 -0
 	__u8 id[ACPI_ID_LEN];
+	__u8 dummy[FILLUP_LEN];
 	kernel_ulong_t driver_data;
 };

What's so special about this structure that we get an error?

Quoted 8 lines

It's in mod_devicetable.h: see comment at top of that file. These structures serve dual purpose: to describe the capabilities of the driver to the kernel probing functions, *and* to export them to userspace tables. The former purpose is why there's a data pointer in there.

scripts/mod/file2alias is the program that reads this: although it can be altered to parse 32-vs-64, Adrian's fix is the simplest.

Oops, this will cause a lot build warnings, as this struct gets initialized like that:

        ..
        {"PNP0C0A", 0},
        ..

at a lot places. It would be better to bump up the id itself like the attached patch does...

Thanks,

Thomas

----------------------

Cross-compilation between e.g. i386 -> 64bit could break -> work around it

Adrian Bunk: scripts/mod/file2alias.c is compiled with HOSTCC and ensures that kernel_ulong_t is correct, but it can't cope with different padding on different architectures.

---
 include/linux/mod_devicetable.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/mod_devicetable.h +2 -1
Index: linux-2.6.23-rc3/include/linux/mod_devicetable.h
===================================================================
@@ -159,7 +159,8 @@ struct ap_device_id {
 
 #define AP_DEVICE_ID_MATCH_DEVICE_TYPE		0x01
 
-#define ACPI_ID_LEN	9
+#define ACPI_ID_LEN	16 /* only 9 bytes needed here, 16 bytes are used */
+			   /* to workaround crosscompile issues */
 
 struct acpi_device_id {
 	__u8 id[ACPI_ID_LEN];
#114 lore raw

RE: scripts/mod/file2alias.c cross compile problem

include/linux/mod_devicetable.h struct ap_device_id { · line 162

Quoted 2 lines
include/linux/mod_devicetable.h +1 -1
-#define ACPI_ID_LEN	9
+#define ACPI_ID_LEN	16 /* only 9 bytes needed here, 16 bytes are used */

What will happen if someone uses more than 9 bytes? With the old limit there would be a compile time error it someone initialized with:

	{"PNP0C0ABCDEFGH", 0},

But if we change ACPI_ID_LEN the error will move to run-time.

-Tony

#115 lore raw

RE: scripts/mod/file2alias.c cross compile problem

Quoted 10 lines · Tony

include/linux/mod_devicetable.h struct ap_device_id { · line 162

Quoted 2 lines
include/linux/mod_devicetable.h +1 -1
-#define ACPI_ID_LEN	9
+#define ACPI_ID_LEN	16 /* only 9 bytes needed here, 16 bytes are used */

What will happen if someone uses more than 9 bytes? With the old limit there would be a compile time error it someone initialized with:

	{"PNP0C0ABCDEFGH", 0},

But if we change ACPI_ID_LEN the error will move to run-time.

That should not harm.

Quoted 1 line

From spec point of view only 8 bytes are needed. Here 9 bytes are used

as then string functions can be used. The whole rest of the kernel does not use ACPI_ID_LEN.
If someone defines such an id, his driver won't ever get loaded and he gets bug reports very soon anyway.

Hmm, I wonder whether this even may come in handy later:
Some BIOSes have some spec violating strange hids like:
"*PNP0C0A"
or
"_PNP0C0A"
While I thought the "_" or "*" should be cut away by ACPI parser, it might be a hint to the OS to do something special. AFAIK only very specific devices (WMI and some graphics?) have such strange hids defined, those drivers could explicitly match for the spec violating string then.

Thomas