22 Feb, 2013

1 commit

  • Pull driver core patches from Greg Kroah-Hartman:
    "Here is the big driver core merge for 3.9-rc1

    There are two major series here, both of which touch lots of drivers
    all over the kernel, and will cause you some merge conflicts:

    - add a new function called devm_ioremap_resource() to properly be
    able to check return values.

    - remove CONFIG_EXPERIMENTAL

    Other than those patches, there's not much here, some minor fixes and
    updates"

    Fix up trivial conflicts

    * tag 'driver-core-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (221 commits)
    base: memory: fix soft/hard_offline_page permissions
    drivercore: Fix ordering between deferred_probe and exiting initcalls
    backlight: fix class_find_device() arguments
    TTY: mark tty_get_device call with the proper const values
    driver-core: constify data for class_find_device()
    firmware: Ignore abort check when no user-helper is used
    firmware: Reduce ifdef CONFIG_FW_LOADER_USER_HELPER
    firmware: Make user-mode helper optional
    firmware: Refactoring for splitting user-mode helper code
    Driver core: treat unregistered bus_types as having no devices
    watchdog: Convert to devm_ioremap_resource()
    thermal: Convert to devm_ioremap_resource()
    spi: Convert to devm_ioremap_resource()
    power: Convert to devm_ioremap_resource()
    mtd: Convert to devm_ioremap_resource()
    mmc: Convert to devm_ioremap_resource()
    mfd: Convert to devm_ioremap_resource()
    media: Convert to devm_ioremap_resource()
    iommu: Convert to devm_ioremap_resource()
    drm: Convert to devm_ioremap_resource()
    ...

    Linus Torvalds
     

10 Feb, 2013

2 commits

  • At present, the value of timeout for freezing is 20s, which is
    meaningless in case that one thread is frozen with mutex locked
    and another thread is trying to lock the mutex, as this time of
    freezing will fail unavoidably.
    And if there is no new wakeup event registered, the system will
    waste at most 20s for such meaningless trying of freezing.

    With this patch, the value of timeout can be configured to smaller
    value, so such meaningless trying of freezing will be aborted in
    earlier time, and later freezing can be also triggered in earlier
    time. And more power will be saved.
    In normal case on mobile phone, it costs real little time to freeze
    processes. On some platform, it only costs about 20ms to freeze
    user space processes and 10ms to freeze kernel freezable threads.

    Signed-off-by: Liu Chuansheng
    Signed-off-by: Li Fei
    Signed-off-by: Rafael J. Wysocki

    Li Fei
     
  • 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
     

07 Feb, 2013

1 commit

  • All in-kernel users of class_find_device() don't really need mutable
    data for match callback.

    In two places (kernel/power/suspend_test.c, drivers/scsi/osd/osd_uld.c)
    this patch changes match callbacks to use const search data.

    The const is propagated to rtc_class_open() and power_supply_get_by_name()
    parameters.

    Note that there's a dev reference leak in suspend_test.c that's not
    touched in this patch.

    Signed-off-by: Michał Mirosław
    Acked-by: Grant Likely
    Signed-off-by: Greg Kroah-Hartman

    Michał Mirosław
     

26 Jan, 2013

1 commit


13 Dec, 2012

1 commit

  • Pull cgroup changes from Tejun Heo:
    "A lot of activities on cgroup side. The big changes are focused on
    making cgroup hierarchy handling saner.

    - cgroup_rmdir() had peculiar semantics - it allowed cgroup
    destruction to be vetoed by individual controllers and tried to
    drain refcnt synchronously. The vetoing never worked properly and
    caused good deal of contortions in cgroup. memcg was the last
    reamining user. Michal Hocko removed the usage and cgroup_rmdir()
    path has been simplified significantly. This was done in a
    separate branch so that the memcg people can base further memcg
    changes on top.

    - The above allowed cleaning up cgroup lifecycle management and
    implementation of generic cgroup iterators which are used to
    improve hierarchy support.

    - cgroup_freezer updated to allow migration in and out of a frozen
    cgroup and handle hierarchy. If a cgroup is frozen, all descendant
    cgroups are frozen.

    - netcls_cgroup and netprio_cgroup updated to handle hierarchy
    properly.

    - Various fixes and cleanups.

    - Two merge commits. One to pull in memcg and rmdir cleanups (needed
    to build iterators). The other pulled in cgroup/for-3.7-fixes for
    device_cgroup fixes so that further device_cgroup patches can be
    stacked on top."

    Fixed up a trivial conflict in mm/memcontrol.c as per Tejun (due to
    commit bea8c150a7 ("memcg: fix hotplugged memory zone oops") in master
    touching code close to commit 2ef37d3fe4 ("memcg: Simplify
    mem_cgroup_force_empty_list error handling") in for-3.8)

    * 'for-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: (65 commits)
    cgroup: update Documentation/cgroups/00-INDEX
    cgroup_rm_file: don't delete the uncreated files
    cgroup: remove subsystem files when remounting cgroup
    cgroup: use cgroup_addrm_files() in cgroup_clear_directory()
    cgroup: warn about broken hierarchies only after css_online
    cgroup: list_del_init() on removed events
    cgroup: fix lockdep warning for event_control
    cgroup: move list add after list head initilization
    netprio_cgroup: allow nesting and inherit config on cgroup creation
    netprio_cgroup: implement netprio[_set]_prio() helpers
    netprio_cgroup: use cgroup->id instead of cgroup_netprio_state->prioidx
    netprio_cgroup: reimplement priomap expansion
    netprio_cgroup: shorten variable names in extend_netdev_table()
    netprio_cgroup: simplify write_priomap()
    netcls_cgroup: move config inheritance to ->css_online() and remove .broken_hierarchy marking
    cgroup: remove obsolete guarantee from cgroup_task_migrate.
    cgroup: add cgroup->id
    cgroup, cpuset: remove cgroup_subsys->post_clone()
    cgroup: s/CGRP_CLONE_CHILDREN/CGRP_CPUSET_CLONE_CHILDREN/
    cgroup: rename ->create/post_create/pre_destroy/destroy() to ->css_alloc/online/offline/free()
    ...

    Linus Torvalds
     

30 Nov, 2012

1 commit

  • * pm-sleep:
    PM / Freezer: Fixup compile error of try_to_freeze_nowarn()
    driver core / PM: move the calling to device_pm_remove behind the calling to bus_remove_device
    PM / Hibernate: use rb_entry
    PM / sysfs: replace strict_str* with kstrto*

    Rafael J. Wysocki
     

15 Nov, 2012

2 commits


27 Oct, 2012

1 commit

  • try_to_freeze_tasks() and cgroup_freezer rely on scheduler locks
    to ensure that a task doing STOPPED/TRACED -> RUNNING transition
    can't escape freezing. This mostly works, but ptrace_stop() does
    not necessarily call schedule(), it can change task->state back to
    RUNNING and check freezing() without any lock/barrier in between.

    We could add the necessary barrier, but this patch changes
    ptrace_stop() and do_signal_stop() to use freezable_schedule().
    This fixes the race, freezer_count() and freezer_should_skip()
    carefully avoid the race.

    And this simplifies the code, try_to_freeze_tasks/update_if_frozen
    no longer need to use task_is_stopped_or_traced() checks with the
    non trivial assumptions. We can rely on the mechanism which was
    specially designed to mark the sleeping task as "frozen enough".

    v2: As Tejun pointed out, we can also change get_signal_to_deliver()
    and move try_to_freeze() up before 'relock' label.

    Signed-off-by: Oleg Nesterov
    Signed-off-by: Tejun Heo

    Oleg Nesterov
     

23 Oct, 2012

1 commit

  • Introduce struct pm_qos_flags_request and struct pm_qos_flags
    representing PM QoS flags request type and PM QoS flags constraint
    type, respectively. With these definitions the data structures
    will be arranged so that the list member of a struct pm_qos_flags
    object will contain the head of a list of struct pm_qos_flags_request
    objects representing all of the "flags" requests present for the
    given device. Then, the effective_flags member of a struct
    pm_qos_flags object will contain the bitwise OR of the flags members
    of all the struct pm_qos_flags_request objects in the list.

    Additionally, introduce helper function pm_qos_update_flags()
    allowing the caller to manage the list of struct pm_qos_flags_request
    pointed to by the list member of struct pm_qos_flags.

    The flags are of type s32 so that the request's "value" field
    is always of the same type regardless of what kind of request it
    is (latency requests already have value fields of type s32).

    Signed-off-by: Rafael J. Wysocki
    Reviewed-by: Jean Pihet
    Acked-by: mark gross

    Rafael J. Wysocki
     

18 Sep, 2012

2 commits


11 Sep, 2012

1 commit


08 Sep, 2012

1 commit


04 Sep, 2012

1 commit

  • Introduce function pm_genpd_syscore_switch() and two wrappers around
    it, pm_genpd_syscore_poweroff() and pm_genpd_syscore_poweron(),
    allowing the callers to let the generic PM domains framework know
    that the given device is not necessary any more and its PM domain
    can be turned off (the former) or that the given device will be
    required immediately, so its PM domain has to be turned on (the
    latter) during the system core (syscore) stage of system suspend
    (or hibernation) and resume.

    These functions will be used for handling devices registered as
    clock sources and clock event devices that belong to PM domains.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

23 Aug, 2012

1 commit


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
     

31 Jul, 2012

1 commit

  • On the suspend/resume path the boot CPU does not go though an
    offline->online transition. This breaks the NMI detector post-resume
    since it depends on PMU state that is lost when the system gets
    suspended.

    Fix this by forcing a CPU offline->online transition for the lockup
    detector on the boot CPU during resume.

    To provide more context, we enable NMI watchdog on Chrome OS. We have
    seen several reports of systems freezing up completely which indicated
    that the NMI watchdog was not firing for some reason.

    Debugging further, we found a simple way of repro'ing system freezes --
    issuing the command 'tasket 1 sh -c "echo nmilockup > /proc/breakme"'
    after the system has been suspended/resumed one or more times.

    With this patch in place, the system freeze result in panics, as
    expected.

    These panics provide a nice stack trace for us to debug the actual issue
    causing the freeze.

    [akpm@linux-foundation.org: fiddle with code comment]
    [akpm@linux-foundation.org: make lockup_detector_bootcpu_resume() conditional on CONFIG_SUSPEND]
    [akpm@linux-foundation.org: fix section errors]
    Signed-off-by: Sameer Nanda
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: "Rafael J. Wysocki"
    Cc: Don Zickus
    Cc: Mandeep Singh Baines
    Cc: Srivatsa S. Bhat
    Cc: Anshuman Khandual
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sameer Nanda
     

23 Jul, 2012

1 commit

  • Pull power management updates from Rafael Wysocki:

    - ACPI conversion to PM handling based on struct dev_pm_ops.
    - Conversion of a number of platform drivers to PM handling based on
    struct dev_pm_ops and removal of empty legacy PM callbacks from a
    couple of PCI drivers.
    - Suspend-to-both for in-kernel hibernation from Bojan Smojver.
    - cpuidle fixes and cleanups from ShuoX Liu, Daniel Lezcano and Preeti
    Murthy.
    - cpufreq bug fixes from Jonghwa Lee and Stephen Boyd.
    - Suspend and hibernate fixes from Srivatsa Bhat and Colin Cross.
    - Generic PM domains framework updates.
    - RTC CMOS wakeup signaling update from Paul Fox.
    - sparse warnings fixes from Sachin Kamat.
    - Build warnings fixes for the generic PM domains framework and PM
    sysfs code.
    - sysfs switch for printing device suspend times from Sameer Nanda.
    - Documentation fix from Oskar Schirmer.

    * tag 'pm-for-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (70 commits)
    cpufreq: Fix sysfs deadlock with concurrent hotplug/frequency switch
    EXYNOS: bugfix on retrieving old_index from freqs.old
    PM / Sleep: call early resume handlers when suspend_noirq fails
    PM / QoS: Use NULL pointer instead of plain integer in qos.c
    PM / QoS: Use NULL pointer instead of plain integer in pm_qos.h
    PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock
    PM / Sleep: Add missing static storage class specifiers in main.c
    cpuilde / ACPI: remove time from acpi_processor_cx structure
    cpuidle / ACPI: remove usage from acpi_processor_cx structure
    cpuidle / ACPI : remove latency_ticks from acpi_processor_cx structure
    rtc-cmos: report wakeups from interrupt handler
    PM / Sleep: Fix build warning in sysfs.c for CONFIG_PM_SLEEP unset
    PM / Domains: Fix build warning for CONFIG_PM_RUNTIME unset
    olpc-xo15-sci: Use struct dev_pm_ops for power management
    PM / Domains: Replace plain integer with NULL pointer in domain.c file
    PM / Domains: Add missing static storage class specifier in domain.c file
    PM / crypto / ux500: Use struct dev_pm_ops for power management
    PM / IPMI: Remove empty legacy PCI PM callbacks
    tpm_nsc: Use struct dev_pm_ops for power management
    tpm_tis: Use struct dev_pm_ops for power management
    ...

    Linus Torvalds
     

19 Jul, 2012

2 commits

  • Commit a7a20d103994 ("sd: limit the scope of the async probe domain")
    make the SCSI device probing run device discovery in it's own async
    domain.

    However, as a result, the partition detection was no longer synchronized
    by async_synchronize_full() (which, despite the name, only synchronizes
    the global async space, not all of them). Which in turn meant that
    "wait_for_device_probe()" would not wait for the SCSI partitions to be
    parsed.

    And "wait_for_device_probe()" was what the boot time init code relied on
    for mounting the root filesystem.

    Now, most people never noticed this, because not only is it
    timing-dependent, but modern distributions all use initrd. So the root
    filesystem isn't actually on a disk at all. And then before they
    actually mount the final disk filesystem, they will have loaded the
    scsi-wait-scan module, which not only does the expected
    wait_for_device_probe(), but also does scsi_complete_async_scans().

    [ Side note: scsi_complete_async_scans() had also been partially broken,
    but that was fixed in commit 43a8d39d0137 ("fix async probe
    regression"), so that same commit a7a20d103994 had actually broken
    setups even if you used scsi-wait-scan explicitly ]

    Solve this problem by just moving the scsi_complete_async_scans() call
    into wait_for_device_probe(). Everybody who wants to wait for device
    probing to finish really wants the SCSI probing to complete, so there's
    no reason not to do this.

    So now "wait_for_device_probe()" really does what the name implies, and
    properly waits for device probing to finish. This also removes the now
    unnecessary extra calls to scsi_complete_async_scans().

    Reported-and-tested-by: Artem S. Tashkinov
    Cc: Dan Williams
    Cc: Alan Stern
    Cc: James Bottomley
    Cc: Borislav Petkov
    Cc: linux-scsi
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • Require processes wanting to use the wake_lock/wake_unlock sysfs
    files to have the CAP_BLOCK_SUSPEND capability, which also is
    required for the eventpoll EPOLLWAKEUP flag to be effective, so that
    all interfaces related to blocking autosleep depend on the same
    capability.

    Signed-off-by: Rafael J. Wysocki
    Cc: stable@vger.kernel.org
    Acked-by: Michael Kerrisk

    Rafael J. Wysocki
     

01 Jul, 2012

5 commits

  • With the introduction of suspend to both into in-kernel hibernation
    code, dmesg was getting polluted with backspace characters printed as
    part of image saving progress indicator. This patch introduces printing
    of progress indicator on image save/load every 10% and one line at a
    time. As an additional benefit, all other messages emitted by the kernel
    during hibernation/thaw should now print cleanly as well.

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

    Bojan Smojver
     
  • Change the behavior of the newly introduced
    /sys/power/pm_print_times attribute so that its initial value
    depends on initcall_debug, but setting it to 0 will cause device
    suspend/resume times not to be printed, even if initcall_debug has
    been set. This way, the people who use initcall_debug for reasons
    other than PM debugging will be able to switch the suspend/resume
    times printing off, if need be.

    Signed-off-by: Rafael J. Wysocki
    Reviewed-by: Srivatsa S. Bhat
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     
  • Added a new knob called /sys/power/pm_print_times. Setting it to 1
    enables printing of time taken by devices to suspend and resume.
    Setting it to 0 disables this printing (unless overridden by
    initcall_debug kernel command line option).

    Signed-off-by: Sameer Nanda
    Acked-by: Greg KH
    Signed-off-by: Rafael J. Wysocki

    Sameer Nanda
     
  • If function tracing is enabled for some of the low-level suspend/resume
    functions, it leads to triple fault during resume from suspend, ultimately
    ending up in a reboot instead of a resume (or a total refusal to come out
    of suspended state, on some machines).

    This issue was explained in more detail in commit f42ac38c59e0a03d (ftrace:
    disable tracing for suspend to ram). However, the changes made by that commit
    got reverted by commit cbe2f5a6e84eebb (tracing: allow tracing of
    suspend/resume & hibernation code again). So, unfortunately since things are
    not yet robust enough to allow tracing of low-level suspend/resume functions,
    suspend/resume is still broken when ftrace is enabled.

    So fix this by disabling function tracing during suspend/resume & hibernation.

    Signed-off-by: Srivatsa S. Bhat
    Cc: stable@vger.kernel.org
    Signed-off-by: Rafael J. Wysocki

    Srivatsa S. Bhat
     
  • It is often useful to suspend to memory after hibernation image has been
    written to disk. If the battery runs out or power is otherwise lost, the
    computer will resume from the hibernated image. If not, it will resume
    from memory and hibernation image will be discarded.

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

    Bojan Smojver
     

19 May, 2012

1 commit


12 May, 2012

2 commits


06 May, 2012

1 commit


02 May, 2012

4 commits

  • Android allows user space to manipulate wakelocks using two
    sysfs file located in /sys/power/, wake_lock and wake_unlock.
    Writing a wakelock name and optionally a timeout to the wake_lock
    file causes the wakelock whose name was written to be acquired (it
    is created before is necessary), optionally with the given timeout.
    Writing the name of a wakelock to wake_unlock causes that wakelock
    to be released.

    Implement an analogous interface for user space using wakeup sources.
    Add the /sys/power/wake_lock and /sys/power/wake_unlock files
    allowing user space to create, activate and deactivate wakeup
    sources, such that writing a name and optionally a timeout to
    wake_lock causes the wakeup source of that name to be activated,
    optionally with the given timeout. If that wakeup source doesn't
    exist, it will be created and then activated. Writing a name to
    wake_unlock causes the wakeup source of that name, if there is one,
    to be deactivated. Wakeup sources created with the help of
    wake_lock that haven't been used for more than 5 minutes are garbage
    collected and destroyed. Moreover, there can be only WL_NUMBER_LIMIT
    wakeup sources created with the help of wake_lock present at a time.

    The data type used to track wakeup sources created by user space is
    called "struct wakelock" to indicate the origins of this feature.

    This version of the patch includes an rbtree manipulation fix from John Stultz.

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

    Rafael J. Wysocki
     
  • Android uses one wakelock statistics that is only necessary for
    opportunistic sleep. Namely, the prevent_suspend_time field
    accumulates the total time the given wakelock has been locked
    while "automatic suspend" was enabled. Add an analogous field,
    prevent_sleep_time, to wakeup sources and make it behave in a similar
    way.

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

    Rafael J. Wysocki
     
  • Introduce a mechanism by which the kernel can trigger global
    transitions to a sleep state chosen by user space if there are no
    active wakeup sources.

    It consists of a new sysfs attribute, /sys/power/autosleep, that
    can be written one of the strings returned by reads from
    /sys/power/state, an ordered workqueue and a work item carrying out
    the "suspend" operations. If a string representing the system's
    sleep state is written to /sys/power/autosleep, the work item
    triggering transitions to that state is queued up and it requeues
    itself after every execution until user space writes "off" to
    /sys/power/autosleep.

    That work item enables the detection of wakeup events using the
    functions already defined in drivers/base/power/wakeup.c (with one
    small modification) and calls either pm_suspend(), or hibernate() to
    put the system into a sleep state. If a wakeup event is reported
    while the transition is in progress, it will abort the transition and
    the "system suspend" work item will be queued up again.

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

    Rafael J. Wysocki
     
  • 1. Do not allocate memory for buffers from emergency pools, unless
    absolutely required. Do not warn about and do not retry non-essential
    failed allocations.

    2. Do not check the amount of free pages left on every single page
    write, but wait until one map is completely populated and then check.

    3. Set maximum number of pages for read buffering consistently, instead
    of inadvertently depending on the size of the sector type.

    4. Fix copyright line, which I missed when I submitted the hibernation
    threading patch.

    5. Dispense with bit shifting arithmetic to improve readability.

    6. Really recalculate the number of pages required to be free after all
    allocations have been done.

    7. Fix calculation of pages required for read buffering. Only count in
    pages that do not belong to high memory.

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

    Bojan Smojver
     

25 Apr, 2012

1 commit

  • Hibernation regression fix, since 3.2.

    Calculate the number of required free pages based on non-high memory
    pages only, because that is where the buffers will come from.

    Commit 081a9d043c983f161b78fdc4671324d1342b86bc introduced a new buffer
    page allocation logic during hibernation, in order to improve the
    performance. The amount of pages allocated was calculated based on total
    amount of pages available, although only non-high memory pages are
    usable for this purpose. This caused hibernation code to attempt to over
    allocate pages on platforms that have high memory, which led to hangs.

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

    Bojan Smojver
     

29 Mar, 2012

4 commits

  • The new API, pm_qos_update_request_timeout() is to provide a timeout
    with pm_qos_update_request.

    For example, pm_qos_update_request_timeout(req, 100, 1000), means that
    QoS request on req with value 100 will be active for 1000 microseconds.
    After 1000 microseconds, the QoS request thru req is reset. If there
    were another pm_qos_update_request(req, x) during the 1000 us, this
    new request with value x will override as this is another request on the
    same req handle. A new request on the same req handle will always
    override the previous request whether it is the conventional request or
    it is the new timeout request.

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

    MyungJoo Ham
     
  • There is a race condition between the freezer and request_firmware()
    such that if request_firmware() is run on one CPU and
    freeze_processes() is run on another CPU and usermodehelper_disable()
    called by it succeeds to grab umhelper_sem for writing before
    usermodehelper_read_trylock() called from request_firmware()
    acquires it for reading, the request_firmware() will fail and
    trigger a WARN_ON() complaining that it was called at a wrong time.
    However, in fact, it wasn't called at a wrong time and
    freeze_processes() simply happened to be executed simultaneously.

    To avoid this race, at least in some cases, modify
    usermodehelper_read_trylock() so that it doesn't fail if the
    freezing of tasks has just started and hasn't been completed yet.
    Instead, during the freezing of tasks, it will try to freeze the
    task that has called it so that it can wait until user space is
    thawed without triggering the scary warning.

    For this purpose, change usermodehelper_disabled so that it can
    take three different values, UMH_ENABLED (0), UMH_FREEZING and
    UMH_DISABLED. The first one means that usermode helpers are
    enabled, the last one means "hard disable" (i.e. the system is not
    ready for usermode helpers to be used) and the second one
    is reserved for the freezer. Namely, when freeze_processes() is
    started, it sets usermodehelper_disabled to UMH_FREEZING which
    tells usermodehelper_read_trylock() that it shouldn't fail just
    yet and should call try_to_freeze() if woken up and cannot
    return immediately. This way all freezable tasks that happen
    to call request_firmware() right before freeze_processes() is
    started and lose the race for umhelper_sem with it will be
    frozen and will sleep until thaw_processes() unsets
    usermodehelper_disabled. [For the non-freezable callers of
    request_firmware() the race for umhelper_sem against
    freeze_processes() is unfortunately unavoidable.]

    Reported-by: Stephen Boyd
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman
    Cc: stable@vger.kernel.org

    Rafael J. Wysocki
     
  • The core suspend/hibernation code calls usermodehelper_disable() to
    avoid race conditions between the freezer and the starting of
    usermode helpers and each code path has to do that on its own.
    However, it is always called right before freeze_processes()
    and usermodehelper_enable() is always called right after
    thaw_processes(). For this reason, to avoid code duplication and
    to make the connection between usermodehelper_disable() and the
    freezer more visible, make freeze_processes() call it and remove the
    direct usermodehelper_disable() and usermodehelper_enable() calls
    from all suspend/hibernation code paths.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman
    Cc: stable@vger.kernel.org

    Rafael J. Wysocki
     
  • There is no reason to call usermodehelper_disable() before creating
    memory bitmaps in hibernate() and software_resume(), so call it right
    before freeze_processes(), in accordance with the other suspend and
    hibernation code. Consequently, call usermodehelper_enable() right
    after the thawing of tasks rather than after freeing the memory
    bitmaps.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman
    Cc: stable@vger.kernel.org

    Rafael J. Wysocki