LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [GIT PATCH] ACPI patches for 2.6.23-rc1
@ 2007-07-25 16:38 Len Brown
  2007-07-25 18:48 ` Linus Torvalds
  2007-07-27  6:26 ` Jan Dittmer
  0 siblings, 2 replies; 75+ messages in thread
From: Len Brown @ 2007-07-25 16:38 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton, linux-acpi, linux-kernel

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 linux-acpi@vger.kernel.org
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 <len.brown@intel.com>
Date:   Wed Jul 25 01:36:53 2007 -0400

    Pull auto-load-modules into release branch

commit cb3e0c107bebc6cf3e7158f7aa54c32017c7d4c4
Merge: 1e1f3f2... 50ad147...
Author: Len Brown <len.brown@intel.com>
Date:   Wed Jul 25 01:36:31 2007 -0400

    Pull d-states into release branch
    
    Conflicts:
    
    	drivers/acpi/sleep/main.c
    
    Signed-off-by: Len Brown <len.brown@intel.com>

commit 1e1f3f24cdbc53e67acd7b2e37e6cf0cb11bd13c
Merge: c30c620... e8b2fd0...
Author: Len Brown <len.brown@intel.com>
Date:   Wed Jul 25 01:35:25 2007 -0400

    Pull kconfig into release branch

commit e8b2fd01228f690c3e0cb3f14facfa8d93d4adae
Author: Len Brown <len.brown@intel.com>
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.
    
    Signed-off-by: Len Brown <len.brown@intel.com>

commit c30c620ee1cc351bcc149c4280e1166998df0064
Author: Len Brown <len.brown@intel.com>
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
    
    Signed-off-by: Len Brown <len.brown@intel.com>
    Acked-by: Luming Yu <luming.yu@intel.com>

commit 50ad147aa09c829cd452fae6ca99396c0b5b0695
Author: Rafael J. Wysocki <rjw@sisk.pl>
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().
    
    Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
    Signed-off-by: Len Brown <len.brown@intel.com>

commit 7c5aa6642fa26641ebf286966a165aec71c91991
Author: Len Brown <len.brown@intel.com>
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.
    
    Signed-off-by: Len Brown <len.brown@intel.com>

commit 43532c8a46ae313c2da3baa7598a1de4d403ba83
Author: Len Brown <len.brown@intel.com>
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.
    
    Signed-off-by: Len Brown <len.brown@intel.com>

commit fb804714560463534ebcb538a3b0a3c687a830ec
Author: Len Brown <len.brown@intel.com>
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.
    
    Signed-off-by: Len Brown <len.brown@intel.com>

commit 1ba90e3a87c46500623afdc3898573e4a5ebb21b
Author: Thomas Renninger <trenn@suse.de>
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.
    
    Signed-off-by: Thomas Renninger <trenn@suse.de>
    Signed-off-by: Len Brown <len.brown@intel.com>

commit 29b71a1ca74491fab9fed09e9d835d840d042690
Author: Thomas Renninger <trenn@suse.de>
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.
    
    Signed-off-by: Thomas Renninger <trenn@suse.de>
    Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
    Signed-off-by: Len Brown <len.brown@intel.com>

commit 8c8eb78f673c07b60f31751e1e47ac367c60c6b7
Author: Thomas Renninger <trenn@suse.de>
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
    
    Signed-off-by: Thomas Renninger <trenn@suse.de>
    Signed-off-by: Len Brown <len.brown@intel.com>

commit 3b0d71170d37878bbb1203ebc3f92e36d6151a80
Author: Al Viro <viro@ftp.linux.org.uk>
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 <nix.or.die@googlemail.com>
    
    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.
    
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Len Brown <len.brown@intel.com>

commit 3cc2649b879f0e83fd51b14c82bad5f8f208591e
Author: Luming Yu <luming.yu@gmail.com>
Date:   Mon Jul 23 12:39:28 2007 -0400

    ACPI: fix oops due to typo in new throttling code
    
    Signed-off-by: Luming Yu <luming.yu@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Len Brown <len.brown@intel.com>

commit 10b3dcae0f275e2546e55303d64ddbb58cec7599
Author: Shaohua Li <shaohua.li@intel.com>
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.
    
    Signed-off-by: Shaohua Li <shaohua.li@intel.com>
    Signed-off-by: Len Brown <len.brown@intel.com>

commit ab826ca4cf2fe8ebcfd21189ca8bfeb47ca88359
Author: Shaohua Li <shaohua.li@intel.com>
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
    
    Signed-off-by: Shaohua Li<shaohua.li@intel.com>
    Signed-off-by: Len Brown <len.brown@intel.com>

commit fc30e68e88baf463683bde43347756889ba2ffae
Author: Shaohua Li <shaohua.li@intel.com>
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
    
    Signed-off-by: Shaohua Li <shaohua.li@intel.com>
    Signed-off-by: Len Brown <len.brown@intel.com>

commit fd4aff1a28eecbd729b409bf7d3eff5948f20414
Author: Shaohua Li <shaohua.li@intel.com>
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 <rjw@sisk.pl>
    
    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 .
    
    Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
    Acked-by: Pavel Machek <pavel@ucw.cz>
    Signed-off-by: Len Brown <len.brown@intel.com>

commit e9b3aba887f47f9cd64de20fec9c333a932b70dc
Author: Rafael J. Wysocki <rjw@sisk.pl>
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.
    
    Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
    Acked-by: Pavel Machek <pavel@ucw.cz>
    Acked-by: David Brownell <david-b@pacbell.net>
    Signed-off-by: Len Brown <len.brown@intel.com>

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-25 16:38 [GIT PATCH] ACPI patches for 2.6.23-rc1 Len Brown
@ 2007-07-25 18:48 ` Linus Torvalds
  2007-07-25 22:51   ` Len Brown
  2007-07-27  6:26 ` Jan Dittmer
  1 sibling, 1 reply; 75+ messages in thread
From: Linus Torvalds @ 2007-07-25 18:48 UTC (permalink / raw)
  To: Len Brown; +Cc: Andrew Morton, linux-acpi, linux-kernel



On Wed, 25 Jul 2007, Len Brown wrote:
> 
> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-25 18:48 ` Linus Torvalds
@ 2007-07-25 22:51   ` Len Brown
  2007-07-26  2:20     ` david
  2007-07-26  7:02     ` [GIT PATCH] ACPI patches for 2.6.23-rc1 Linus Torvalds
  0 siblings, 2 replies; 75+ messages in thread
From: Len Brown @ 2007-07-25 22:51 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, linux-acpi, linux-kernel

On Wednesday 25 July 2007 14:48, Linus Torvalds wrote:

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

> 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


^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-25 22:51   ` Len Brown
@ 2007-07-26  2:20     ` david
  2007-07-26  4:26       ` Len Brown
  2007-07-26  7:02     ` [GIT PATCH] ACPI patches for 2.6.23-rc1 Linus Torvalds
  1 sibling, 1 reply; 75+ messages in thread
From: david @ 2007-07-26  2:20 UTC (permalink / raw)
  To: Len Brown; +Cc: Linus Torvalds, Andrew Morton, linux-acpi, linux-kernel

On Wed, 25 Jul 2007, Len Brown wrote:

> On Wednesday 25 July 2007 14:48, Linus Torvalds wrote:
>
>> ... 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
>
>> 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.

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

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

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

> 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
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-26  2:20     ` david
@ 2007-07-26  4:26       ` Len Brown
  2007-07-26  5:00         ` david
                           ` (2 more replies)
  0 siblings, 3 replies; 75+ messages in thread
From: Len Brown @ 2007-07-26  4:26 UTC (permalink / raw)
  To: david; +Cc: Linus Torvalds, Andrew Morton, linux-acpi, linux-kernel

On Wednesday 25 July 2007 22:20, david@lang.hm wrote:
> On Wed, 25 Jul 2007, Len Brown wrote:
> 
> > On Wednesday 25 July 2007 14:48, Linus Torvalds wrote:
> >
> >> ... 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
> >
> >> 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.
> 
> 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.

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

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

> > 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
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-26  4:26       ` Len Brown
@ 2007-07-26  5:00         ` david
  2007-07-26  6:55         ` Linus Torvalds
  2007-07-26 10:07         ` [GIT PATCH] ACPI patches for 2.6.23-rc1 Gabriel C
  2 siblings, 0 replies; 75+ messages in thread
From: david @ 2007-07-26  5:00 UTC (permalink / raw)
  To: Len Brown; +Cc: Linus Torvalds, Andrew Morton, linux-acpi, linux-kernel

On Thu, 26 Jul 2007, Len Brown wrote:

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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-26  4:26       ` Len Brown
  2007-07-26  5:00         ` david
@ 2007-07-26  6:55         ` Linus Torvalds
  2007-07-26 17:45           ` Len Brown
  2007-07-26 10:07         ` [GIT PATCH] ACPI patches for 2.6.23-rc1 Gabriel C
  2 siblings, 1 reply; 75+ messages in thread
From: Linus Torvalds @ 2007-07-26  6:55 UTC (permalink / raw)
  To: Len Brown; +Cc: david, Andrew Morton, linux-acpi, linux-kernel



On Thu, 26 Jul 2007, Len Brown wrote:
> 
> 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?

> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-25 22:51   ` Len Brown
  2007-07-26  2:20     ` david
@ 2007-07-26  7:02     ` Linus Torvalds
  1 sibling, 0 replies; 75+ messages in thread
From: Linus Torvalds @ 2007-07-26  7:02 UTC (permalink / raw)
  To: Len Brown; +Cc: Andrew Morton, linux-acpi, linux-kernel



On Wed, 25 Jul 2007, Len Brown wrote:
> On Wednesday 25 July 2007 14:48, Linus Torvalds wrote:
> 
> > ... 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.

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

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

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

> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-26  4:26       ` Len Brown
  2007-07-26  5:00         ` david
  2007-07-26  6:55         ` Linus Torvalds
@ 2007-07-26 10:07         ` Gabriel C
  2007-07-26 18:05           ` Len Brown
  2 siblings, 1 reply; 75+ messages in thread
From: Gabriel C @ 2007-07-26 10:07 UTC (permalink / raw)
  To: Len Brown; +Cc: david, Linus Torvalds, Andrew Morton, linux-acpi, linux-kernel

Len Brown wrote:
> On Wednesday 25 July 2007 22:20, david@lang.hm wrote:
>> On Wed, 25 Jul 2007, Len Brown wrote:
>>
>>> On Wednesday 25 July 2007 14:48, Linus Torvalds wrote:
>>>
>>>> ... 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*.

>>> Note that ACPI=y SMP=n systems do not need it,
>>> and thus will not select HOTPLUG_CPU=y
>>>
>>>> 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.
>> 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.
> 
>> 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.

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 ?

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

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.

> 
> thanks.
> -Len
> 


Gabriel


^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-26  6:55         ` Linus Torvalds
@ 2007-07-26 17:45           ` Len Brown
  2007-07-26 18:01             ` Linus Torvalds
                               ` (2 more replies)
  0 siblings, 3 replies; 75+ messages in thread
From: Len Brown @ 2007-07-26 17:45 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: david, Andrew Morton, linux-acpi, linux-kernel

On Thursday 26 July 2007 02:55, Linus Torvalds wrote:
> 
> On Thu, 26 Jul 2007, Len Brown wrote:
> > 
> > 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.

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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-26 17:45           ` Len Brown
@ 2007-07-26 18:01             ` Linus Torvalds
  2007-07-26 18:02             ` david
  2007-07-26 19:17             ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Rafael J. Wysocki
  2 siblings, 0 replies; 75+ messages in thread
From: Linus Torvalds @ 2007-07-26 18:01 UTC (permalink / raw)
  To: Len Brown; +Cc: david, Andrew Morton, linux-acpi, linux-kernel



On Thu, 26 Jul 2007, Len Brown wrote:
> 
> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-26 17:45           ` Len Brown
  2007-07-26 18:01             ` Linus Torvalds
@ 2007-07-26 18:02             ` david
  2007-07-26 18:16               ` Linus Torvalds
  2007-07-26 18:18               ` Len Brown
  2007-07-26 19:17             ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Rafael J. Wysocki
  2 siblings, 2 replies; 75+ messages in thread
From: david @ 2007-07-26 18:02 UTC (permalink / raw)
  To: Len Brown; +Cc: Linus Torvalds, Andrew Morton, linux-acpi, linux-kernel

On Thu, 26 Jul 2007, Len Brown wrote:

> 
> On Thursday 26 July 2007 02:55, Linus Torvalds wrote:
>>
>> On Thu, 26 Jul 2007, Len Brown wrote:
>
>>> 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.

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

> 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

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

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

> 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

> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-26 10:07         ` [GIT PATCH] ACPI patches for 2.6.23-rc1 Gabriel C
@ 2007-07-26 18:05           ` Len Brown
  2007-07-26 18:18             ` Linus Torvalds
                               ` (2 more replies)
  0 siblings, 3 replies; 75+ messages in thread
From: Len Brown @ 2007-07-26 18:05 UTC (permalink / raw)
  To: Gabriel C; +Cc: david, Linus Torvalds, Andrew Morton, linux-acpi, linux-kernel

On Thursday 26 July 2007 06:07, Gabriel C wrote:

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

> 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

> >> 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":-)
> 
> 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?

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

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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-26 18:02             ` david
@ 2007-07-26 18:16               ` Linus Torvalds
  2007-07-26 18:27                 ` Jeff Garzik
  2007-07-26 18:18               ` Len Brown
  1 sibling, 1 reply; 75+ messages in thread
From: Linus Torvalds @ 2007-07-26 18:16 UTC (permalink / raw)
  To: david; +Cc: Len Brown, Andrew Morton, linux-acpi, Linux Kernel Mailing List



On Thu, 26 Jul 2007, david@lang.hm 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-26 18:02             ` david
  2007-07-26 18:16               ` Linus Torvalds
@ 2007-07-26 18:18               ` Len Brown
  1 sibling, 0 replies; 75+ messages in thread
From: Len Brown @ 2007-07-26 18:18 UTC (permalink / raw)
  To: david; +Cc: Linus Torvalds, Andrew Morton, linux-acpi, linux-kernel


> > 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?


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

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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-26 18:05           ` Len Brown
@ 2007-07-26 18:18             ` Linus Torvalds
  2007-07-26 18:38             ` Gabriel C
  2007-07-26 18:53             ` defconfig , ACPI=n compile error Gabriel C
  2 siblings, 0 replies; 75+ messages in thread
From: Linus Torvalds @ 2007-07-26 18:18 UTC (permalink / raw)
  To: Len Brown; +Cc: Gabriel C, david, Andrew Morton, linux-acpi, linux-kernel



On Thu, 26 Jul 2007, Len Brown wrote:
> 
> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-26 18:16               ` Linus Torvalds
@ 2007-07-26 18:27                 ` Jeff Garzik
  0 siblings, 0 replies; 75+ messages in thread
From: Jeff Garzik @ 2007-07-26 18:27 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: david, Len Brown, Andrew Morton, linux-acpi, Linux Kernel Mailing List

Linus Torvalds wrote:
> 
> On Thu, 26 Jul 2007, david@lang.hm 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





^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-26 18:05           ` Len Brown
  2007-07-26 18:18             ` Linus Torvalds
@ 2007-07-26 18:38             ` Gabriel C
  2007-07-26 18:53             ` defconfig , ACPI=n compile error Gabriel C
  2 siblings, 0 replies; 75+ messages in thread
From: Gabriel C @ 2007-07-26 18:38 UTC (permalink / raw)
  To: Len Brown; +Cc: david, Linus Torvalds, Andrew Morton, linux-acpi, linux-kernel

Len Brown wrote:
> On Thursday 26 July 2007 06:07, Gabriel C wrote:
> 
>>> 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.

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.

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

> 
>>>> 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":-)
>> 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?
> 
>> 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.
> 
> 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.

> 
> -Len
> 


Gabriel

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: defconfig , ACPI=n  compile error
  2007-07-26 18:05           ` Len Brown
  2007-07-26 18:18             ` Linus Torvalds
  2007-07-26 18:38             ` Gabriel C
@ 2007-07-26 18:53             ` Gabriel C
  2 siblings, 0 replies; 75+ messages in thread
From: Gabriel C @ 2007-07-26 18:53 UTC (permalink / raw)
  To: Len Brown; +Cc: david, Linus Torvalds, Andrew Morton, linux-acpi, linux-kernel

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


> 
> -Len
> 


Gabriel

^ permalink raw reply	[flat|nested] 75+ messages in thread

* CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)
  2007-07-26 17:45           ` Len Brown
  2007-07-26 18:01             ` Linus Torvalds
  2007-07-26 18:02             ` david
@ 2007-07-26 19:17             ` Rafael J. Wysocki
  2007-07-26 19:57               ` Linus Torvalds
  2 siblings, 1 reply; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-26 19:17 UTC (permalink / raw)
  To: Len Brown
  Cc: Linus Torvalds, david, Andrew Morton, linux-acpi, linux-kernel,
	Pavel Machek

On Thursday, 26 July 2007 19:45, Len Brown wrote:
> On Thursday 26 July 2007 02:55, Linus Torvalds wrote:
> > 
> > On Thu, 26 Jul 2007, Len Brown wrote:
> > > 
> > > 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


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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)
  2007-07-26 19:17             ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Rafael J. Wysocki
@ 2007-07-26 19:57               ` Linus Torvalds
  2007-07-26 20:48                 ` Rafael J. Wysocki
  0 siblings, 1 reply; 75+ messages in thread
From: Linus Torvalds @ 2007-07-26 19:57 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, david, Andrew Morton, linux-acpi, linux-kernel, Pavel Machek



On Thu, 26 Jul 2007, Rafael J. Wysocki wrote:
> 
> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)
  2007-07-26 19:57               ` Linus Torvalds
@ 2007-07-26 20:48                 ` Rafael J. Wysocki
  2007-07-26 20:55                   ` Linus Torvalds
  0 siblings, 1 reply; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-26 20:48 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Len Brown, david, Andrew Morton, linux-acpi, linux-kernel, Pavel Machek

On Thursday, 26 July 2007 21:57, Linus Torvalds wrote:
> 
> On Thu, 26 Jul 2007, Rafael J. Wysocki wrote:
> > 
> > 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.

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

> (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


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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)
  2007-07-26 20:48                 ` Rafael J. Wysocki
@ 2007-07-26 20:55                   ` Linus Torvalds
  2007-07-27 22:25                     ` [2.6 patch] let SUSPEND select HOTPLUG_CPU Adrian Bunk
  2007-07-28  7:30                     ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Len Brown
  0 siblings, 2 replies; 75+ messages in thread
From: Linus Torvalds @ 2007-07-26 20:55 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, david, Andrew Morton, linux-acpi, linux-kernel, Pavel Machek



On Thu, 26 Jul 2007, Rafael J. Wysocki wrote:
> 
> 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.
    
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 drivers/acpi/Kconfig |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 251344c..22b401b 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -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 

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-25 16:38 [GIT PATCH] ACPI patches for 2.6.23-rc1 Len Brown
  2007-07-25 18:48 ` Linus Torvalds
@ 2007-07-27  6:26 ` Jan Dittmer
  2007-07-27 16:25   ` Thomas Renninger
  2007-07-27 23:50   ` Andreas Schwab
  1 sibling, 2 replies; 75+ messages in thread
From: Jan Dittmer @ 2007-07-27  6:26 UTC (permalink / raw)
  To: Len Brown; +Cc: Linus Torvalds, Andrew Morton, linux-acpi, linux-kernel

Len Brown wrote:
> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-27  6:26 ` Jan Dittmer
@ 2007-07-27 16:25   ` Thomas Renninger
  2007-07-27 23:50   ` Andreas Schwab
  1 sibling, 0 replies; 75+ messages in thread
From: Thomas Renninger @ 2007-07-27 16:25 UTC (permalink / raw)
  To: Jan Dittmer
  Cc: Len Brown, Linus Torvalds, Andrew Morton, linux-acpi,
	linux-kernel, trenn

On Fri, 2007-07-27 at 08:26 +0200, Jan Dittmer wrote:
> Len Brown wrote:
> > 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

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


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [2.6 patch] let SUSPEND select HOTPLUG_CPU
  2007-07-26 20:55                   ` Linus Torvalds
@ 2007-07-27 22:25                     ` Adrian Bunk
  2007-07-27 22:47                       ` Stefan Richter
                                         ` (2 more replies)
  2007-07-28  7:30                     ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Len Brown
  1 sibling, 3 replies; 75+ messages in thread
From: Adrian Bunk @ 2007-07-27 22:25 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Rafael J. Wysocki, Len Brown, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek

On Thu, Jul 26, 2007 at 01:55:18PM -0700, Linus Torvalds wrote:
> 
> 
> On Thu, 26 Jul 2007, Rafael J. Wysocki wrote:
> > 
> > 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.
>     
>     Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> ---
>  drivers/acpi/Kconfig |    3 ---
>  1 files changed, 0 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index 251344c..22b401b 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -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.

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

---

 kernel/power/Kconfig |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -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


^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU
  2007-07-27 22:25                     ` [2.6 patch] let SUSPEND select HOTPLUG_CPU Adrian Bunk
@ 2007-07-27 22:47                       ` Stefan Richter
  2007-07-27 23:03                         ` Adrian Bunk
  2007-07-28 14:44                         ` Sergio Monteiro Basto
  2007-07-27 22:57                       ` Linus Torvalds
  2007-07-28 18:30                       ` [2.6 patch] let SUSPEND select HOTPLUG_CPU Rafael J. Wysocki
  2 siblings, 2 replies; 75+ messages in thread
From: Stefan Richter @ 2007-07-27 22:47 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: Linus Torvalds, Rafael J. Wysocki, Len Brown, david,
	Andrew Morton, linux-acpi, linux-kernel, Pavel Machek

Adrian Bunk wrote:
> 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.

> +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?
-- 
Stefan Richter
-=====-=-=== -=== ===--
http://arcgraph.de/sr/

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU
  2007-07-27 22:25                     ` [2.6 patch] let SUSPEND select HOTPLUG_CPU Adrian Bunk
  2007-07-27 22:47                       ` Stefan Richter
@ 2007-07-27 22:57                       ` Linus Torvalds
  2007-07-28  4:52                         ` [2.6 patch] SOFTWARE_SUSPEND: handle HOTPLUG_CPU automatically Adrian Bunk
  2007-07-28 18:30                       ` [2.6 patch] let SUSPEND select HOTPLUG_CPU Rafael J. Wysocki
  2 siblings, 1 reply; 75+ messages in thread
From: Linus Torvalds @ 2007-07-27 22:57 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: Rafael J. Wysocki, Len Brown, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek



On Sat, 28 Jul 2007, Adrian Bunk wrote:
> 
> 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:

> +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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU
  2007-07-27 22:47                       ` Stefan Richter
@ 2007-07-27 23:03                         ` Adrian Bunk
  2007-07-28  8:42                           ` Stefan Richter
  2007-07-30 21:18                           ` Pavel Machek
  2007-07-28 14:44                         ` Sergio Monteiro Basto
  1 sibling, 2 replies; 75+ messages in thread
From: Adrian Bunk @ 2007-07-27 23:03 UTC (permalink / raw)
  To: Stefan Richter
  Cc: Linus Torvalds, Rafael J. Wysocki, Len Brown, david,
	Andrew Morton, linux-acpi, linux-kernel, Pavel Machek

On Sat, Jul 28, 2007 at 12:47:37AM +0200, Stefan Richter wrote:
> Adrian Bunk wrote:
> > 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.

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

Yes, but a good user interface is worth it.

> 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?

> Stefan Richter

cu
Adrian

-- 

       "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


^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-27  6:26 ` Jan Dittmer
  2007-07-27 16:25   ` Thomas Renninger
@ 2007-07-27 23:50   ` Andreas Schwab
  2007-07-28  7:58     ` Jan Dittmer
  1 sibling, 1 reply; 75+ messages in thread
From: Andreas Schwab @ 2007-07-27 23:50 UTC (permalink / raw)
  To: Jan Dittmer
  Cc: Len Brown, Linus Torvalds, Andrew Morton, linux-acpi,
	linux-kernel, Thomas Renninger

Jan Dittmer <jdi@l4x.org> writes:

> Len Brown wrote:
>> 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.

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

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
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."

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [2.6 patch] SOFTWARE_SUSPEND: handle HOTPLUG_CPU automatically
  2007-07-27 22:57                       ` Linus Torvalds
@ 2007-07-28  4:52                         ` Adrian Bunk
  2007-07-28  9:07                           ` Stefan Richter
  0 siblings, 1 reply; 75+ messages in thread
From: Adrian Bunk @ 2007-07-28  4:52 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Rafael J. Wysocki, Len Brown, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek, Stefan Richter

On Fri, Jul 27, 2007 at 03:57:39PM -0700, Linus Torvalds wrote:
> 
> 
> On Sat, 28 Jul 2007, Adrian Bunk wrote:
> > 
> > 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:
> 
> > +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 

Sounds good.

> 	# 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

> 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

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

>   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?

Patch below.

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

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

---

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

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

    asdf

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


^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)
  2007-07-26 20:55                   ` Linus Torvalds
  2007-07-27 22:25                     ` [2.6 patch] let SUSPEND select HOTPLUG_CPU Adrian Bunk
@ 2007-07-28  7:30                     ` Len Brown
  2007-07-28  7:33                       ` [PATCH] ACPI: restore CONFIG_ACPI_SLEEP Len Brown
  2007-07-28 16:25                       ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Linus Torvalds
  1 sibling, 2 replies; 75+ messages in thread
From: Len Brown @ 2007-07-28  7:30 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Rafael J. Wysocki, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek

On Thursday 26 July 2007 16:55, Linus Torvalds wrote:

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

> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH] ACPI: restore CONFIG_ACPI_SLEEP
  2007-07-28  7:30                     ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Len Brown
@ 2007-07-28  7:33                       ` Len Brown
  2007-07-28 16:25                       ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Linus Torvalds
  1 sibling, 0 replies; 75+ messages in thread
From: Len Brown @ 2007-07-28  7:33 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Rafael J. Wysocki, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek

From: Len Brown <len.brown@intel.com>

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.

Signed-off-by: Len Brown <len.brown@intel.com>
---
 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(-)


diff --git a/arch/i386/kernel/acpi/Makefile b/arch/i386/kernel/acpi/Makefile
index 223f58f..7f7be01 100644
--- a/arch/i386/kernel/acpi/Makefile
+++ b/arch/i386/kernel/acpi/Makefile
@@ -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
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 7fe5da3..d474cd6 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -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.
 	 */
diff --git a/arch/x86_64/kernel/acpi/Makefile b/arch/x86_64/kernel/acpi/Makefile
index 17595d2..080b996 100644
--- a/arch/x86_64/kernel/acpi/Makefile
+++ b/arch/x86_64/kernel/acpi/Makefile
@@ -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
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S
index 3a16e41..e89abcd 100644
--- a/arch/x86_64/kernel/head.S
+++ b/arch/x86_64/kernel/head.S
@@ -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
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 0f400f3..af838f6 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -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.
         */
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 22b401b..f38db44 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -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
diff --git a/drivers/acpi/sleep/Makefile b/drivers/acpi/sleep/Makefile
index 01a993a..195a4f6 100644
--- a/drivers/acpi/sleep/Makefile
+++ b/drivers/acpi/sleep/Makefile
@@ -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)
diff --git a/drivers/acpi/sleep/poweroff.c b/drivers/acpi/sleep/poweroff.c
index b3f68ef..39e40d5 100644
--- a/drivers/acpi/sleep/poweroff.c
+++ b/drivers/acpi/sleep/poweroff.c
@@ -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;
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c
index ed58e11..25b87ad 100644
--- a/drivers/acpi/sleep/proc.c
+++ b/drivers/acpi/sleep/proc.c
@@ -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
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 67c63d1..5c6a5d0 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -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;
 }
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 6a2a3c2..616fc72 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -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)
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index f85f77a..202acb9 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -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__*/
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index eb26f2b..79c891e 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -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",

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-27 23:50   ` Andreas Schwab
@ 2007-07-28  7:58     ` Jan Dittmer
  2007-08-01  1:34       ` Yasha Okshtein
  0 siblings, 1 reply; 75+ messages in thread
From: Jan Dittmer @ 2007-07-28  7:58 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Len Brown, Linus Torvalds, Andrew Morton, linux-acpi,
	linux-kernel, Thomas Renninger

Andreas Schwab wrote:
> Jan Dittmer <jdi@l4x.org> writes:
> 
>> Len Brown wrote:
>>> 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.
> 
> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU
  2007-07-27 23:03                         ` Adrian Bunk
@ 2007-07-28  8:42                           ` Stefan Richter
  2007-07-30 21:18                           ` Pavel Machek
  1 sibling, 0 replies; 75+ messages in thread
From: Stefan Richter @ 2007-07-28  8:42 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: Linus Torvalds, Rafael J. Wysocki, Len Brown, david,
	Andrew Morton, linux-acpi, linux-kernel, Pavel Machek

Adrian Bunk wrote:
> On Sat, Jul 28, 2007 at 12:47:37AM +0200, Stefan Richter wrote:
>> 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.
-- 
Stefan -ENOPATCH Richter
-=====-=-=== -=== ===--
http://arcgraph.de/sr/

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [2.6 patch] SOFTWARE_SUSPEND: handle HOTPLUG_CPU automatically
  2007-07-28  4:52                         ` [2.6 patch] SOFTWARE_SUSPEND: handle HOTPLUG_CPU automatically Adrian Bunk
@ 2007-07-28  9:07                           ` Stefan Richter
  0 siblings, 0 replies; 75+ messages in thread
From: Stefan Richter @ 2007-07-28  9:07 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: Linus Torvalds, Rafael J. Wysocki, Len Brown, david,
	Andrew Morton, linux-acpi, linux-kernel, Pavel Machek

Adrian Bunk wrote:
> On Fri, Jul 27, 2007 at 03:57:39PM -0700, Linus Torvalds wrote:
>> [ 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,
...
> 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.
-- 
Stefan Richter
-=====-=-=== -=== ===--
http://arcgraph.de/sr/

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU
  2007-07-27 22:47                       ` Stefan Richter
  2007-07-27 23:03                         ` Adrian Bunk
@ 2007-07-28 14:44                         ` Sergio Monteiro Basto
  1 sibling, 0 replies; 75+ messages in thread
From: Sergio Monteiro Basto @ 2007-07-28 14:44 UTC (permalink / raw)
  To: Stefan Richter
  Cc: Adrian Bunk, Linus Torvalds, Rafael J. Wysocki, Len Brown, david,
	Andrew Morton, linux-acpi, linux-kernel, Pavel Machek

[-- Attachment #1: Type: text/plain, Size: 989 bytes --]

On Sat, 2007-07-28 at 00:47 +0200, Stefan Richter wrote:
> Adrian Bunk wrote:
> > 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,
-- 
Sérgio M. B.

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 2192 bytes --]

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)
  2007-07-28  7:30                     ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Len Brown
  2007-07-28  7:33                       ` [PATCH] ACPI: restore CONFIG_ACPI_SLEEP Len Brown
@ 2007-07-28 16:25                       ` Linus Torvalds
  2007-07-28 16:55                         ` Linus Torvalds
  1 sibling, 1 reply; 75+ messages in thread
From: Linus Torvalds @ 2007-07-28 16:25 UTC (permalink / raw)
  To: Len Brown
  Cc: Rafael J. Wysocki, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek



On Sat, 28 Jul 2007, Len Brown wrote:
> 
> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)
  2007-07-28 16:25                       ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Linus Torvalds
@ 2007-07-28 16:55                         ` Linus Torvalds
  2007-07-28 18:29                           ` Rafael J. Wysocki
  2007-07-31  3:53                           ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Len Brown
  0 siblings, 2 replies; 75+ messages in thread
From: Linus Torvalds @ 2007-07-28 16:55 UTC (permalink / raw)
  To: Len Brown
  Cc: Rafael J. Wysocki, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek



On Sat, 28 Jul 2007, Linus Torvalds wrote:
> 
> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)
  2007-07-28 16:55                         ` Linus Torvalds
@ 2007-07-28 18:29                           ` Rafael J. Wysocki
  2007-07-28 18:31                             ` Linus Torvalds
  2007-07-31  3:53                           ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Len Brown
  1 sibling, 1 reply; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-28 18:29 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Len Brown, david, Andrew Morton, linux-acpi, linux-kernel, Pavel Machek

On Saturday, 28 July 2007 18:55, Linus Torvalds wrote:
> 
> On Sat, 28 Jul 2007, Linus Torvalds wrote:
> > 
> > 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!

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


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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU
  2007-07-27 22:25                     ` [2.6 patch] let SUSPEND select HOTPLUG_CPU Adrian Bunk
  2007-07-27 22:47                       ` Stefan Richter
  2007-07-27 22:57                       ` Linus Torvalds
@ 2007-07-28 18:30                       ` Rafael J. Wysocki
  2 siblings, 0 replies; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-28 18:30 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: Linus Torvalds, Len Brown, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek

On Saturday, 28 July 2007 00:25, Adrian Bunk wrote:
> On Thu, Jul 26, 2007 at 01:55:18PM -0700, Linus Torvalds wrote:
> > 
> > 
> > On Thu, 26 Jul 2007, Rafael J. Wysocki wrote:
> > > 
> > > 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.
> >     
> >     Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> > ---
> >  drivers/acpi/Kconfig |    3 ---
> >  1 files changed, 0 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> > index 251344c..22b401b 100644
> > --- a/drivers/acpi/Kconfig
> > +++ b/drivers/acpi/Kconfig
> > @@ -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.
> 
> Signed-off-by: Adrian Bunk <bunk@stusta.de>
> 
> ---
> 
>  kernel/power/Kconfig |   20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> --- a/kernel/power/Kconfig
> +++ b/kernel/power/Kconfig
> @@ -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

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

Greetings,
Rafael


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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)
  2007-07-28 18:29                           ` Rafael J. Wysocki
@ 2007-07-28 18:31                             ` Linus Torvalds
  2007-07-29 10:20                               ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (was: CONFIG_SUSPEND?) Rafael J. Wysocki
  0 siblings, 1 reply; 75+ messages in thread
From: Linus Torvalds @ 2007-07-28 18:31 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, david, Andrew Morton, linux-acpi, linux-kernel, Pavel Machek



On Sat, 28 Jul 2007, Rafael J. Wysocki wrote:
> 
> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (was: CONFIG_SUSPEND?)
  2007-07-28 18:31                             ` Linus Torvalds
@ 2007-07-29 10:20                               ` Rafael J. Wysocki
  2007-07-29 10:21                                 ` [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION Rafael J. Wysocki
                                                   ` (2 more replies)
  0 siblings, 3 replies; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 10:20 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Len Brown, david, Andrew Morton, linux-acpi, linux-kernel,
	Pavel Machek, Adrian Bunk, Stefan Richter, Nigel Cunningham,
	pm list

On Saturday, 28 July 2007 20:31, Linus Torvalds wrote:
> 
> On Sat, 28 Jul 2007, Rafael J. Wysocki wrote:
> > 
> > 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


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION
  2007-07-29 10:20                               ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (was: CONFIG_SUSPEND?) Rafael J. Wysocki
@ 2007-07-29 10:21                                 ` Rafael J. Wysocki
  2007-07-29 12:38                                 ` [PATCH 2/2] Introduce CONFIG_SUSPEND Rafael J. Wysocki
  2007-07-29 21:23                                 ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated) Rafael J. Wysocki
  2 siblings, 0 replies; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 10:21 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Len Brown, david, Andrew Morton, linux-acpi, linux-kernel,
	Pavel Machek, Adrian Bunk, Stefan Richter, Nigel Cunningham,
	pm list

From: Rafael J. Wysocki <rjw@sisk.pl>

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

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 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(-)

Index: linux-2.6.23-rc1/arch/i386/Kconfig.debug
===================================================================
--- linux-2.6.23-rc1.orig/arch/i386/Kconfig.debug	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/i386/Kconfig.debug	2007-07-28 20:57:00.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/arch/i386/kernel/e820.c
===================================================================
--- linux-2.6.23-rc1.orig/arch/i386/kernel/e820.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/i386/kernel/e820.c	2007-07-28 20:57:00.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/arch/i386/mm/init.c
===================================================================
--- linux-2.6.23-rc1.orig/arch/i386/mm/init.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/i386/mm/init.c	2007-07-28 20:57:00.000000000 +0200
@@ -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.
Index: linux-2.6.23-rc1/arch/i386/power/Makefile
===================================================================
--- linux-2.6.23-rc1.orig/arch/i386/power/Makefile	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/i386/power/Makefile	2007-07-28 20:57:00.000000000 +0200
@@ -1,2 +1,2 @@
 obj-$(CONFIG_PM)		+= cpu.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o suspend.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o
Index: linux-2.6.23-rc1/arch/powerpc/Kconfig.debug
===================================================================
--- linux-2.6.23-rc1.orig/arch/powerpc/Kconfig.debug	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/powerpc/Kconfig.debug	2007-07-28 20:57:00.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/arch/powerpc/configs/lite5200_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/powerpc/configs/lite5200_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/powerpc/configs/lite5200_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/arch/powerpc/configs/pmac32_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/powerpc/configs/pmac32_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/powerpc/configs/pmac32_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/arch/powerpc/kernel/Makefile
===================================================================
--- linux-2.6.23-rc1.orig/arch/powerpc/kernel/Makefile	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/powerpc/kernel/Makefile	2007-07-28 20:57:00.000000000 +0200
@@ -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)
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8540_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/TQM8540_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/TQM8540_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -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
 
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8541_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/TQM8541_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/TQM8541_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -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
 
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8555_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/TQM8555_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/TQM8555_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -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
 
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8560_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/TQM8560_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/TQM8560_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -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
 
Index: linux-2.6.23-rc1/arch/ppc/configs/ev64360_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/ev64360_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/ev64360_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -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
 
Index: linux-2.6.23-rc1/arch/ppc/configs/ml300_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/ml300_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/ml300_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -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
 
Index: linux-2.6.23-rc1/arch/ppc/configs/ml403_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/ml403_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/ml403_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -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
 
Index: linux-2.6.23-rc1/arch/ppc/configs/mpc834x_sys_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/mpc834x_sys_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/mpc834x_sys_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -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
 
Index: linux-2.6.23-rc1/arch/ppc/configs/prep_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/prep_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/prep_defconfig	2007-07-28 20:57:01.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/arch/sparc64/Kconfig.debug
===================================================================
--- linux-2.6.23-rc1.orig/arch/sparc64/Kconfig.debug	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/sparc64/Kconfig.debug	2007-07-28 20:57:01.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/arch/x86_64/defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/x86_64/defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/x86_64/defconfig	2007-07-28 20:57:01.000000000 +0200
@@ -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
 
Index: linux-2.6.23-rc1/arch/x86_64/kernel/Makefile
===================================================================
--- linux-2.6.23-rc1.orig/arch/x86_64/kernel/Makefile	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/x86_64/kernel/Makefile	2007-07-28 20:57:01.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/arch/x86_64/kernel/suspend.c
===================================================================
--- linux-2.6.23-rc1.orig/arch/x86_64/kernel/suspend.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/x86_64/kernel/suspend.c	2007-07-28 20:57:01.000000000 +0200
@@ -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 */
Index: linux-2.6.23-rc1/drivers/acpi/sleep/main.c
===================================================================
--- linux-2.6.23-rc1.orig/drivers/acpi/sleep/main.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/drivers/acpi/sleep/main.c	2007-07-28 20:57:01.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/drivers/acpi/sleep/proc.c
===================================================================
--- linux-2.6.23-rc1.orig/drivers/acpi/sleep/proc.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/drivers/acpi/sleep/proc.c	2007-07-28 20:57:01.000000000 +0200
@@ -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;
Index: linux-2.6.23-rc1/drivers/i2c/chips/tps65010.c
===================================================================
--- linux-2.6.23-rc1.orig/drivers/i2c/chips/tps65010.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/drivers/i2c/chips/tps65010.c	2007-07-28 20:57:01.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/include/asm-i386/e820.h
===================================================================
--- linux-2.6.23-rc1.orig/include/asm-i386/e820.h	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/include/asm-i386/e820.h	2007-07-28 20:57:01.000000000 +0200
@@ -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)
Index: linux-2.6.23-rc1/include/linux/suspend.h
===================================================================
--- linux-2.6.23-rc1.orig/include/linux/suspend.h	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/include/linux/suspend.h	2007-07-28 20:57:01.000000000 +0200
@@ -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)
 {
 }
Index: linux-2.6.23-rc1/kernel/power/Kconfig
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/Kconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/Kconfig	2007-07-28 21:04:06.000000000 +0200
@@ -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-
Index: linux-2.6.23-rc1/kernel/power/Makefile
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/Makefile	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/Makefile	2007-07-28 20:57:01.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/kernel/power/main.c
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/main.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/main.c	2007-07-28 20:57:01.000000000 +0200
@@ -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)
Index: linux-2.6.23-rc1/kernel/power/power.h
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/power.h	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/power.h	2007-07-28 20:57:01.000000000 +0200
@@ -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?]
Index: linux-2.6.23-rc1/kernel/sys.c
===================================================================
--- linux-2.6.23-rc1.orig/kernel/sys.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/kernel/sys.c	2007-07-28 20:57:01.000000000 +0200
@@ -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();
Index: linux-2.6.23-rc1/mm/Kconfig
===================================================================
--- linux-2.6.23-rc1.orig/mm/Kconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/mm/Kconfig	2007-07-28 20:57:01.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/mm/swapfile.c
===================================================================
--- linux-2.6.23-rc1.orig/mm/swapfile.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/mm/swapfile.c	2007-07-28 20:57:01.000000000 +0200
@@ -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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 2/2] Introduce CONFIG_SUSPEND
  2007-07-29 10:20                               ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (was: CONFIG_SUSPEND?) Rafael J. Wysocki
  2007-07-29 10:21                                 ` [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION Rafael J. Wysocki
@ 2007-07-29 12:38                                 ` Rafael J. Wysocki
  2007-07-29 20:40                                   ` Adrian Bunk
  2007-07-29 21:23                                 ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated) Rafael J. Wysocki
  2 siblings, 1 reply; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 12:38 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Len Brown, david, Andrew Morton, linux-acpi, linux-kernel,
	Pavel Machek, Adrian Bunk, Stefan Richter, Nigel Cunningham,
	pm list

From: Rafael J. Wysocki <rjw@sisk.pl>

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.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 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(-)

Index: linux-2.6.23-rc1/kernel/power/Kconfig
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/Kconfig	2007-07-29 11:05:14.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/Kconfig	2007-07-29 11:18:49.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/kernel/power/Makefile
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/Makefile	2007-07-29 11:05:14.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/Makefile	2007-07-29 12:53:13.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/drivers/base/power/Makefile
===================================================================
--- linux-2.6.23-rc1.orig/drivers/base/power/Makefile	2007-07-29 11:05:14.000000000 +0200
+++ linux-2.6.23-rc1/drivers/base/power/Makefile	2007-07-29 11:06:27.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/include/linux/suspend.h
===================================================================
--- linux-2.6.23-rc1.orig/include/linux/suspend.h	2007-07-29 11:05:14.000000000 +0200
+++ linux-2.6.23-rc1/include/linux/suspend.h	2007-07-29 12:46:45.000000000 +0200
@@ -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)
 {
 }
Index: linux-2.6.23-rc1/include/linux/pm.h
===================================================================
--- linux-2.6.23-rc1.orig/include/linux/pm.h	2007-07-29 11:05:14.000000000 +0200
+++ linux-2.6.23-rc1/include/linux/pm.h	2007-07-29 11:06:27.000000000 +0200
@@ -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.
Index: linux-2.6.23-rc1/kernel/power/power.h
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/power.h	2007-07-29 11:05:14.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/power.h	2007-07-29 11:06:27.000000000 +0200
@@ -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)
Index: linux-2.6.23-rc1/kernel/power/main.c
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/main.c	2007-07-29 11:05:14.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/main.c	2007-07-29 11:11:42.000000000 +0200
@@ -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;
 }
 
Index: linux-2.6.23-rc1/drivers/acpi/Kconfig
===================================================================
--- linux-2.6.23-rc1.orig/drivers/acpi/Kconfig	2007-07-28 22:42:57.000000000 +0200
+++ linux-2.6.23-rc1/drivers/acpi/Kconfig	2007-07-29 12:48:49.000000000 +0200
@@ -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. 
Index: linux-2.6.23-rc1/mm/page_alloc.c
===================================================================
--- linux-2.6.23-rc1.orig/mm/page_alloc.c	2007-07-23 22:07:02.000000000 +0200
+++ linux-2.6.23-rc1/mm/page_alloc.c	2007-07-29 12:23:44.000000000 +0200
@@ -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
Index: linux-2.6.23-rc1/drivers/base/power/power.h
===================================================================
--- linux-2.6.23-rc1.orig/drivers/base/power/power.h	2007-07-26 13:00:38.000000000 +0200
+++ linux-2.6.23-rc1/drivers/base/power/power.h	2007-07-29 12:26:23.000000000 +0200
@@ -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)
Index: linux-2.6.23-rc1/include/linux/freezer.h
===================================================================
--- linux-2.6.23-rc1.orig/include/linux/freezer.h	2007-07-26 20:51:27.000000000 +0200
+++ linux-2.6.23-rc1/include/linux/freezer.h	2007-07-29 12:38:57.000000000 +0200
@@ -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 */
Index: linux-2.6.23-rc1/include/acpi/acpi_bus.h
===================================================================
--- linux-2.6.23-rc1.orig/include/acpi/acpi_bus.h	2007-07-26 20:51:27.000000000 +0200
+++ linux-2.6.23-rc1/include/acpi/acpi_bus.h	2007-07-29 13:21:09.000000000 +0200
@@ -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 */
 

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
  2007-07-29 12:38                                 ` [PATCH 2/2] Introduce CONFIG_SUSPEND Rafael J. Wysocki
@ 2007-07-29 20:40                                   ` Adrian Bunk
  2007-07-29 21:17                                     ` Rafael J. Wysocki
  0 siblings, 1 reply; 75+ messages in thread
From: Adrian Bunk @ 2007-07-29 20:40 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linus Torvalds, Len Brown, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek, Stefan Richter, Nigel Cunningham,
	pm list

On Sun, Jul 29, 2007 at 02:38:05PM +0200, Rafael J. Wysocki wrote:
>...
> +config SUSPEND
> +	bool "Suspend"
             "Suspend to RAM"
>...
>  config HIBERNATION
>  	bool "Hibernation"
>...         "Hibernation (Suspend to disk)"

cu
Adrian

-- 

       "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


^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
  2007-07-29 20:40                                   ` Adrian Bunk
@ 2007-07-29 21:17                                     ` Rafael J. Wysocki
  2007-07-29 21:18                                       ` Adrian Bunk
  0 siblings, 1 reply; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 21:17 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: Linus Torvalds, Len Brown, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek, Stefan Richter, Nigel Cunningham,
	pm list

On Sunday, 29 July 2007 22:40, Adrian Bunk wrote:
> On Sun, Jul 29, 2007 at 02:38:05PM +0200, Rafael J. Wysocki wrote:
> >...
> > +config SUSPEND
> > +	bool "Suspend"
>              "Suspend to RAM"

Not only.  This also includes "standby".

> >...
> >  config HIBERNATION
> >  	bool "Hibernation"
> >...         "Hibernation (Suspend to disk)"
> 
> cu
> Adrian

Greetings,
Rafael


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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
  2007-07-29 21:17                                     ` Rafael J. Wysocki
@ 2007-07-29 21:18                                       ` Adrian Bunk
  2007-07-29 21:36                                         ` Rafael J. Wysocki
  0 siblings, 1 reply; 75+ messages in thread
From: Adrian Bunk @ 2007-07-29 21:18 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linus Torvalds, Len Brown, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek, Stefan Richter, Nigel Cunningham,
	pm list

On Sun, Jul 29, 2007 at 11:17:20PM +0200, Rafael J. Wysocki wrote:
> On Sunday, 29 July 2007 22:40, Adrian Bunk wrote:
> > On Sun, Jul 29, 2007 at 02:38:05PM +0200, Rafael J. Wysocki wrote:
> > >...
> > > +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.

> > >...
> > >  config HIBERNATION
> > >  	bool "Hibernation"
> > >...         "Hibernation (Suspend to disk)"
> > 
> > cu
> > Adrian
> 
> Greetings,
> Rafael
> 
> 
> -- 
> "Premature optimization is the root of all evil." - Donald Knuth

cu
Adrian

-- 

       "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


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated)
  2007-07-29 10:20                               ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (was: CONFIG_SUSPEND?) Rafael J. Wysocki
  2007-07-29 10:21                                 ` [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION Rafael J. Wysocki
  2007-07-29 12:38                                 ` [PATCH 2/2] Introduce CONFIG_SUSPEND Rafael J. Wysocki
@ 2007-07-29 21:23                                 ` Rafael J. Wysocki
  2007-07-29 21:24                                   ` [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION (updated) Rafael J. Wysocki
                                                     ` (2 more replies)
  2 siblings, 3 replies; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 21:23 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Len Brown, david, Andrew Morton, linux-acpi, linux-kernel,
	Pavel Machek, Adrian Bunk, Stefan Richter, Nigel Cunningham,
	pm list

On Sunday, 29 July 2007 12:20, Rafael J. Wysocki wrote:
> On Saturday, 28 July 2007 20:31, Linus Torvalds wrote:
> > 
> > On Sat, 28 Jul 2007, Rafael J. Wysocki wrote:
> > > 
> > > 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.

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


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION (updated)
  2007-07-29 21:23                                 ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated) Rafael J. Wysocki
@ 2007-07-29 21:24                                   ` Rafael J. Wysocki
  2007-07-29 21:27                                   ` [PATCH 2/2] Introduce CONFIG_SUSPEND (updated) Rafael J. Wysocki
  2007-07-30  0:21                                   ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and " Linus Torvalds
  2 siblings, 0 replies; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 21:24 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Len Brown, david, Andrew Morton, linux-acpi, linux-kernel,
	Pavel Machek, Adrian Bunk, Stefan Richter, Nigel Cunningham,
	pm list

From: Rafael J. Wysocki <rjw@sisk.pl>

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

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 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(-)

Index: linux-2.6/arch/i386/Kconfig.debug
===================================================================
--- linux-2.6.orig/arch/i386/Kconfig.debug	2007-05-10 21:34:50.000000000 +0200
+++ linux-2.6/arch/i386/Kconfig.debug	2007-07-29 18:49:05.000000000 +0200
@@ -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
Index: linux-2.6/arch/i386/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/i386/kernel/e820.c	2007-07-27 21:34:36.000000000 +0200
+++ linux-2.6/arch/i386/kernel/e820.c	2007-07-29 18:49:05.000000000 +0200
@@ -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
Index: linux-2.6/arch/i386/mm/init.c
===================================================================
--- linux-2.6.orig/arch/i386/mm/init.c	2007-07-27 21:34:36.000000000 +0200
+++ linux-2.6/arch/i386/mm/init.c	2007-07-29 18:49:05.000000000 +0200
@@ -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.
Index: linux-2.6/arch/i386/power/Makefile
===================================================================
--- linux-2.6.orig/arch/i386/power/Makefile	2007-05-10 21:34:50.000000000 +0200
+++ linux-2.6/arch/i386/power/Makefile	2007-07-29 18:49:05.000000000 +0200
@@ -1,2 +1,2 @@
 obj-$(CONFIG_PM)		+= cpu.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o suspend.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o
Index: linux-2.6/arch/powerpc/Kconfig.debug
===================================================================
--- linux-2.6.orig/arch/powerpc/Kconfig.debug	2007-07-27 21:34:36.000000000 +0200
+++ linux-2.6/arch/powerpc/Kconfig.debug	2007-07-29 18:49:05.000000000 +0200
@@ -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
Index: linux-2.6/arch/powerpc/configs/lite5200_defconfig
===================================================================
--- linux-2.6.orig/arch/powerpc/configs/lite5200_defconfig	2007-06-27 23:17:46.000000000 +0200
+++ linux-2.6/arch/powerpc/configs/lite5200_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -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
Index: linux-2.6/arch/powerpc/configs/pmac32_defconfig
===================================================================
--- linux-2.6.orig/arch/powerpc/configs/pmac32_defconfig	2007-06-27 23:17:46.000000000 +0200
+++ linux-2.6/arch/powerpc/configs/pmac32_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -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
Index: linux-2.6/arch/powerpc/kernel/Makefile
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/Makefile	2007-07-18 22:37:31.000000000 +0200
+++ linux-2.6/arch/powerpc/kernel/Makefile	2007-07-29 18:49:05.000000000 +0200
@@ -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)
Index: linux-2.6/arch/ppc/configs/TQM8540_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/TQM8540_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/TQM8540_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -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
 
Index: linux-2.6/arch/ppc/configs/TQM8541_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/TQM8541_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/TQM8541_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -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
 
Index: linux-2.6/arch/ppc/configs/TQM8555_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/TQM8555_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/TQM8555_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -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
 
Index: linux-2.6/arch/ppc/configs/TQM8560_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/TQM8560_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/TQM8560_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -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
 
Index: linux-2.6/arch/ppc/configs/ev64360_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/ev64360_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/ev64360_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -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
 
Index: linux-2.6/arch/ppc/configs/ml300_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/ml300_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/ml300_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -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
 
Index: linux-2.6/arch/ppc/configs/ml403_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/ml403_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/ml403_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -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
 
Index: linux-2.6/arch/ppc/configs/mpc834x_sys_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/mpc834x_sys_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/mpc834x_sys_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -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
 
Index: linux-2.6/arch/ppc/configs/prep_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/prep_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/prep_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -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
Index: linux-2.6/arch/sparc64/Kconfig.debug
===================================================================
--- linux-2.6.orig/arch/sparc64/Kconfig.debug	2007-05-10 21:34:52.000000000 +0200
+++ linux-2.6/arch/sparc64/Kconfig.debug	2007-07-29 18:49:05.000000000 +0200
@@ -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
Index: linux-2.6/arch/x86_64/defconfig
===================================================================
--- linux-2.6.orig/arch/x86_64/defconfig	2007-07-27 21:34:37.000000000 +0200
+++ linux-2.6/arch/x86_64/defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -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
 
Index: linux-2.6/arch/x86_64/kernel/Makefile
===================================================================
--- linux-2.6.orig/arch/x86_64/kernel/Makefile	2007-07-12 23:57:06.000000000 +0200
+++ linux-2.6/arch/x86_64/kernel/Makefile	2007-07-29 18:49:05.000000000 +0200
@@ -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
Index: linux-2.6/arch/x86_64/kernel/suspend.c
===================================================================
--- linux-2.6.orig/arch/x86_64/kernel/suspend.c	2007-07-27 21:34:37.000000000 +0200
+++ linux-2.6/arch/x86_64/kernel/suspend.c	2007-07-29 18:49:05.000000000 +0200
@@ -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 */
Index: linux-2.6/drivers/acpi/sleep/main.c
===================================================================
--- linux-2.6.orig/drivers/acpi/sleep/main.c	2007-07-27 21:34:37.000000000 +0200
+++ linux-2.6/drivers/acpi/sleep/main.c	2007-07-29 18:49:06.000000000 +0200
@@ -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
Index: linux-2.6/drivers/acpi/sleep/proc.c
===================================================================
--- linux-2.6.orig/drivers/acpi/sleep/proc.c	2007-07-27 21:34:37.000000000 +0200
+++ linux-2.6/drivers/acpi/sleep/proc.c	2007-07-29 18:49:06.000000000 +0200
@@ -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;
Index: linux-2.6/drivers/i2c/chips/tps65010.c
===================================================================
--- linux-2.6.orig/drivers/i2c/chips/tps65010.c	2007-05-10 21:34:53.000000000 +0200
+++ linux-2.6/drivers/i2c/chips/tps65010.c	2007-07-29 18:49:06.000000000 +0200
@@ -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
Index: linux-2.6/include/asm-i386/e820.h
===================================================================
--- linux-2.6.orig/include/asm-i386/e820.h	2007-07-27 21:34:41.000000000 +0200
+++ linux-2.6/include/asm-i386/e820.h	2007-07-29 18:49:06.000000000 +0200
@@ -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)
Index: linux-2.6/include/linux/suspend.h
===================================================================
--- linux-2.6.orig/include/linux/suspend.h	2007-07-27 21:34:42.000000000 +0200
+++ linux-2.6/include/linux/suspend.h	2007-07-29 18:49:06.000000000 +0200
@@ -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)
 {
 }
Index: linux-2.6/kernel/power/Kconfig
===================================================================
--- linux-2.6.orig/kernel/power/Kconfig	2007-07-27 21:34:42.000000000 +0200
+++ linux-2.6/kernel/power/Kconfig	2007-07-29 18:53:40.000000000 +0200
@@ -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-
Index: linux-2.6/kernel/power/Makefile
===================================================================
--- linux-2.6.orig/kernel/power/Makefile	2007-05-13 14:43:17.000000000 +0200
+++ linux-2.6/kernel/power/Makefile	2007-07-29 18:49:06.000000000 +0200
@@ -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
Index: linux-2.6/kernel/power/main.c
===================================================================
--- linux-2.6.orig/kernel/power/main.c	2007-07-20 21:51:36.000000000 +0200
+++ linux-2.6/kernel/power/main.c	2007-07-29 18:49:06.000000000 +0200
@@ -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)
Index: linux-2.6/kernel/power/power.h
===================================================================
--- linux-2.6.orig/kernel/power/power.h	2007-07-20 21:51:36.000000000 +0200
+++ linux-2.6/kernel/power/power.h	2007-07-29 18:49:06.000000000 +0200
@@ -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?]
Index: linux-2.6/kernel/sys.c
===================================================================
--- linux-2.6.orig/kernel/sys.c	2007-07-27 21:34:42.000000000 +0200
+++ linux-2.6/kernel/sys.c	2007-07-29 18:49:06.000000000 +0200
@@ -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();
Index: linux-2.6/mm/Kconfig
===================================================================
--- linux-2.6.orig/mm/Kconfig	2007-07-18 22:37:43.000000000 +0200
+++ linux-2.6/mm/Kconfig	2007-07-29 18:49:06.000000000 +0200
@@ -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
Index: linux-2.6/mm/swapfile.c
===================================================================
--- linux-2.6.orig/mm/swapfile.c	2007-07-18 22:37:43.000000000 +0200
+++ linux-2.6/mm/swapfile.c	2007-07-29 18:49:06.000000000 +0200
@@ -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


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)
  2007-07-29 21:23                                 ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated) Rafael J. Wysocki
  2007-07-29 21:24                                   ` [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION (updated) Rafael J. Wysocki
@ 2007-07-29 21:27                                   ` Rafael J. Wysocki
  2007-07-31  4:59                                     ` Len Brown
  2007-07-30  0:21                                   ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and " Linus Torvalds
  2 siblings, 1 reply; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 21:27 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Len Brown, david, Andrew Morton, linux-acpi, linux-kernel,
	Pavel Machek, Adrian Bunk, Stefan Richter, Nigel Cunningham,
	pm list

From: Rafael J. Wysocki <rjw@sisk.pl>

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.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 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(-)

Index: linux-2.6/kernel/power/Kconfig
===================================================================
--- linux-2.6.orig/kernel/power/Kconfig	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/kernel/power/Kconfig	2007-07-29 19:06:48.000000000 +0200
@@ -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
Index: linux-2.6/kernel/power/Makefile
===================================================================
--- linux-2.6.orig/kernel/power/Makefile	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/kernel/power/Makefile	2007-07-29 19:06:48.000000000 +0200
@@ -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
Index: linux-2.6/drivers/base/power/Makefile
===================================================================
--- linux-2.6.orig/drivers/base/power/Makefile	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/drivers/base/power/Makefile	2007-07-29 19:06:48.000000000 +0200
@@ -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)
Index: linux-2.6/include/linux/suspend.h
===================================================================
--- linux-2.6.orig/include/linux/suspend.h	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/include/linux/suspend.h	2007-07-29 19:06:48.000000000 +0200
@@ -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)
 {
 }
Index: linux-2.6/include/linux/pm.h
===================================================================
--- linux-2.6.orig/include/linux/pm.h	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/include/linux/pm.h	2007-07-29 20:05:02.000000000 +0200
@@ -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.
Index: linux-2.6/kernel/power/power.h
===================================================================
--- linux-2.6.orig/kernel/power/power.h	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/kernel/power/power.h	2007-07-29 19:06:48.000000000 +0200
@@ -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)
Index: linux-2.6/kernel/power/main.c
===================================================================
--- linux-2.6.orig/kernel/power/main.c	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/kernel/power/main.c	2007-07-29 19:06:48.000000000 +0200
@@ -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;
 }
 
Index: linux-2.6/mm/page_alloc.c
===================================================================
--- linux-2.6.orig/mm/page_alloc.c	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/mm/page_alloc.c	2007-07-29 19:06:48.000000000 +0200
@@ -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
Index: linux-2.6/drivers/base/power/power.h
===================================================================
--- linux-2.6.orig/drivers/base/power/power.h	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/drivers/base/power/power.h	2007-07-29 19:06:48.000000000 +0200
@@ -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)
Index: linux-2.6/include/linux/freezer.h
===================================================================
--- linux-2.6.orig/include/linux/freezer.h	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/include/linux/freezer.h	2007-07-29 19:06:48.000000000 +0200
@@ -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 */
Index: linux-2.6/include/acpi/acpi_bus.h
===================================================================
--- linux-2.6.orig/include/acpi/acpi_bus.h	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/include/acpi/acpi_bus.h	2007-07-29 19:06:48.000000000 +0200
@@ -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 */
 
Index: linux-2.6/drivers/acpi/sleep/Makefile
===================================================================
--- linux-2.6.orig/drivers/acpi/sleep/Makefile	2007-07-27 21:34:37.000000000 +0200
+++ linux-2.6/drivers/acpi/sleep/Makefile	2007-07-29 19:13:59.000000000 +0200
@@ -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)
Index: linux-2.6/drivers/acpi/Kconfig
===================================================================
--- linux-2.6.orig/drivers/acpi/Kconfig	2007-07-27 21:34:37.000000000 +0200
+++ linux-2.6/drivers/acpi/Kconfig	2007-07-29 21:07:18.000000000 +0200
@@ -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
Index: linux-2.6/drivers/acpi/sleep/proc.c
===================================================================
--- linux-2.6.orig/drivers/acpi/sleep/proc.c	2007-07-29 19:06:03.000000000 +0200
+++ linux-2.6/drivers/acpi/sleep/proc.c	2007-07-29 19:33:11.000000000 +0200
@@ -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,
Index: linux-2.6/include/acpi/acpi_drivers.h
===================================================================
--- linux-2.6.orig/include/acpi/acpi_drivers.h	2007-07-29 19:40:59.000000000 +0200
+++ linux-2.6/include/acpi/acpi_drivers.h	2007-07-29 19:41:55.000000000 +0200
@@ -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__*/
Index: linux-2.6/drivers/acpi/sleep/main.c
===================================================================
--- linux-2.6.orig/drivers/acpi/sleep/main.c	2007-07-29 19:06:03.000000000 +0200
+++ linux-2.6/drivers/acpi/sleep/main.c	2007-07-29 22:06:59.000000000 +0200
@@ -21,6 +21,9 @@
 
 u8 sleep_states[ACPI_S_STATE_COUNT];
 
+static u32 acpi_target_sleep_state = ACPI_STATE_S0;
+
+#ifdef CONFIG_SUSPEND
 static struct pm_ops acpi_pm_ops;
 
 extern void do_suspend_lowlevel(void);
@@ -34,11 +37,6 @@ static u32 acpi_suspend_states[] = {
 
 static int init_8259A_after_S1;
 
-extern int acpi_sleep_prepare(u32 acpi_state);
-extern void acpi_power_off(void);
-
-static u32 acpi_target_sleep_state = ACPI_STATE_S0;
-
 /**
  *	acpi_pm_set_target - Set the target system sleep state to the state
  *		associated with given @pm_state, if supported.
@@ -163,21 +161,6 @@ static int acpi_pm_finish(suspend_state_
 	return 0;
 }
 
-int acpi_suspend(u32 acpi_state)
-{
-	suspend_state_t states[] = {
-		[1] = PM_SUSPEND_STANDBY,
-		[3] = PM_SUSPEND_MEM,
-		[5] = PM_SUSPEND_MAX
-	};
-
-	if (acpi_state < 6 && states[acpi_state])
-		return pm_suspend(states[acpi_state]);
-	if (acpi_state == 4)
-		return hibernate();
-	return -EINVAL;
-}
-
 static int acpi_pm_state_valid(suspend_state_t pm_state)
 {
 	u32 acpi_state;
@@ -202,6 +185,27 @@ static struct pm_ops acpi_pm_ops = {
 	.finish = acpi_pm_finish,
 };
 
+/*
+ * Toshiba fails to preserve interrupts over S1, reinitialization
+ * of 8259 is needed after S1 resume.
+ */
+static int __init init_ints_after_s1(struct dmi_system_id *d)
+{
+	printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident);
+	init_8259A_after_S1 = 1;
+	return 0;
+}
+
+static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
+	{
+	 .callback = init_ints_after_s1,
+	 .ident = "Toshiba Satellite 4030cdt",
+	 .matches = {DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),},
+	 },
+	{},
+};
+#endif /* CONFIG_SUSPEND */
+
 #ifdef CONFIG_HIBERNATION
 static int acpi_hibernation_prepare(void)
 {
@@ -256,6 +260,21 @@ static struct hibernation_ops acpi_hiber
 };
 #endif				/* CONFIG_HIBERNATION */
 
+int acpi_suspend(u32 acpi_state)
+{
+	suspend_state_t states[] = {
+		[1] = PM_SUSPEND_STANDBY,
+		[3] = PM_SUSPEND_MEM,
+		[5] = PM_SUSPEND_MAX
+	};
+
+	if (acpi_state < 6 && states[acpi_state])
+		return pm_suspend(states[acpi_state]);
+	if (acpi_state == 4)
+		return hibernate();
+	return -EINVAL;
+}
+
 /**
  *	acpi_pm_device_sleep_state - return preferred power state of ACPI device
  *		in the system sleep state given by %acpi_target_sleep_state
@@ -331,39 +350,22 @@ int acpi_pm_device_sleep_state(struct de
 	return d_max;
 }
 
-/*
- * Toshiba fails to preserve interrupts over S1, reinitialization
- * of 8259 is needed after S1 resume.
- */
-static int __init init_ints_after_s1(struct dmi_system_id *d)
-{
-	printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident);
-	init_8259A_after_S1 = 1;
-	return 0;
-}
-
-static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
-	{
-	 .callback = init_ints_after_s1,
-	 .ident = "Toshiba Satellite 4030cdt",
-	 .matches = {DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),},
-	 },
-	{},
-};
-
 int __init acpi_sleep_init(void)
 {
+	acpi_status status;
+	u8 type_a, type_b;
+#ifdef CONFIG_SUSPEND
 	int i = 0;
 
 	dmi_check_system(acpisleep_dmi_table);
+#endif
 
 	if (acpi_disabled)
 		return 0;
 
+#ifdef CONFIG_SUSPEND
 	printk(KERN_INFO PREFIX "(supports");
-	for (i = 0; i < ACPI_S_STATE_COUNT; i++) {
-		acpi_status status;
-		u8 type_a, type_b;
+	for (i = ACPI_STATE_S0; i < ACPI_STATE_S4; i++) {
 		status = acpi_get_sleep_type_data(i, &type_a, &type_b);
 		if (ACPI_SUCCESS(status)) {
 			sleep_states[i] = 1;
@@ -373,10 +375,14 @@ int __init acpi_sleep_init(void)
 	printk(")\n");
 
 	pm_set_ops(&acpi_pm_ops);
+#endif
 
 #ifdef CONFIG_HIBERNATION
-	if (sleep_states[ACPI_STATE_S4])
+	status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b);
+	if (ACPI_SUCCESS(status)) {
 		hibernation_set_ops(&acpi_hibernation_ops);
+		sleep_states[ACPI_STATE_S4] = 1;
+	}
 #else
 	sleep_states[ACPI_STATE_S4] = 0;
 #endif
Index: linux-2.6/drivers/acpi/sleep/sleep.h
===================================================================
--- linux-2.6.orig/drivers/acpi/sleep/sleep.h	2007-05-10 21:34:52.000000000 +0200
+++ linux-2.6/drivers/acpi/sleep/sleep.h	2007-07-29 20:26:01.000000000 +0200
@@ -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);

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
  2007-07-29 21:36                                         ` Rafael J. Wysocki
@ 2007-07-29 21:30                                           ` Richard Hughes
  2007-07-29 22:22                                             ` Rafael J. Wysocki
  2007-07-30  2:47                                             ` Kyle Moffett
  0 siblings, 2 replies; 75+ messages in thread
From: Richard Hughes @ 2007-07-29 21:30 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Adrian Bunk, Linus Torvalds, Len Brown, david, Andrew Morton,
	linux-acpi, linux-kernel, Pavel Machek, Stefan Richter,
	Nigel Cunningham, pm list

On Sun, 2007-07-29 at 23:36 +0200, Rafael J. Wysocki wrote:
> On Sunday, 29 July 2007 23:18, Adrian Bunk wrote:
> > On Sun, Jul 29, 2007 at 11:17:20PM +0200, Rafael J. Wysocki wrote:
> > > On Sunday, 29 July 2007 22:40, Adrian Bunk wrote:
> > > > On Sun, Jul 29, 2007 at 02:38:05PM +0200, Rafael J. Wysocki wrote:
> > > > >...
> > > > > +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.
> 
> 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.



^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
  2007-07-29 21:18                                       ` Adrian Bunk
@ 2007-07-29 21:36                                         ` Rafael J. Wysocki
  2007-07-29 21:30                                           ` Richard Hughes
  0 siblings, 1 reply; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 21:36 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: Linus Torvalds, Len Brown, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek, Stefan Richter, Nigel Cunningham,
	pm list

On Sunday, 29 July 2007 23:18, Adrian Bunk wrote:
> On Sun, Jul 29, 2007 at 11:17:20PM +0200, Rafael J. Wysocki wrote:
> > On Sunday, 29 July 2007 22:40, Adrian Bunk wrote:
> > > On Sun, Jul 29, 2007 at 02:38:05PM +0200, Rafael J. Wysocki wrote:
> > > >...
> > > > +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.

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

Greetings,
Rafael

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
  2007-07-29 21:30                                           ` Richard Hughes
@ 2007-07-29 22:22                                             ` Rafael J. Wysocki
  2007-07-30 21:26                                               ` Pavel Machek
  2007-07-30  2:47                                             ` Kyle Moffett
  1 sibling, 1 reply; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 22:22 UTC (permalink / raw)
  To: Richard Hughes
  Cc: Adrian Bunk, Linus Torvalds, Len Brown, david, Andrew Morton,
	linux-acpi, linux-kernel, Pavel Machek, Stefan Richter,
	Nigel Cunningham, pm list

On Sunday, 29 July 2007 23:30, Richard Hughes wrote:
> On Sun, 2007-07-29 at 23:36 +0200, Rafael J. Wysocki wrote:
> > On Sunday, 29 July 2007 23:18, Adrian Bunk wrote:
> > > On Sun, Jul 29, 2007 at 11:17:20PM +0200, Rafael J. Wysocki wrote:
> > > > On Sunday, 29 July 2007 22:40, Adrian Bunk wrote:
> > > > > On Sun, Jul 29, 2007 at 02:38:05PM +0200, Rafael J. Wysocki wrote:
> > > > > >...
> > > > > > +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.
> > 
> > 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
 

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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated)
  2007-07-29 21:23                                 ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated) Rafael J. Wysocki
  2007-07-29 21:24                                   ` [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION (updated) Rafael J. Wysocki
  2007-07-29 21:27                                   ` [PATCH 2/2] Introduce CONFIG_SUSPEND (updated) Rafael J. Wysocki
@ 2007-07-30  0:21                                   ` Linus Torvalds
  2007-07-30  7:25                                     ` Rafael J. Wysocki
                                                       ` (3 more replies)
  2 siblings, 4 replies; 75+ messages in thread
From: Linus Torvalds @ 2007-07-30  0:21 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, david, Andrew Morton, linux-acpi, linux-kernel,
	Pavel Machek, Adrian Bunk, Stefan Richter, Nigel Cunningham,
	pm list



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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
  2007-07-29 21:30                                           ` Richard Hughes
  2007-07-29 22:22                                             ` Rafael J. Wysocki
@ 2007-07-30  2:47                                             ` Kyle Moffett
  1 sibling, 0 replies; 75+ messages in thread
From: Kyle Moffett @ 2007-07-30  2:47 UTC (permalink / raw)
  To: Richard Hughes
  Cc: Rafael J. Wysocki, Adrian Bunk, Linus Torvalds, Len Brown, david,
	Andrew Morton, linux-acpi, linux-kernel, Pavel Machek,
	Stefan Richter, Nigel Cunningham, pm list

On Jul 29, 2007, at 17:30:40, Richard Hughes wrote:
> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated)
  2007-07-30  0:21                                   ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and " Linus Torvalds
@ 2007-07-30  7:25                                     ` Rafael J. Wysocki
  2007-07-31  3:54                                     ` Len Brown
                                                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-30  7:25 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Len Brown, david, Andrew Morton, linux-acpi, linux-kernel,
	Pavel Machek, Adrian Bunk, Stefan Richter, Nigel Cunningham,
	pm list, Andi Kleen

On Monday, 30 July 2007 02:21, Linus Torvalds wrote:
> 
> 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).

> 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

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/x86_64/defconfig   |    3 ---
 include/acpi/acpi_bus.h |    6 +++---
 2 files changed, 3 insertions(+), 6 deletions(-)

Index: linux-2.6/include/acpi/acpi_bus.h
===================================================================
--- linux-2.6.orig/include/acpi/acpi_bus.h	2007-07-30 07:58:48.000000000 +0200
+++ linux-2.6/include/acpi/acpi_bus.h	2007-07-30 08:25:32.000000000 +0200
@@ -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 */
 
Index: linux-2.6/arch/x86_64/defconfig
===================================================================
--- linux-2.6.orig/arch/x86_64/defconfig	2007-07-30 07:58:48.000000000 +0200
+++ linux-2.6/arch/x86_64/defconfig	2007-07-30 08:27:27.000000000 +0200
@@ -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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [2.6 patch] let SUSPEND select HOTPLUG_CPU
  2007-07-27 23:03                         ` Adrian Bunk
  2007-07-28  8:42                           ` Stefan Richter
@ 2007-07-30 21:18                           ` Pavel Machek
  1 sibling, 0 replies; 75+ messages in thread
From: Pavel Machek @ 2007-07-30 21:18 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: Stefan Richter, Linus Torvalds, Rafael J. Wysocki, Len Brown,
	david, Andrew Morton, linux-acpi, linux-kernel

Hi!

> > 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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
  2007-07-29 22:22                                             ` Rafael J. Wysocki
@ 2007-07-30 21:26                                               ` Pavel Machek
  0 siblings, 0 replies; 75+ messages in thread
From: Pavel Machek @ 2007-07-30 21:26 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Richard Hughes, Adrian Bunk, Linus Torvalds, Len Brown, david,
	Andrew Morton, linux-acpi, linux-kernel, Stefan Richter,
	Nigel Cunningham, pm list

Hi!

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

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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)
  2007-07-28 16:55                         ` Linus Torvalds
  2007-07-28 18:29                           ` Rafael J. Wysocki
@ 2007-07-31  3:53                           ` Len Brown
  2007-07-31  4:09                             ` david
  1 sibling, 1 reply; 75+ messages in thread
From: Len Brown @ 2007-07-31  3:53 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Rafael J. Wysocki, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek

On Saturday 28 July 2007 12:55, Linus Torvalds wrote:

> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated)
  2007-07-30  0:21                                   ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and " Linus Torvalds
  2007-07-30  7:25                                     ` Rafael J. Wysocki
@ 2007-07-31  3:54                                     ` Len Brown
  2007-07-31  3:54                                     ` [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE Len Brown
  2007-08-01  3:27                                     ` [PATCH] ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again) Len Brown
  3 siblings, 0 replies; 75+ messages in thread
From: Len Brown @ 2007-07-31  3:54 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Rafael J. Wysocki, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek, Adrian Bunk, Stefan Richter,
	Nigel Cunningham, pm list

On Sunday 29 July 2007 20:21, Linus Torvalds wrote:
> 
> 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.

> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE
  2007-07-30  0:21                                   ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and " Linus Torvalds
  2007-07-30  7:25                                     ` Rafael J. Wysocki
  2007-07-31  3:54                                     ` Len Brown
@ 2007-07-31  3:54                                     ` Len Brown
  2007-07-31  6:38                                       ` Pavel Machek
  2007-08-01  3:27                                     ` [PATCH] ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again) Len Brown
  3 siblings, 1 reply; 75+ messages in thread
From: Len Brown @ 2007-07-31  3:54 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Rafael J. Wysocki, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek, Adrian Bunk, Stefan Richter,
	Nigel Cunningham, pm list

From: Linus Torvalds <torvalds@linux-foundation.org>

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.

Signed-off-by: Len Brown <len.brown@intel.com>
---
 Kconfig |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index 412859f..ccf6576 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)
  2007-07-31  3:53                           ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Len Brown
@ 2007-07-31  4:09                             ` david
  2007-07-31  6:33                               ` Pavel Machek
  0 siblings, 1 reply; 75+ messages in thread
From: david @ 2007-07-31  4:09 UTC (permalink / raw)
  To: Len Brown
  Cc: Linus Torvalds, Rafael J. Wysocki, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek

On Mon, 30 Jul 2007, Len Brown wrote:

> On Saturday 28 July 2007 12:55, Linus Torvalds wrote:
>
>> 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.

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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)
  2007-07-29 21:27                                   ` [PATCH 2/2] Introduce CONFIG_SUSPEND (updated) Rafael J. Wysocki
@ 2007-07-31  4:59                                     ` Len Brown
  2007-07-31  9:15                                       ` Rafael J. Wysocki
  0 siblings, 1 reply; 75+ messages in thread
From: Len Brown @ 2007-07-31  4:59 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linus Torvalds, david, Andrew Morton, linux-acpi, linux-kernel,
	Pavel Machek, Adrian Bunk, Stefan Richter, Nigel Cunningham,
	pm list

On Sunday 29 July 2007 17:27, Rafael J. Wysocki wrote:
> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1)
  2007-07-31  4:09                             ` david
@ 2007-07-31  6:33                               ` Pavel Machek
  0 siblings, 0 replies; 75+ messages in thread
From: Pavel Machek @ 2007-07-31  6:33 UTC (permalink / raw)
  To: david
  Cc: Len Brown, Linus Torvalds, Rafael J. Wysocki, Andrew Morton,
	linux-acpi, linux-kernel

On Mon 2007-07-30 21:09:33, david@lang.hm wrote:
> On Mon, 30 Jul 2007, Len Brown wrote:
> 
> >On Saturday 28 July 2007 12:55, Linus Torvalds wrote:
> >
> >>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.
> 
> 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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE
  2007-07-31  3:54                                     ` [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE Len Brown
@ 2007-07-31  6:38                                       ` Pavel Machek
  2007-07-31  9:33                                         ` Rafael J. Wysocki
  2007-08-03 19:23                                         ` Len Brown
  0 siblings, 2 replies; 75+ messages in thread
From: Pavel Machek @ 2007-07-31  6:38 UTC (permalink / raw)
  To: Len Brown
  Cc: Linus Torvalds, Rafael J. Wysocki, david, Andrew Morton,
	linux-acpi, linux-kernel, Adrian Bunk, Stefan Richter,
	Nigel Cunningham, pm list

Hi!

> 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"?

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

> Signed-off-by: Len Brown <len.brown@intel.com>
> ---
>  Kconfig |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
> index 412859f..ccf6576 100644
> --- a/kernel/power/Kconfig
> +++ b/kernel/power/Kconfig
> @@ -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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)
  2007-07-31  4:59                                     ` Len Brown
@ 2007-07-31  9:15                                       ` Rafael J. Wysocki
  2007-07-31  9:16                                         ` [linux-pm] " Oliver Neukum
  0 siblings, 1 reply; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-31  9:15 UTC (permalink / raw)
  To: Len Brown
  Cc: Linus Torvalds, david, Andrew Morton, linux-acpi, linux-kernel,
	Pavel Machek, Adrian Bunk, Stefan Richter, Nigel Cunningham,
	pm list

On Tuesday, 31 July 2007 06:59, Len Brown wrote:
> On Sunday 29 July 2007 17:27, Rafael J. Wysocki wrote:
> > 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.

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


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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [linux-pm] Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)
  2007-07-31  9:15                                       ` Rafael J. Wysocki
@ 2007-07-31  9:16                                         ` Oliver Neukum
  2007-07-31 10:01                                           ` Rafael J. Wysocki
  0 siblings, 1 reply; 75+ messages in thread
From: Oliver Neukum @ 2007-07-31  9:16 UTC (permalink / raw)
  To: linux-pm
  Cc: Rafael J. Wysocki, Len Brown, david, Nigel Cunningham,
	linux-kernel, Adrian Bunk, linux-acpi, Stefan Richter,
	Pavel Machek, Andrew Morton, Linus Torvalds

Am Dienstag 31 Juli 2007 schrieb Rafael J. Wysocki:

> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE
  2007-07-31  6:38                                       ` Pavel Machek
@ 2007-07-31  9:33                                         ` Rafael J. Wysocki
  2007-08-03 19:23                                         ` Len Brown
  1 sibling, 0 replies; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-31  9:33 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Len Brown, Linus Torvalds, david, Andrew Morton, linux-acpi,
	linux-kernel, Adrian Bunk, Stefan Richter, Nigel Cunningham,
	pm list

On Tuesday, 31 July 2007 08:38, Pavel Machek wrote:
> Hi!
> 
> > 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"?
> 
> > 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.

> > Signed-off-by: Len Brown <len.brown@intel.com>
> > ---
> >  Kconfig |    7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
> > index 412859f..ccf6576 100644
> > --- a/kernel/power/Kconfig
> > +++ b/kernel/power/Kconfig
> > @@ -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.

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

> 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


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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [linux-pm] Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)
  2007-07-31  9:16                                         ` [linux-pm] " Oliver Neukum
@ 2007-07-31 10:01                                           ` Rafael J. Wysocki
  0 siblings, 0 replies; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-07-31 10:01 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: linux-pm, Len Brown, david, Nigel Cunningham, linux-kernel,
	Adrian Bunk, linux-acpi, Stefan Richter, Pavel Machek,
	Andrew Morton, Linus Torvalds

On Tuesday, 31 July 2007 11:16, Oliver Neukum wrote:
> Am Dienstag 31 Juli 2007 schrieb Rafael J. Wysocki:
> 
> > 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).

> 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


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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [GIT PATCH] ACPI patches for 2.6.23-rc1
  2007-07-28  7:58     ` Jan Dittmer
@ 2007-08-01  1:34       ` Yasha Okshtein
  0 siblings, 0 replies; 75+ messages in thread
From: Yasha Okshtein @ 2007-08-01  1:34 UTC (permalink / raw)
  To: Jan Dittmer
  Cc: Andreas Schwab, Len Brown, Linus Torvalds, Andrew Morton,
	linux-acpi, linux-kernel, Thomas Renninger

On 7/28/07, Jan Dittmer <jdi@l4x.org> wrote:
> Andreas Schwab wrote:
> > Jan Dittmer <jdi@l4x.org> writes:
> >> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH] ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again)
  2007-07-30  0:21                                   ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and " Linus Torvalds
                                                       ` (2 preceding siblings ...)
  2007-07-31  3:54                                     ` [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE Len Brown
@ 2007-08-01  3:27                                     ` Len Brown
  2007-08-01 10:24                                       ` Rafael J. Wysocki
  3 siblings, 1 reply; 75+ messages in thread
From: Len Brown @ 2007-08-01  3:27 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Rafael J. Wysocki, david, Andrew Morton, linux-acpi,
	linux-kernel, Pavel Machek, Adrian Bunk, Stefan Richter,
	Nigel Cunningham, pm list

From: Len Brown <len.brown@intel.com>

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.

Signed-off-by: Len Brown <len.brown@intel.com>
---
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 934d639..f1372de 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH] ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again)
  2007-08-01  3:27                                     ` [PATCH] ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again) Len Brown
@ 2007-08-01 10:24                                       ` Rafael J. Wysocki
  0 siblings, 0 replies; 75+ messages in thread
From: Rafael J. Wysocki @ 2007-08-01 10:24 UTC (permalink / raw)
  To: Len Brown
  Cc: Linus Torvalds, david, Andrew Morton, linux-acpi, linux-kernel,
	Pavel Machek, Adrian Bunk, Stefan Richter, Nigel Cunningham,
	pm list

On Wednesday, 1 August 2007 05:27, Len Brown wrote:
> From: Len Brown <len.brown@intel.com>
> 
> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE
  2007-07-31  6:38                                       ` Pavel Machek
  2007-07-31  9:33                                         ` Rafael J. Wysocki
@ 2007-08-03 19:23                                         ` Len Brown
  2007-08-05 18:36                                           ` Pavel Machek
  1 sibling, 1 reply; 75+ messages in thread
From: Len Brown @ 2007-08-03 19:23 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Linus Torvalds, Rafael J. Wysocki, david, Andrew Morton,
	linux-acpi, linux-kernel, Adrian Bunk, Stefan Richter,
	Nigel Cunningham, pm list

On Tuesday 31 July 2007 02:38, Pavel Machek wrote:
> Hi!
> 
> > 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.

> > 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.
> 
> > Signed-off-by: Len Brown <len.brown@intel.com>
> > ---
> >  Kconfig |    7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
> > index 412859f..ccf6576 100644
> > --- a/kernel/power/Kconfig
> > +++ b/kernel/power/Kconfig
> > @@ -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).

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


^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE
  2007-08-03 19:23                                         ` Len Brown
@ 2007-08-05 18:36                                           ` Pavel Machek
  0 siblings, 0 replies; 75+ messages in thread
From: Pavel Machek @ 2007-08-05 18:36 UTC (permalink / raw)
  To: Len Brown
  Cc: Linus Torvalds, Rafael J. Wysocki, david, Andrew Morton,
	linux-acpi, linux-kernel, Adrian Bunk, Stefan Richter,
	Nigel Cunningham, pm list

On Fri 2007-08-03 15:23:19, Len Brown wrote:
> On Tuesday 31 July 2007 02:38, Pavel Machek wrote:
> > Hi!
> > 
> > > 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.
> 
> > > 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.
> > 
> > > Signed-off-by: Len Brown <len.brown@intel.com>
> > > ---
> > >  Kconfig |    7 ++++++-
> > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
> > > index 412859f..ccf6576 100644
> > > --- a/kernel/power/Kconfig
> > > +++ b/kernel/power/Kconfig
> > > @@ -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).
> 
> 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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 75+ messages in thread

end of thread, other threads:[~2007-08-05 18:36 UTC | newest]

Thread overview: 75+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-25 16:38 [GIT PATCH] ACPI patches for 2.6.23-rc1 Len Brown
2007-07-25 18:48 ` Linus Torvalds
2007-07-25 22:51   ` Len Brown
2007-07-26  2:20     ` david
2007-07-26  4:26       ` Len Brown
2007-07-26  5:00         ` david
2007-07-26  6:55         ` Linus Torvalds
2007-07-26 17:45           ` Len Brown
2007-07-26 18:01             ` Linus Torvalds
2007-07-26 18:02             ` david
2007-07-26 18:16               ` Linus Torvalds
2007-07-26 18:27                 ` Jeff Garzik
2007-07-26 18:18               ` Len Brown
2007-07-26 19:17             ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Rafael J. Wysocki
2007-07-26 19:57               ` Linus Torvalds
2007-07-26 20:48                 ` Rafael J. Wysocki
2007-07-26 20:55                   ` Linus Torvalds
2007-07-27 22:25                     ` [2.6 patch] let SUSPEND select HOTPLUG_CPU Adrian Bunk
2007-07-27 22:47                       ` Stefan Richter
2007-07-27 23:03                         ` Adrian Bunk
2007-07-28  8:42                           ` Stefan Richter
2007-07-30 21:18                           ` Pavel Machek
2007-07-28 14:44                         ` Sergio Monteiro Basto
2007-07-27 22:57                       ` Linus Torvalds
2007-07-28  4:52                         ` [2.6 patch] SOFTWARE_SUSPEND: handle HOTPLUG_CPU automatically Adrian Bunk
2007-07-28  9:07                           ` Stefan Richter
2007-07-28 18:30                       ` [2.6 patch] let SUSPEND select HOTPLUG_CPU Rafael J. Wysocki
2007-07-28  7:30                     ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Len Brown
2007-07-28  7:33                       ` [PATCH] ACPI: restore CONFIG_ACPI_SLEEP Len Brown
2007-07-28 16:25                       ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Linus Torvalds
2007-07-28 16:55                         ` Linus Torvalds
2007-07-28 18:29                           ` Rafael J. Wysocki
2007-07-28 18:31                             ` Linus Torvalds
2007-07-29 10:20                               ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (was: CONFIG_SUSPEND?) Rafael J. Wysocki
2007-07-29 10:21                                 ` [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION Rafael J. Wysocki
2007-07-29 12:38                                 ` [PATCH 2/2] Introduce CONFIG_SUSPEND Rafael J. Wysocki
2007-07-29 20:40                                   ` Adrian Bunk
2007-07-29 21:17                                     ` Rafael J. Wysocki
2007-07-29 21:18                                       ` Adrian Bunk
2007-07-29 21:36                                         ` Rafael J. Wysocki
2007-07-29 21:30                                           ` Richard Hughes
2007-07-29 22:22                                             ` Rafael J. Wysocki
2007-07-30 21:26                                               ` Pavel Machek
2007-07-30  2:47                                             ` Kyle Moffett
2007-07-29 21:23                                 ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated) Rafael J. Wysocki
2007-07-29 21:24                                   ` [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION (updated) Rafael J. Wysocki
2007-07-29 21:27                                   ` [PATCH 2/2] Introduce CONFIG_SUSPEND (updated) Rafael J. Wysocki
2007-07-31  4:59                                     ` Len Brown
2007-07-31  9:15                                       ` Rafael J. Wysocki
2007-07-31  9:16                                         ` [linux-pm] " Oliver Neukum
2007-07-31 10:01                                           ` Rafael J. Wysocki
2007-07-30  0:21                                   ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and " Linus Torvalds
2007-07-30  7:25                                     ` Rafael J. Wysocki
2007-07-31  3:54                                     ` Len Brown
2007-07-31  3:54                                     ` [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE Len Brown
2007-07-31  6:38                                       ` Pavel Machek
2007-07-31  9:33                                         ` Rafael J. Wysocki
2007-08-03 19:23                                         ` Len Brown
2007-08-05 18:36                                           ` Pavel Machek
2007-08-01  3:27                                     ` [PATCH] ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again) Len Brown
2007-08-01 10:24                                       ` Rafael J. Wysocki
2007-07-31  3:53                           ` CONFIG_SUSPEND? (was: Re: [GIT PATCH] ACPI patches for 2.6.23-rc1) Len Brown
2007-07-31  4:09                             ` david
2007-07-31  6:33                               ` Pavel Machek
2007-07-26 10:07         ` [GIT PATCH] ACPI patches for 2.6.23-rc1 Gabriel C
2007-07-26 18:05           ` Len Brown
2007-07-26 18:18             ` Linus Torvalds
2007-07-26 18:38             ` Gabriel C
2007-07-26 18:53             ` defconfig , ACPI=n compile error Gabriel C
2007-07-26  7:02     ` [GIT PATCH] ACPI patches for 2.6.23-rc1 Linus Torvalds
2007-07-27  6:26 ` Jan Dittmer
2007-07-27 16:25   ` Thomas Renninger
2007-07-27 23:50   ` Andreas Schwab
2007-07-28  7:58     ` Jan Dittmer
2007-08-01  1:34       ` Yasha Okshtein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).