24 Oct, 2016

1 commit

  • Commit 4bcc595ccd80 (printk: reinstate KERN_CONT for printing
    continuation lines) exposed a missing KERN_CONT from one of the
    messages shown on entering suspend. With v4.9-rc1, the 'done.' shown
    after syncing the filesystems no longer appears as a continuation but
    a new message with its own timestamp.

    [ 9.259566] PM: Syncing filesystems ... [ 9.264119] done.

    Fix this by adding the KERN_CONT log level for the 'done.' part of the
    message seen after syncing filesystems. While we are at it, convert
    these suspend printks to pr_info and pr_cont, respectively.

    Signed-off-by: Jon Hunter
    Signed-off-by: Rafael J. Wysocki

    Jon Hunter
     

13 Sep, 2016

1 commit

  • Suspend-to-idle (aka the "freeze" sleep state) is a system sleep state
    in which all of the processors enter deepest possible idle state and
    wait for interrupts right after suspending all the devices.

    There is no hard requirement for a platform to support and register
    platform specific suspend_ops to enter suspend-to-idle/freeze state.
    Only deeper system sleep states like PM_SUSPEND_STANDBY and
    PM_SUSPEND_MEM rely on such low level support/implementation.

    suspend-to-idle can be entered as along as all the devices can be
    suspended. This patch enables the support for suspend-to-idle even on
    systems that don't have any low level support for deeper system sleep
    states and/or don't register any platform specific suspend_ops.

    Signed-off-by: Sudeep Holla
    Tested-by: Andy Gross
    Signed-off-by: Rafael J. Wysocki

    Sudeep Holla
     

28 Jun, 2016

1 commit


23 Mar, 2016

1 commit

  • Use the more common logging method with the eventual goal of removing
    pr_warning altogether.

    Miscellanea:

    - Realign arguments
    - Coalesce formats
    - Add missing space between a few coalesced formats

    Signed-off-by: Joe Perches
    Acked-by: Rafael J. Wysocki [kernel/power/suspend.c]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

11 Feb, 2016

1 commit


14 Oct, 2015

1 commit

  • There are quite a few cases in which device drivers, bus types or
    even the PM core itself may benefit from knowing whether or not
    the platform firmware will be involved in the upcoming system power
    transition (during system suspend) or whether or not it was involved
    in it (during system resume).

    For this reason, introduce global system suspend flags that can be
    used by the platform code to expose that information for the benefit
    of the other parts of the kernel and make the ACPI core set them
    as appropriate.

    Users of the new flags will be added later.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

01 Aug, 2015

1 commit

  • The Linux kernel suspend path has traditionally invoked sys_sync()
    before freezing user threads.

    But sys_sync() can be expensive, and some user-space OS's do not want
    the kernel to pay the cost of sys_sync() on every suspend -- preferring
    invoke sync() from user-space if/when they want it.

    So make sys_sync on suspend build-time optional.

    The default is unchanged.

    Signed-off-by: Len Brown
    Signed-off-by: Rafael J. Wysocki

    Len Brown
     

19 May, 2015

1 commit

  • If a wakeup source is found to be pending in the last stage of
    suspend after syscore suspend, then the machine won't suspend, but
    suspend_enter() will return 0. That is confusing, as wakeup detection
    elsewhere causes -EBUSY to be returned from suspend_enter().

    To avoid the confusion, make suspend_enter() return -EBUSY in that
    case too.

    Signed-off-by: Ruchi Kandoi
    [ rjw: Subject and changelog ]
    Signed-off-by: Rafael J. Wysocki

    Ruchi Kandoi
     

13 May, 2015

1 commit

  • Some of the system suspend diagnostic messages related to
    suspend-to-idle refer to it as "freeze sleep" or "freeze state"
    while the others say "suspend-to-idle". To reduce the possible
    confusion that may result from that, refine the former either to
    say "suspend to idle" too or to make it clearer that what is printed
    is a state string written to /sys/power/state ("mem", "standby",
    or "freeze").

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

26 Feb, 2015

1 commit

  • When CONFIG_PM_DEBUG=y, we provide a sysfs file (/sys/power/pm_test) for
    selecting one of a few suspend test modes, where rather than entering a
    full suspend state, the kernel will perform some subset of suspend
    steps, wait 5 seconds, and then resume back to normal operation.

    This mode is useful for (among other things) observing the state of the
    system just before entering a sleep mode, for debugging or analysis
    purposes. However, a constant 5 second wait is not sufficient for some
    sorts of analysis; for example, on an SoC, one might want to use
    external tools to probe the power states of various on-chip controllers
    or clocks.

    This patch turns this 5 second delay into a configurable module
    parameter, so users can determine how long to wait in this
    pseudo-suspend state before resuming the system.

    Example (wait 30 seconds);

    # echo 30 > /sys/module/suspend/parameters/pm_test_delay
    # echo core > /sys/power/pm_test
    # time echo mem > /sys/power/state
    ...
    [ 17.583625] suspend debug: Waiting for 30 second(s).
    ...
    real 0m30.381s
    user 0m0.017s
    sys 0m0.080s

    Signed-off-by: Brian Norris
    Acked-by: Pavel Machek
    Reviewed-by: Kevin Cernekee
    Acked-by: Florian Fainelli
    Signed-off-by: Rafael J. Wysocki

    Brian Norris
     

14 Feb, 2015

1 commit

  • In preparation for adding support for quiescing timers in the final
    stage of suspend-to-idle transitions, rework the freeze_enter()
    function making the system wait on a wakeup event, the freeze_wake()
    function terminating the suspend-to-idle loop and the mechanism by
    which deep idle states are entered during suspend-to-idle.

    First of all, introduce a simple state machine for suspend-to-idle
    and make the code in question use it.

    Second, prevent freeze_enter() from losing wakeup events due to race
    conditions and ensure that the number of online CPUs won't change
    while it is being executed. In addition to that, make it force
    all of the CPUs re-enter the idle loop in case they are in idle
    states already (so they can enter deeper idle states if possible).

    Next, drop cpuidle_use_deepest_state() and replace use_deepest_state
    checks in cpuidle_select() and cpuidle_reflect() with a single
    suspend-to-idle state check in cpuidle_idle_call().

    Finally, introduce cpuidle_enter_freeze() that will simply find the
    deepest idle state available to the given CPU and enter it using
    cpuidle_enter().

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Peter Zijlstra (Intel)

    Rafael J. Wysocki
     

09 Nov, 2014

1 commit


01 Oct, 2014

3 commits

  • The ACPI GPE wakeup from suspend-to-idle is currently based on using
    the IRQF_NO_SUSPEND flag for the ACPI SCI, but that is problematic
    for a couple of reasons. First, in principle the ACPI SCI may be
    shared and IRQF_NO_SUSPEND does not really work well with shared
    interrupts. Second, it may require the ACPI subsystem to special-case
    the handling of device notifications depending on whether or not
    they are received during suspend-to-idle in some places which would
    lead to fragile code. Finally, it's better the handle ACPI wakeup
    interrupts consistently with wakeup interrupts from other sources.

    For this reason, remove the IRQF_NO_SUSPEND flag from the ACPI SCI
    and use enable_irq_wake()/disable_irq_wake() with it instead, which
    requires two additional platform hooks to be added to struct
    platform_freeze_ops.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Rename several local functions related to platform handling during
    system suspend resume in suspend.c so that their names better
    reflect their roles.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Subsequent change sets will add platform-related operations between
    dpm_suspend_late() and dpm_suspend_noirq() as well as between
    dpm_resume_noirq() and dpm_resume_early() in suspend_enter(), so
    export these functions for suspend_enter() to be able to call them
    separately and split the invocations of dpm_suspend_end() and
    dpm_resume_start() in there accordingly.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

22 Sep, 2014

1 commit

  • This patch adds another suspend_resume trace event for analyze_suspend
    to capture. The resume_console call can take several hundred milliseconds
    if the printk buffer is full of debug info. The tool will now inform
    testers of the wasted time and encourage them to disable it in
    production builds.

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd E Brandt
     

03 Sep, 2014

1 commit

  • After commit d431cbc53cb7 (PM / sleep: Simplify sleep states sysfs
    interface code) the pm_states[] array is not populated initially,
    which causes setup_test_suspend() to always fail and the suspend
    testing during boot doesn't work any more.

    Fix the problem by using pm_labels[] instead of pm_states[] in
    setup_test_suspend() and storing a pointer to the label of the
    sleep state to test rather than the number representing it,
    because the connection between the state numbers and labels is
    only established by suspend_set_ops().

    Fixes: d431cbc53cb7 (PM / sleep: Simplify sleep states sysfs interface code)
    Reported-by: Srinivas Pandruvada
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

07 Aug, 2014

1 commit

  • Pull ACPI and power management updates from Rafael Wysocki:
    "Again, ACPICA leads the pack (47 commits), followed by cpufreq (18
    commits) and system suspend/hibernation (9 commits).

    From the new code perspective, the ACPICA update brings ACPI 5.1 to
    the table, including a new device configuration object called _DSD
    (Device Specific Data) that will hopefully help us to operate device
    properties like Device Trees do (at least to some extent) and changes
    related to supporting ACPI on ARM.

    Apart from that we have hibernation changes making it use radix trees
    to store memory bitmaps which should speed up some operations carried
    out by it quite significantly. We also have some power management
    changes related to suspend-to-idle (the "freeze" sleep state) support
    and more preliminary changes needed to support ACPI on ARM (outside of
    ACPICA).

    The rest is fixes and cleanups pretty much everywhere.

    Specifics:

    - ACPICA update to upstream version 20140724. That includes ACPI 5.1
    material (support for the _CCA and _DSD predefined names, changes
    related to the DMAR and PCCT tables and ARM support among other
    things) and cleanups related to using ACPICA's header files. A
    major part of it is related to acpidump and the core code used by
    that utility. Changes from Bob Moore, David E Box, Lv Zheng,
    Sascha Wildner, Tomasz Nowicki, Hanjun Guo.

    - Radix trees for memory bitmaps used by the hibernation core from
    Joerg Roedel.

    - Support for waking up the system from suspend-to-idle (also known
    as the "freeze" sleep state) using ACPI-based PCI wakeup signaling
    (Rafael J Wysocki).

    - Fixes for issues related to ACPI button events (Rafael J Wysocki).

    - New device ID for an ACPI-enumerated device included into the
    Wildcat Point PCH from Jie Yang.

    - ACPI video updates related to backlight handling from Hans de Goede
    and Linus Torvalds.

    - Preliminary changes needed to support ACPI on ARM from Hanjun Guo
    and Graeme Gregory.

    - ACPI PNP core cleanups from Arjun Sreedharan and Zhang Rui.

    - Cleanups related to ACPI_COMPANION() and ACPI_HANDLE() macros
    (Rafael J Wysocki).

    - ACPI-based device hotplug cleanups from Wei Yongjun and Rafael J
    Wysocki.

    - Cleanups and improvements related to system suspend from Lan
    Tianyu, Randy Dunlap and Rafael J Wysocki.

    - ACPI battery cleanup from Wei Yongjun.

    - cpufreq core fixes from Viresh Kumar.

    - Elimination of a deadband effect from the cpufreq ondemand governor
    and intel_pstate driver cleanups from Stratos Karafotis.

    - 350MHz CPU support for the powernow-k6 cpufreq driver from Mikulas
    Patocka.

    - Fix for the imx6 cpufreq driver from Anson Huang.

    - cpuidle core and governor cleanups from Daniel Lezcano, Sandeep
    Tripathy and Mohammad Merajul Islam Molla.

    - Build fix for the big_little cpuidle driver from Sachin Kamat.

    - Configuration fix for the Operation Performance Points (OPP)
    framework from Mark Brown.

    - APM cleanup from Jean Delvare.

    - cpupower utility fixes and cleanups from Peter Senna Tschudin,
    Andrey Utkin, Himangi Saraogi, Rickard Strandqvist, Thomas
    Renninger"

    * tag 'pm+acpi-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (118 commits)
    ACPI / LPSS: add LPSS device for Wildcat Point PCH
    ACPI / PNP: Replace faulty is_hex_digit() by isxdigit()
    ACPICA: Update version to 20140724.
    ACPICA: ACPI 5.1: Update for PCCT table changes.
    ACPICA/ARM: ACPI 5.1: Update for GTDT table changes.
    ACPICA/ARM: ACPI 5.1: Update for MADT changes.
    ACPICA/ARM: ACPI 5.1: Update for FADT changes.
    ACPICA: ACPI 5.1: Support for the _CCA predifined name.
    ACPICA: ACPI 5.1: New notify value for System Affinity Update.
    ACPICA: ACPI 5.1: Support for the _DSD predefined name.
    ACPICA: Debug object: Add current value of Timer() to debug line prefix.
    ACPICA: acpihelp: Add UUID support, restructure some existing files.
    ACPICA: Utilities: Fix local printf issue.
    ACPICA: Tables: Update for DMAR table changes.
    ACPICA: Remove some extraneous printf arguments.
    ACPICA: Update for comments/formatting. No functional changes.
    ACPICA: Disassembler: Add support for the ToUUID opererator (macro).
    ACPICA: Remove a redundant cast to acpi_size for ACPI_OFFSET() macro.
    ACPICA: Work around an ancient GCC bug.
    ACPI / processor: Make it possible to get local x2apic id via _MAT
    ...

    Linus Torvalds
     

05 Aug, 2014

1 commit

  • Pull tracing updates from Steven Rostedt:
    "This pull request has a lot of work done. The main thing is the
    changes to the ftrace function callback infrastructure. It's
    introducing a way to allow different functions to call directly
    different trampolines instead of all calling the same "mcount" one.

    The only user of this for now is the function graph tracer, which
    always had a different trampoline, but the function tracer trampoline
    was called and did basically nothing, and then the function graph
    tracer trampoline was called. The difference now, is that the
    function graph tracer trampoline can be called directly if a function
    is only being traced by the function graph trampoline. If function
    tracing is also happening on the same function, the old way is still
    done.

    The accounting for this takes up more memory when function graph
    tracing is activated, as it needs to keep track of which functions it
    uses. I have a new way that wont take as much memory, but it's not
    ready yet for this merge window, and will have to wait for the next
    one.

    Another big change was the removal of the ftrace_start/stop() calls
    that were used by the suspend/resume code that stopped function
    tracing when entering into suspend and resume paths. The stop of
    ftrace was done because there was some function that would crash the
    system if one called smp_processor_id()! The stop/start was a big
    hammer to solve the issue at the time, which was when ftrace was first
    introduced into Linux. Now ftrace has better infrastructure to debug
    such issues, and I found the problem function and labeled it with
    "notrace" and function tracing can now safely be activated all the way
    down into the guts of suspend and resume

    Other changes include clean ups of uprobe code, clean up of the
    trace_seq() code, and other various small fixes and clean ups to
    ftrace and tracing"

    * tag 'trace-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (57 commits)
    ftrace: Add warning if tramp hash does not match nr_trampolines
    ftrace: Fix trampoline hash update check on rec->flags
    ring-buffer: Use rb_page_size() instead of open coded head_page size
    ftrace: Rename ftrace_ops field from trampolines to nr_trampolines
    tracing: Convert local function_graph functions to static
    ftrace: Do not copy old hash when resetting
    tracing: let user specify tracing_thresh after selecting function_graph
    ring-buffer: Always run per-cpu ring buffer resize with schedule_work_on()
    tracing: Remove function_trace_stop and HAVE_FUNCTION_TRACE_MCOUNT_TEST
    s390/ftrace: remove check of obsolete variable function_trace_stop
    arm64, ftrace: Remove check of obsolete variable function_trace_stop
    Blackfin: ftrace: Remove check of obsolete variable function_trace_stop
    metag: ftrace: Remove check of obsolete variable function_trace_stop
    microblaze: ftrace: Remove check of obsolete variable function_trace_stop
    MIPS: ftrace: Remove check of obsolete variable function_trace_stop
    parisc: ftrace: Remove check of obsolete variable function_trace_stop
    sh: ftrace: Remove check of obsolete variable function_trace_stop
    sparc64,ftrace: Remove check of obsolete variable function_trace_stop
    tile: ftrace: Remove check of obsolete variable function_trace_stop
    ftrace: x86: Remove check of obsolete variable function_trace_stop
    ...

    Linus Torvalds
     

23 Jul, 2014

1 commit


21 Jul, 2014

1 commit


17 Jul, 2014

1 commit

  • ftrace_stop() and ftrace_start() were added to the suspend and hibernate
    process because there was some function within the work flow that caused
    the system to reboot if it was traced. This function has recently been
    found (restore_processor_state()). Now there's no reason to disable
    function tracing while we are going into suspend or hibernate, which means
    that being able to trace this will help tremendously in debugging any
    issues with suspend or hibernate.

    This also means that the ftrace_stop/start() functions can be removed
    and simplify the function tracing code a bit.

    Link: http://lkml.kernel.org/r/1518201.VD9cU33jRU@vostro.rjw.lan

    Acked-by: "Rafael J. Wysocki"
    Reviewed-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)
     

15 Jul, 2014

1 commit

  • This patch fixes a NULL pointer dereference issue introduced by
    commit 1f0b63866fc1 (ACPI / PM: Hold ACPI scan lock over the "freeze"
    sleep state).

    Fixes: 1f0b63866fc1 (ACPI / PM: Hold ACPI scan lock over the "freeze" sleep state)
    Link: http://marc.info/?l=linux-pm&m=140541182017443&w=2
    Reported-and-tested-by: Alexander Stein
    Signed-off-by: Zhang Rui
    Signed-off-by: Rafael J. Wysocki

    Zhang Rui
     

07 Jun, 2014

2 commits

  • Adds trace events that give finer resolution into suspend/resume. These
    events are graphed in the timelines generated by the analyze_suspend.py
    script. They represent large areas of time consumed that are typical to
    suspend and resume.

    The event is triggered by calling the function "trace_suspend_resume"
    with three arguments: a string (the name of the event to be displayed
    in the timeline), an integer (case specific number, such as the power
    state or cpu number), and a boolean (where true is used to denote the start
    of the timeline event, and false to denote the end).

    The suspend_resume trace event reproduces the data that the machine_suspend
    trace event did, so the latter has been removed.

    Signed-off-by: Todd Brandt
    Acked-by: Steven Rostedt
    Signed-off-by: Rafael J. Wysocki

    Todd E Brandt
     
  • Rafael J. Wysocki
     

26 May, 2014

3 commits

  • On some systems the platform doesn't support neither
    PM_SUSPEND_MEM nor PM_SUSPEND_STANDBY, so PM_SUSPEND_FREEZE is the
    only available system sleep state. However, some user space frameworks
    only use the "mem" and (sometimes) "standby" sleep state labels, so
    the users of those systems need to modify user space in order to be
    able to use system suspend at all and that is not always possible.

    For this reason, add a new kernel command line argument,
    relative_sleep_states, allowing the users of those systems to change
    the way in which the kernel assigns labels to system sleep states.
    Namely, for relative_sleep_states=1, the "mem", "standby" and "freeze"
    labels will enumerate the available system sleem states from the
    deepest to the shallowest, respectively, so that "mem" is always
    present in /sys/power/state and the other state strings may or may
    not be presend depending on what is supported by the platform.

    Update system sleep states documentation to reflect this change.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Use the observation that, for platform-dependent sleep states
    (PM_SUSPEND_STANDBY, PM_SUSPEND_MEM), a given state is either
    always supported or always unsupported and store that information
    in pm_states[] instead of calling valid_state() every time we
    need to check it.

    Also do not use valid_state() for PM_SUSPEND_FREEZE, which is always
    valid, and move the pm_test_level validity check for PM_SUSPEND_FREEZE
    directly into enter_state().

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • To allow sleep states corresponding to the "mem", "standby" and
    "freeze" lables to be different from the pm_states[] indexes of
    those strings, introduce struct pm_sleep_state, consisting of
    a string label and a state number, and turn pm_states[] into an
    array of objects of that type.

    This modification should not lead to any functional changes.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

20 May, 2014

1 commit


16 May, 2014

1 commit

  • The "freeze" sleep state suffers from the same issue that was
    addressed by commit ad07277e82de (ACPI / PM: Hold acpi_scan_lock over
    system PM transitions) for ACPI sleep states, that is, things break
    if ->remove() is called for devices whose system resume callbacks
    haven't been executed yet.

    It also can be addressed in the same way, by holding the ACPI scan
    lock over the "freeze" sleep state and PM transitions to and from
    that state, but ->begin() and ->end() platform operations for the
    "freeze" sleep state are needed for this purpose.

    This change has been tested on Acer Aspire S5 with Thunderbolt.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

07 May, 2014

1 commit


22 Apr, 2014

1 commit

  • The "freeze" system sleep state introduced by commit 7e73c5ae6e79
    (PM: Introduce suspend state PM_SUSPEND_FREEZE) requires cpuidle
    to be functional when freeze_enter() is executed to work correctly
    (that is, to be able to save any more energy than runtime idle),
    but that is impossible after commit 8651f97bd951d (PM / cpuidle:
    System resume hang fix with cpuidle) which caused cpuidle to be
    paused in dpm_suspend_noirq() and resumed in dpm_resume_noirq().

    To avoid that problem, add cpuidle_resume() and cpuidle_pause()
    to the beginning and the end of freeze_enter(), respectively.

    Reported-by: Zhang Rui
    Signed-off-by: Rafael J. Wysocki
    Reviewed-by: Preeti U Murthy

    Rafael J. Wysocki
     

08 Apr, 2014

1 commit


11 Mar, 2014

1 commit

  • Double ! or !! are normally required to get 0 or 1 out of a expression. A
    comparision always returns 0 or 1 and hence there is no need to apply double !
    over it again.

    Signed-off-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Viresh Kumar
     

26 Jul, 2013

1 commit

  • Change where ftrace is disabled and re-enabled during system
    suspend/resume to allow tracing of device driver pm callbacks.
    Ftrace will now be turned off when suspend reaches
    disable_nonboot_cpus() instead of at the very beginning of system
    suspend.

    Ftrace was disabled during suspend/resume back in 2008 by
    Steven Rostedt as he discovered there was a conflict in the
    enable_nonboot_cpus() call (see commit f42ac38 "ftrace: disable
    tracing for suspend to ram"). This change preserves his fix by
    disabling ftrace, but only at the function where it is known
    to cause problems.

    The new change allows tracing of the device level code for better
    debug.

    [rjw: Changelog]
    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Brandt, Todd E
     

12 Jun, 2013

1 commit

  • This adds in a new message to the wakeup code which adds an
    indication to the log that suspend was cancelled due to a wake event
    occouring during the suspend sequence. It also adjusts the message
    printed in suspend.c to reflect the potential that a suspend was
    aborted, as opposed to a device failing to suspend.

    Without these message adjustments one can end up with a kernel log
    that says that a device failed to suspend with no actual device
    suspend failures, which can be confusing to the log examiner.

    Signed-off-by: Bernie Thompson
    Signed-off-by: Rafael J. Wysocki

    Bernie Thompson
     

05 Apr, 2013

2 commits

  • freeze state is a software suspend state that does not run into
    low-level platform callbacks which may interact with BIOS.
    And freeze state does not need to disable the processors.

    But the current pm_test support misleads users because users
    can enter freeze state with pm_test set to TEST_CPUS/TEST_CORE,
    while this pm_test setting never takes actions.

    So, invalidate TEST_CPUS/TEST_CORE for freeze state in this patch.
    Then users will get an error instead, when trying to
    enter freeze state with pm_test mode set to TEST_CPUS/TEST_CORE.

    Signed-off-by: Zhang Rui
    Signed-off-by: Rafael J. Wysocki

    Zhang Rui
     
  • Invoke freeze_enter() after suspend_test(TEST_PLATFORM) being invoked.

    So when setting /sys/power/pm_test to "platform", it can be used to
    check if freeze state is working well after all devices are suspended
    and before processors are blocked,

    Signed-off-by: Zhang Rui
    Signed-off-by: Rafael J. Wysocki

    Zhang Rui
     

10 Feb, 2013

1 commit

  • PM_SUSPEND_FREEZE state is a general state that
    does not need any platform specific support, it equals
    frozen processes + suspended devices + idle processors.

    Compared with PM_SUSPEND_MEMORY,
    PM_SUSPEND_FREEZE saves less power
    because the system is still in a running state.
    PM_SUSPEND_FREEZE has less resume latency because it does not
    touch BIOS, and the processors are in idle state.

    Compared with RTPM/idle,
    PM_SUSPEND_FREEZE saves more power as
    1. the processor has longer sleep time because processes are frozen.
    The deeper c-state the processor supports, more power saving we can get.
    2. PM_SUSPEND_FREEZE uses system suspend code path, thus we can get
    more power saving from the devices that does not have good RTPM support.

    This state is useful for
    1) platforms that do not have STR, or have a broken STR.
    2) platforms that have an extremely low power idle state,
    which can be used to replace STR.

    The following describes how PM_SUSPEND_FREEZE state works.
    1. echo freeze > /sys/power/state
    2. the processes are frozen.
    3. all the devices are suspended.
    4. all the processors are blocked by a wait queue
    5. all the processors idles and enters (Deep) c-state.
    6. an interrupt fires.
    7. a processor is woken up and handles the irq.
    8. if it is a general event,
    a) the irq handler runs and quites.
    b) goto step 4.
    9. if it is a real wake event, say, power button pressing, keyboard touch, mouse moving,
    a) the irq handler runs and activate the wakeup source
    b) wakeup_source_activate() notifies the wait queue.
    c) system starts resuming from PM_SUSPEND_FREEZE
    10. all the devices are resumed.
    11. all the processes are unfrozen.
    12. system is back to working.

    Known Issue:
    The wakeup of this new PM_SUSPEND_FREEZE state may behave differently
    from the previous suspend state.
    Take ACPI platform for example, there are some GPEs that only enabled
    when the system is in sleep state, to wake the system backk from S3/S4.
    But we are not touching these GPEs during transition to PM_SUSPEND_FREEZE.
    This means we may lose some wake event.
    But on the other hand, as we do not disable all the Interrupts during
    PM_SUSPEND_FREEZE, we may get some extra "wakeup" Interrupts, that are
    not available for S3/S4.

    The patches has been tested on an old Sony laptop, and here are the results:

    Average Power:
    1. RPTM/idle for half an hour:
    14.8W, 12.6W, 14.1W, 12.5W, 14.4W, 13.2W, 12.9W
    2. Freeze for half an hour:
    11W, 10.4W, 9.4W, 11.3W 10.5W
    3. RTPM/idle for three hours:
    11.6W
    4. Freeze for three hours:
    10W
    5. Suspend to Memory:
    0.5~0.9W

    Average Resume Latency:
    1. RTPM/idle with a black screen: (From pressing keyboard to screen back)
    Less than 0.2s
    2. Freeze: (From pressing power button to screen back)
    2.50s
    3. Suspend to Memory: (From pressing power button to screen back)
    4.33s

    >From the results, we can see that all the platforms should benefit from
    this patch, even if it does not have Low Power S0.

    Signed-off-by: Zhang Rui
    Signed-off-by: Rafael J. Wysocki

    Zhang Rui
     

09 Aug, 2012

1 commit

  • Revert commit 45226e9 (NMI watchdog: fix for lockup detector breakage
    on resume) which breaks resume from system suspend on my SH7372
    Mackerel board (by causing a NULL pointer dereference to happen) and
    is generally wrong, because it abuses the CPU hotplug functionality
    in a shamelessly blatant way.

    The original issue should be addressed through appropriate syscore
    resume callback instead.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki