09 Dec, 2011

1 commit


07 Dec, 2011

4 commits

  • * pm-freezer: (26 commits)
    Freezer / sunrpc / NFS: don't allow TASK_KILLABLE sleeps to block the freezer
    Freezer: fix more fallout from the thaw_process rename
    freezer: fix wait_event_freezable/__thaw_task races
    freezer: kill unused set_freezable_with_signal()
    dmatest: don't use set_freezable_with_signal()
    usb_storage: don't use set_freezable_with_signal()
    freezer: remove unused @sig_only from freeze_task()
    freezer: use lock_task_sighand() in fake_signal_wake_up()
    freezer: restructure __refrigerator()
    freezer: fix set_freezable[_with_signal]() race
    freezer: remove should_send_signal() and update frozen()
    freezer: remove now unused TIF_FREEZE
    freezer: make freezing() test freeze conditions in effect instead of TIF_FREEZE
    cgroup_freezer: prepare for removal of TIF_FREEZE
    freezer: clean up freeze_processes() failure path
    freezer: kill PF_FREEZING
    freezer: test freezable conditions while holding freezer_lock
    freezer: make freezing indicate freeze condition in effect
    freezer: use dedicated lock instead of task_lock() + memory barrier
    freezer: don't distinguish nosig tasks on thaw
    ...

    Rafael J. Wysocki
     
  • The hibernation test modes 'test' and 'testproc' are deprecated, because
    the 'pm_test' framework offers much more fine-grained control for debugging
    suspend and hibernation related problems.

    So, remove the deprecated 'test' and 'testproc' hibernation test modes.

    Suggested-by: Rafael J. Wysocki
    Signed-off-by: Srivatsa S. Bhat
    Signed-off-by: Rafael J. Wysocki

    Srivatsa S. Bhat
     
  • Commit 2aede851ddf08666f68ffc17be446420e9d2a056 (PM / Hibernate: Freeze
    kernel threads after preallocating memory) moved the freezing of kernel
    threads to hibernation_snapshot() function.

    So now, if the call to hibernation_snapshot() returns early due to a
    successful hibernation test, the caller has to thaw processes to ensure
    that the system gets back to its original state.

    But in SNAPSHOT_CREATE_IMAGE hibernation ioctl, the caller does not thaw
    processes in case hibernation_snapshot() returned due to a successful
    freezer test. Fix this issue. But note we still send the value of 'in_suspend'
    (which is now 0) to userspace, because we are not in an error path per-se,
    and moreover, the value of in_suspend correctly depicts the situation here.

    Signed-off-by: Srivatsa S. Bhat
    Signed-off-by: Rafael J. Wysocki

    Srivatsa S. Bhat
     
  • In the software_resume() function defined in kernel/power/hibernate.c,
    if the call to create_basic_memory_bitmaps() fails, the usermodehelpers
    are not enabled (which had been disabled in the previous step). Fix it.

    Signed-off-by: Srivatsa S. Bhat
    Signed-off-by: Rafael J. Wysocki

    Srivatsa S. Bhat
     

24 Nov, 2011

3 commits

  • The goto statements in hibernation_snapshot() are a bit complex.
    Refactor the code to remove some of them, thereby simplifying the
    implementation.

    Signed-off-by: Srivatsa S. Bhat
    Signed-off-by: Rafael J. Wysocki

    Srivatsa S. Bhat
     
  • * 'pm-freezer' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc: (24 commits)
    freezer: fix wait_event_freezable/__thaw_task races
    freezer: kill unused set_freezable_with_signal()
    dmatest: don't use set_freezable_with_signal()
    usb_storage: don't use set_freezable_with_signal()
    freezer: remove unused @sig_only from freeze_task()
    freezer: use lock_task_sighand() in fake_signal_wake_up()
    freezer: restructure __refrigerator()
    freezer: fix set_freezable[_with_signal]() race
    freezer: remove should_send_signal() and update frozen()
    freezer: remove now unused TIF_FREEZE
    freezer: make freezing() test freeze conditions in effect instead of TIF_FREEZE
    cgroup_freezer: prepare for removal of TIF_FREEZE
    freezer: clean up freeze_processes() failure path
    freezer: kill PF_FREEZING
    freezer: test freezable conditions while holding freezer_lock
    freezer: make freezing indicate freeze condition in effect
    freezer: use dedicated lock instead of task_lock() + memory barrier
    freezer: don't distinguish nosig tasks on thaw
    freezer: remove racy clear_freeze_flag() and set PF_NOFREEZE on dead tasks
    freezer: rename thaw_process() to __thaw_task() and simplify the implementation
    ...

    Rafael J. Wysocki
     
  • The hibernation core code forgets to release memory preallocated
    for hibernation if there's an error in its early stages or if test
    modes causing hibernation_snapshot() to return early are used. This
    causes the system to be hardly usable, because the amount of
    preallocated memory is usually huge. Fix this problem.

    Reported-by: Srivatsa S. Bhat
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Srivatsa S. Bhat

    Rafael J. Wysocki
     

22 Nov, 2011

1 commit

  • freeze_processes() failure path is rather messy. Freezing is canceled
    for workqueues and tasks which aren't frozen yet but frozen tasks are
    left alone and should be thawed by the caller and of course some
    callers (xen and kexec) didn't do it.

    This patch updates __thaw_task() to handle cancelation correctly and
    makes freeze_processes() and freeze_kernel_threads() call
    thaw_processes() on failure instead so that the system is fully thawed
    on failure. Unnecessary [suspend_]thaw_processes() calls are removed
    from kernel/power/hibernate.c, suspend.c and user.c.

    While at it, restructure error checking if clause in suspend_prepare()
    to be less weird.

    -v2: Srivatsa spotted missing removal of suspend_thaw_processes() in
    suspend_prepare() and error in commit message. Updated.

    Signed-off-by: Tejun Heo
    Acked-by: Srivatsa S. Bhat

    Tejun Heo
     

19 Nov, 2011

1 commit

  • Commit 2aede851ddf08666f68ffc17be446420e9d2a056
    (PM / Hibernate: Freeze kernel threads after preallocating memory)
    postponed the freezing of kernel threads to after preallocating memory
    for hibernation. But while doing that, the hibernation test TEST_FREEZER
    and the test mode HIBERNATION_TESTPROC were not moved accordingly.

    As a result, when using these test modes, it only goes upto the freezing of
    userspace and exits, when in fact it should go till the complete end of task
    freezing stage, namely the freezing of kernel threads as well.

    So, move these points of exit to appropriate places so that freezing of
    kernel threads is also tested while using these test harnesses.

    Signed-off-by: Srivatsa S. Bhat
    Signed-off-by: Rafael J. Wysocki

    Srivatsa S. Bhat
     

01 Nov, 2011

1 commit


17 Oct, 2011

6 commits

  • Use threads for LZO compression/decompression on hibernate/thaw.
    Improve buffering on hibernate/thaw.
    Calculate/verify CRC32 of the image pages on hibernate/thaw.

    In my testing, this improved write/read speed by a factor of about two.

    Signed-off-by: Bojan Smojver
    Signed-off-by: Rafael J. Wysocki

    Bojan Smojver
     
  • Static and extern variables in kernel/power/hibernate.c need not be
    initialized to 0 explicitly, so remove those initializations.

    [rjw: Modified subject, added changelog.]

    Signed-off-by: Barry Song
    Signed-off-by: Rafael J. Wysocki

    Barry Song
     
  • Patch "PM / Hibernate: Add resumewait param to support MMC-like
    devices as resume file" added the resumewait kernel command line
    option. The present patch adds resumedelay so that
    resumewait/delay were analogous to rootwait/delay.

    [rjw: Modified the subject and changelog slightly.]

    Signed-off-by: Barry Song
    Acked-by: Pavel Machek
    Signed-off-by: Rafael J. Wysocki

    Barry Song
     
  • Some devices like MMC are async detected very slow. For example,
    drivers/mmc/host/sdhci.c launches a 200ms delayed work to detect
    MMC partitions then add disk.

    We have wait_for_device_probe() and scsi_complete_async_scans()
    before calling swsusp_check(), but it is not enough to wait for MMC.

    This patch adds resumewait kernel param just like rootwait so
    that we have enough time to wait until MMC is ready. The difference is
    that we wait for resume partition whereas rootwait waits for rootfs
    partition (which may be on a different device).

    This patch will make hibernation support many embedded products
    without SCSI devices, but with devices like MMC.

    [rjw: Modified the changelog slightly.]

    Signed-off-by: Barry Song
    Reviewed-by: Valdis Kletnieks
    Signed-off-by: Rafael J. Wysocki

    Barry Song
     
  • Fix a typo in a function name in the kerneldoc comment next to
    resume_target_kernel().

    [rjw: Changed the subject slightly, added the changelog.]

    Signed-off-by: Barry Song
    Signed-off-by: Rafael J. Wysocki

    Barry Song
     
  • There is a problem with the current ordering of hibernate code which
    leads to deadlocks in some filesystems' memory shrinkers. Namely,
    some filesystems use freezable kernel threads that are inactive when
    the hibernate memory preallocation is carried out. Those same
    filesystems use memory shrinkers that may be triggered by the
    hibernate memory preallocation. If those memory shrinkers wait for
    the frozen kernel threads, the hibernate process deadlocks (this
    happens with XFS, for one example).

    Apparently, it is not technically viable to redesign the filesystems
    in question to avoid the situation described above, so the only
    possible solution of this issue is to defer the freezing of kernel
    threads until the hibernate memory preallocation is done, which is
    implemented by this change.

    Unfortunately, this requires the memory preallocation to be done
    before the "prepare" stage of device freeze, so after this change the
    only way drivers can allocate additional memory for their freeze
    routines in a clean way is to use PM notifiers.

    Reported-by: Christoph
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

25 May, 2011

2 commits


24 May, 2011

1 commit


18 May, 2011

3 commits

  • If device drivers allocate substantial amounts of memory (above 1 MB)
    in their hibernate .freeze() callbacks (or in their legacy suspend
    callbcks during hibernation), the subsequent creation of hibernate
    image may fail due to the lack of memory. This is the case, because
    the drivers' .freeze() callbacks are executed after the hibernate
    memory preallocation has been carried out and the preallocated amount
    of memory may be too small to cover the new driver allocations.
    Unfortunately, the drivers' .prepare() callbacks also are executed
    after the hibernate memory preallocation has completed, so they are
    not suitable for allocating additional memory either. Thus the only
    way a driver can safely allocate memory during hibernation is to use
    a hibernate/suspend notifier. However, the notifiers are called
    before the freezing of user space and the drivers wanting to use them
    for allocating additional memory may not know how much memory needs
    to be allocated at that point.

    To let device drivers overcome this difficulty rework the hibernation
    sequence so that the memory preallocation is carried out after the
    drivers' .prepare() callbacks have been executed, so that the
    .prepare() callbacks can be used for allocating additional memory
    to be used by the drivers' .freeze() callbacks. Update documentation
    to match the new behavior of the code.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • * syscore:
    PM: Remove sysdev suspend, resume and shutdown operations
    PM / PowerPC: Use struct syscore_ops instead of sysdevs for PM
    PM / UNICORE32: Use struct syscore_ops instead of sysdevs for PM
    PM / AVR32: Use struct syscore_ops instead of sysdevs for PM
    PM / Blackfin: Use struct syscore_ops instead of sysdevs for PM
    ARM / Samsung: Use struct syscore_ops for "core" power management
    ARM / PXA: Use struct syscore_ops for "core" power management
    ARM / SA1100: Use struct syscore_ops for "core" power management
    ARM / Integrator: Use struct syscore_ops for core PM
    ARM / OMAP: Use struct syscore_ops for "core" power management
    ARM: Use struct syscore_ops instead of sysdevs for PM in common code

    Rafael J. Wysocki
     
  • Martin reports that on his system hibernation occasionally fails due
    to the lack of memory, because the radeon driver apparently allocates
    too much of it during the device freeze stage. It turns out that the
    amount of memory allocated by radeon during hibernation (and
    presumably during system suspend too) depends on the utilization of
    the GPU (e.g. hibernating while there are two KDE 4 sessions with
    compositing enabled causes radeon to allocate more memory than for
    one KDE 4 session).

    In principle it should be possible to use image_size to make the
    memory preallocation mechanism free enough memory for the radeon
    driver, but in practice it is not easy to guess the right value
    because of the way the preallocation code uses image_size. For this
    reason, it seems reasonable to allow users to control the amount of
    memory reserved for driver allocations made after the hibernate
    preallocation, which currently is constant and amounts to 1 MB.

    Introduce a new sysfs file, /sys/power/reserved_size, whose value
    will be used as the amount of memory to reserve for the
    post-preallocation reservations made by device drivers, in bytes.
    For backwards compatibility, set its default (and initial) value to
    the currently used number (1 MB).

    References: https://bugzilla.kernel.org/show_bug.cgi?id=34102
    Reported-and-tested-by: Martin Steigerwald
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

12 May, 2011

1 commit

  • Since suspend, resume and shutdown operations in struct sysdev_class
    and struct sysdev_driver are not used any more, remove them. Also
    drop sysdev_suspend(), sysdev_resume() and sysdev_shutdown() used
    for executing those operations and modify all of their users
    accordingly. This reduces kernel code size quite a bit and reduces
    its complexity.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

19 Apr, 2011

1 commit


15 Mar, 2011

1 commit

  • Some subsystems need to carry out suspend/resume and shutdown
    operations with one CPU on-line and interrupts disabled. The only
    way to register such operations is to define a sysdev class and
    a sysdev specifically for this purpose which is cumbersome and
    inefficient. Moreover, the arguments taken by sysdev suspend,
    resume and shutdown callbacks are practically never necessary.

    For this reason, introduce a simpler interface allowing subsystems
    to register operations to be executed very late during system suspend
    and shutdown and very early during resume in the form of
    strcut syscore_ops objects.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

14 Jan, 2011

1 commit

  • * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits)
    Documentation/trace/events.txt: Remove obsolete sched_signal_send.
    writeback: fix global_dirty_limits comment runtime -> real-time
    ppc: fix comment typo singal -> signal
    drivers: fix comment typo diable -> disable.
    m68k: fix comment typo diable -> disable.
    wireless: comment typo fix diable -> disable.
    media: comment typo fix diable -> disable.
    remove doc for obsolete dynamic-printk kernel-parameter
    remove extraneous 'is' from Documentation/iostats.txt
    Fix spelling milisec -> ms in snd_ps3 module parameter description
    Fix spelling mistakes in comments
    Revert conflicting V4L changes
    i7core_edac: fix typos in comments
    mm/rmap.c: fix comment
    sound, ca0106: Fix assignment to 'channel'.
    hrtimer: fix a typo in comment
    init/Kconfig: fix typo
    anon_inodes: fix wrong function name in comment
    fix comment typos concerning "consistent"
    poll: fix a typo in comment
    ...

    Fix up trivial conflicts in:
    - drivers/net/wireless/iwlwifi/iwl-core.c (moved to iwl-legacy.c)
    - fs/ext4/ext4.h

    Also fix missed 'diabled' typo in drivers/net/bnx2x/bnx2x.h while at it.

    Linus Torvalds
     

24 Dec, 2010

3 commits

  • To avoid confusion with the meaning and return value of
    pm_check_wakeup_events() replace it with pm_wakeup_pending() that
    will work the other way around (ie. return true when system-wide
    power transition should be aborted).

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • When hibernation failed due to an error in swsusp_write() called by
    hibernate(), it skips calling "power_down()" and returns. When
    hibernate() is called again (probably after fixing up so that
    swsusp_write() wouldn't fail again), before "in_suspend = 1" of
    create_image is called, in_suspend should be 0. However, because
    hibernate() did not reset "in_suspend" after a failure, it's already 1.

    This patch fixes such inconsistency of "in_suspend" value.

    Signed-off-by: MyungJoo Ham
    Signed-off-by: Kyungmin Park
    Signed-off-by: Rafael J. Wysocki

    MyungJoo Ham
     
  • Because hibernate calls hibernation_ops->leave() without checking
    whether hibernation_ops->leave is NULL or not, hiberantion_set_ops
    should WARN_ON if hibernation_ops->leave is NULL.

    This patch added one more condition to check hibernation_ops->leave.

    Signed-off-by: MyungJoo Ham
    Signed-off-by: Kyungmin Park
    Acked-by: Pavel Machek
    Signed-off-by: Rafael J. Wysocki

    MyungJoo Ham
     

23 Dec, 2010

1 commit


07 Dec, 2010

1 commit

  • There is a problem that swap pages allocated before the creation of
    a hibernation image can be released and used for storing the contents
    of different memory pages while the image is being saved. Since the
    kernel stored in the image doesn't know of that, it causes memory
    corruption to occur after resume from hibernation, especially on
    systems with relatively small RAM that need to swap often.

    This issue can be addressed by keeping the GFP_IOFS bits clear
    in gfp_allowed_mask during the entire hibernation, including the
    saving of the image, until the system is finally turned off or
    the hibernation is aborted. Unfortunately, for this purpose
    it's necessary to rework the way in which the hibernate and
    suspend code manipulates gfp_allowed_mask.

    This change is based on an earlier patch from Hugh Dickins.

    Signed-off-by: Rafael J. Wysocki
    Reported-by: Ondrej Zary
    Acked-by: Hugh Dickins
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: stable@kernel.org

    Rafael J. Wysocki
     

16 Nov, 2010

1 commit


17 Oct, 2010

2 commits

  • The hibernate resume code checks if there is an image to resume from
    on every boot and, if the kernel is built with CONFIG_PM_DEBUG set
    and the image is not present, it prints some scary messages
    suggesting there was a boot error of some sort. Apparently, some
    users are confused by them, so make them look less scary and adjust
    the other hibernate resume debug messages to match them.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Compress hibernation image with LZO in order to save on I/O and
    therefore time to hibernate/thaw.

    [rjw: Added hibernate=nocompress command line option instead of just
    nocompress which would be confusing, fixed a couple of compiler
    warnings, fixed kerneldoc comments, minor cleanups.]

    Signed-off-by: Bojan Smojver
    Signed-off-by: Rafael J. Wysocki

    Bojan Smojver
     

10 Sep, 2010

1 commit

  • Please revert 2.6.36-rc commit d2997b1042ec150616c1963b5e5e919ffd0b0ebf
    "hibernation: freeze swap at hibernation". It complicated matters by
    adding a second swap allocation path, just for hibernation; without in any
    way fixing the issue that it was intended to address - page reclaim after
    fixing the hibernation image might free swap from a page already imaged as
    swapcache, letting its swap be reallocated to store a different page of
    the image: resulting in data corruption if the imaged page were freed as
    clean then swapped back in. Pages freed to si->swap_map were still in
    danger of being reallocated by the alternative allocation path.

    I guess it inadvertently fixed slow SSD swap allocation for hibernation,
    as reported by Nigel Cunningham: by missing out the discards that occur on
    the usual swap allocation path; but that was unintentional, and needs a
    separate fix.

    Signed-off-by: Hugh Dickins
    Cc: KAMEZAWA Hiroyuki
    Cc: KOSAKI Motohiro
    Cc: "Rafael J. Wysocki"
    Cc: Ondrej Zary
    Cc: Andrea Gelmini
    Cc: Balbir Singh
    Cc: Andrea Arcangeli
    Cc: Nigel Cunningham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hugh Dickins
     

10 Aug, 2010

1 commit

  • When taking a memory snapshot in hibernate_snapshot(), all (directly
    called) memory allocations use GFP_ATOMIC. Hence swap misusage during
    hibernation never occurs.

    But from a pessimistic point of view, there is no guarantee that no page
    allcation has __GFP_WAIT. It is better to have a global indication "we
    enter hibernation, don't use swap!".

    This patch tries to freeze new-swap-allocation during hibernation. (All
    user processes are frozenm so swapin is not a concern).

    This way, no updates will happen to swap_map[] between
    hibernate_snapshot() and save_image(). Swap is thawed when swsusp_free()
    is called. We can be assured that swap corruption will not occur.

    Signed-off-by: KAMEZAWA Hiroyuki
    Cc: "Rafael J. Wysocki"
    Cc: Hugh Dickins
    Cc: KOSAKI Motohiro
    Cc: Ondrej Zary
    Cc: Balbir Singh
    Cc: Andrea Arcangeli
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KAMEZAWA Hiroyuki
     

05 Aug, 2010

1 commit

  • * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (48 commits)
    Documentation: update broken web addresses.
    fix comment typo "choosed" -> "chosen"
    hostap:hostap_hw.c Fix typo in comment
    Fix spelling contorller -> controller in comments
    Kconfig.debug: FAIL_IO_TIMEOUT: typo Faul -> Fault
    fs/Kconfig: Fix typo Userpace -> Userspace
    Removing dead MACH_U300_BS26
    drivers/infiniband: Remove unnecessary casts of private_data
    fs/ocfs2: Remove unnecessary casts of private_data
    libfc: use ARRAY_SIZE
    scsi: bfa: use ARRAY_SIZE
    drm: i915: use ARRAY_SIZE
    drm: drm_edid: use ARRAY_SIZE
    synclink: use ARRAY_SIZE
    block: cciss: use ARRAY_SIZE
    comment typo fixes: charater => character
    fix comment typos concerning "challenge"
    arm: plat-spear: fix typo in kerneldoc
    reiserfs: typo comment fix
    update email address
    ...

    Linus Torvalds
     

19 Jul, 2010

2 commits

  • pavel@suse.cz no longer works, replace it with working address.

    Signed-off-by: Pavel Machek
    Signed-off-by: Jiri Kosina

    Pavel Machek
     
  • There is an inconsistency between hibernation_platform_enter()
    and hibernation_snapshot(), because the latter calls
    hibernation_ops->end() after failing hibernation_ops->begin(), while
    the former doesn't do that. Make hibernation_snapshot() behave in
    the same way as hibernation_platform_enter() in that respect.

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

    Rafael J. Wysocki