01 Oct, 2013

1 commit

  • Recent commit 8fd37a4 (PM / hibernate: Create memory bitmaps after
    freezing user space) broke the resume part of the user space driven
    hibernation (s2disk), because I forgot that the resume utility
    loaded the image into memory without freezing user space (it still
    freezes tasks after loading the image). This means that during user
    space driven resume we need to create the memory bitmaps at the
    "device open" time rather than at the "freeze tasks" time, so make
    that happen (that's a special case anyway, so it needs to be treated
    in a special way).

    Reported-and-tested-by: Ronald
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

13 Sep, 2013

1 commit

  • Pull ACPI and power management fixes from Rafael Wysocki:
    "All of these commits are fixes that have emerged recently and some of
    them fix bugs introduced during this merge window.

    Specifics:

    1) ACPI-based PCI hotplug (ACPIPHP) fixes related to spurious events

    After the recent ACPIPHP changes we've seen some interesting
    breakage on a system that triggers device check notifications
    during boot for non-existing devices. Although those
    notifications are really spurious, we should be able to deal with
    them nevertheless and that shouldn't introduce too much overhead.
    Four commits to make that work properly.

    2) Memory hotplug and hibernation mutual exclusion rework

    This was maent to be a cleanup, but it happens to fix a classical
    ABBA deadlock between system suspend/hibernation and ACPI memory
    hotplug which is possible if they are started roughly at the same
    time. Three commits rework memory hotplug so that it doesn't
    acquire pm_mutex and make hibernation use device_hotplug_lock
    which prevents it from racing with memory hotplug.

    3) ACPI Intel LPSS (Low-Power Subsystem) driver crash fix

    The ACPI LPSS driver crashes during boot on Apple Macbook Air with
    Haswell that has slightly unusual BIOS configuration in which one
    of the LPSS device's _CRS method doesn't return all of the
    information expected by the driver. Fix from Mika Westerberg, for
    stable.

    4) ACPICA fix related to Store->ArgX operation

    AML interpreter fix for obscure breakage that causes AML to be
    executed incorrectly on some machines (observed in practice).
    From Bob Moore.

    5) ACPI core fix for PCI ACPI device objects lookup

    There still are cases in which there is more than one ACPI device
    object matching a given PCI device and we don't choose the one
    that the BIOS expects us to choose, so this makes the lookup take
    more criteria into account in those cases.

    6) Fix to prevent cpuidle from crashing in some rare cases

    If the result of cpuidle_get_driver() is NULL, which can happen on
    some systems, cpuidle_driver_ref() will crash trying to use that
    pointer and the Daniel Fu's fix prevents that from happening.

    7) cpufreq fixes related to CPU hotplug

    Stephen Boyd reported a number of concurrency problems with
    cpufreq related to CPU hotplug which are addressed by a series of
    fixes from Srivatsa S Bhat and Viresh Kumar.

    8) cpufreq fix for time conversion in time_in_state attribute

    Time conversion carried out by cpufreq when user space attempts to
    read /sys/devices/system/cpu/cpu*/cpufreq/stats/time_in_state
    won't work correcty if cputime_t doesn't map directly to jiffies.
    Fix from Andreas Schwab.

    9) Revert of a troublesome cpufreq commit

    Commit 7c30ed5 (cpufreq: make sure frequency transitions are
    serialized) was intended to address some known concurrency
    problems in cpufreq related to the ordering of transitions, but
    unfortunately it introduced several problems of its own, so I
    decided to revert it now and address the original problems later
    in a more robust way.

    10) Intel Haswell CPU models for intel_pstate from Nell Hardcastle.

    11) cpufreq fixes related to system suspend/resume

    The recent cpufreq changes that made it preserve CPU sysfs
    attributes over suspend/resume cycles introduced a possible NULL
    pointer dereference that caused it to crash during the second
    attempt to suspend. Three commits from Srivatsa S Bhat fix that
    problem and a couple of related issues.

    12) cpufreq locking fix

    cpufreq_policy_restore() should acquire the lock for reading, but
    it acquires it for writing. Fix from Lan Tianyu"

    * tag 'pm+acpi-fixes-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (25 commits)
    cpufreq: Acquire the lock in cpufreq_policy_restore() for reading
    cpufreq: Prevent problems in update_policy_cpu() if last_cpu == new_cpu
    cpufreq: Restructure if/else block to avoid unintended behavior
    cpufreq: Fix crash in cpufreq-stats during suspend/resume
    intel_pstate: Add Haswell CPU models
    Revert "cpufreq: make sure frequency transitions are serialized"
    cpufreq: Use signed type for 'ret' variable, to store negative error values
    cpufreq: Remove temporary fix for race between CPU hotplug and sysfs-writes
    cpufreq: Synchronize the cpufreq store_*() routines with CPU hotplug
    cpufreq: Invoke __cpufreq_remove_dev_finish() after releasing cpu_hotplug.lock
    cpufreq: Split __cpufreq_remove_dev() into two parts
    cpufreq: Fix wrong time unit conversion
    cpufreq: serialize calls to __cpufreq_governor()
    cpufreq: don't allow governor limits to be changed when it is disabled
    ACPI / bind: Prefer device objects with _STA to those without it
    ACPI / hotplug / PCI: Avoid parent bus rescans on spurious device checks
    ACPI / hotplug / PCI: Use _OST to notify firmware about notify status
    ACPI / hotplug / PCI: Avoid doing too much for spurious notifies
    ACPICA: Fix for a Store->ArgX when ArgX contains a reference to a field.
    ACPI / hotplug / PCI: Don't trim devices before scanning the namespace
    ...

    Linus Torvalds
     

12 Sep, 2013

1 commit


11 Sep, 2013

1 commit


04 Sep, 2013

1 commit

  • Pull x86/asmlinkage changes from Ingo Molnar:
    "As a preparation for Andi Kleen's LTO patchset (link time
    optimizations using GCC's -flto which build time optimization has
    steadily increased in quality over the past few years and might
    eventually be usable for the kernel too) this tree includes a handful
    of preparatory patches that make function calling convention
    annotations consistent again:

    - Mark every function without arguments (or 64bit only) that is used
    by assembly code with asmlinkage()

    - Mark every function with parameters or variables that is used by
    assembly code as __visible.

    For the vanilla kernel this has documentation, consistency and
    debuggability advantages, for the time being"

    * 'x86-asmlinkage-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/asmlinkage: Fix warning in xen asmlinkage change
    x86, asmlinkage, vdso: Mark vdso variables __visible
    x86, asmlinkage, power: Make various symbols used by the suspend asm code visible
    x86, asmlinkage: Make dump_stack visible
    x86, asmlinkage: Make 64bit checksum functions visible
    x86, asmlinkage, paravirt: Add __visible/asmlinkage to xen paravirt ops
    x86, asmlinkage, apm: Make APM data structure used from assembler visible
    x86, asmlinkage: Make syscall tables visible
    x86, asmlinkage: Make several variables used from assembler/linker script visible
    x86, asmlinkage: Make kprobes code visible and fix assembler code
    x86, asmlinkage: Make various syscalls asmlinkage
    x86, asmlinkage: Make 32bit/64bit __switch_to visible
    x86, asmlinkage: Make _*_start_kernel visible
    x86, asmlinkage: Make all interrupt handlers asmlinkage / __visible
    x86, asmlinkage: Change dotraplinkage into __visible on 32bit
    x86: Fix sys_call_table type in asm/syscall.h

    Linus Torvalds
     

31 Aug, 2013

2 commits

  • Since all of the memory hotplug operations have to be carried out
    under device_hotplug_lock, they won't need to acquire pm_mutex if
    device_hotplug_lock is held around hibernation.

    For this reason, make the hibernation code acquire
    device_hotplug_lock after freezing user space processes and
    release it before thawing them. At the same tim drop the
    lock_system_sleep() and unlock_system_sleep() calls from
    lock_memory_hotplug() and unlock_memory_hotplug(), respectively.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Toshi Kani

    Rafael J. Wysocki
     
  • The hibernation core uses special memory bitmaps during image
    creation and restoration and traditionally those bitmaps are
    allocated before freezing tasks, because in the past GFP_KERNEL
    allocations might not work after all tasks had been frozen.

    However, this is an anachronism, because hibernation_snapshot()
    now calls hibernate_preallocate_memory() which allocates memory
    for the image upfront anyway, so the memory bitmaps may be
    allocated after freezing user space safely.

    For this reason, move all of the create_basic_memory_bitmaps()
    calls after freeze_processes() and all of the corresponding
    free_basic_memory_bitmaps() calls before thaw_processes().

    This will allow us to hold device_hotplug_lock around hibernation
    without the need to worry about freezing issues with user space
    processes attempting to acquire it via sysfs attributes after the
    creation of memory bitmaps and before the freezing of tasks.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Toshi Kani

    Rafael J. Wysocki
     

27 Aug, 2013

1 commit


14 Aug, 2013

1 commit

  • pm_qos_update_request_timeout() updates a qos and then schedules
    a delayed work item to bring the qos back down to the default
    after the timeout. When the work item runs, pm_qos_work_fn() will
    call pm_qos_update_request() and deadlock because it tries to
    cancel itself via cancel_delayed_work_sync(). Future callers of
    that qos will also hang waiting to cancel the work that is
    canceling itself. Let's extract the little bit of code that does
    the real work of pm_qos_update_request() and call it from the
    work function so that we don't deadlock.

    Before ed1ac6e (PM: don't use [delayed_]work_pending()) this didn't
    happen because the work function wouldn't try to cancel itself.

    Signed-off-by: Stephen Boyd
    Reviewed-by: Tejun Heo
    Cc: 3.9+ # 3.9+
    Signed-off-by: Rafael J. Wysocki

    Stephen Boyd
     

07 Aug, 2013

1 commit


30 Jul, 2013

1 commit

  • Calling freeze_processes sets a global flag that will cause any
    process that calls try_to_freeze to enter the refrigerator. It
    skips sending a signal to the current task, but if the current
    task ever hits try_to_freeze, all threads will be frozen and the
    system will deadlock.

    Set a new flag, PF_SUSPEND_TASK, on the task that calls
    freeze_processes. The flag notifies the freezer that the thread
    is involved in suspend and should not be frozen. Also add a
    WARN_ON in thaw_processes if the caller does not have the
    PF_SUSPEND_TASK flag set to catch if a different task calls
    thaw_processes than the one that called freeze_processes, leaving
    a task with PF_SUSPEND_TASK permanently set on it.

    Threads that spawn off a task with PF_SUSPEND_TASK set (which
    swsusp does) will also have PF_SUSPEND_TASK set, preventing them
    from freezing while they are helping with suspend, but they need
    to be dead by the time suspend is triggered, otherwise they may
    run when userspace is expected to be frozen. Add a WARN_ON in
    thaw_processes if more than one thread has the PF_SUSPEND_TASK
    flag set.

    Reported-and-tested-by: Michael Leun
    Signed-off-by: Colin Cross
    Signed-off-by: Rafael J. Wysocki

    Colin Cross
     

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
     

15 Jul, 2013

1 commit

  • Prevent automatic system suspend from happening during system
    shutdown by making try_to_suspend() check system_state and return
    immediately if it is not SYSTEM_RUNNING.

    This prevents the following breakage from happening (scenario from
    Zhang Yanmin):

    Kernel starts shutdown and calls all device driver's shutdown
    callback. When a driver's shutdown is called, the last wakelock is
    released and suspend-to-ram starts. However, as some driver's shut
    down callbacks already shut down devices and disabled runtime pm,
    the suspend-to-ram calls driver's suspend callback without noticing
    that device is already off and causes crash.

    [rjw: Changelog]
    Signed-off-by: Liu ShuoX
    Cc: 3.5+
    Signed-off-by: Rafael J. Wysocki

    Liu ShuoX
     

04 Jul, 2013

3 commits

  • Merge first patch-bomb from Andrew Morton:
    - various misc bits
    - I'm been patchmonkeying ocfs2 for a while, as Joel and Mark have been
    distracted. There has been quite a bit of activity.
    - About half the MM queue
    - Some backlight bits
    - Various lib/ updates
    - checkpatch updates
    - zillions more little rtc patches
    - ptrace
    - signals
    - exec
    - procfs
    - rapidio
    - nbd
    - aoe
    - pps
    - memstick
    - tools/testing/selftests updates

    * emailed patches from Andrew Morton : (445 commits)
    tools/testing/selftests: don't assume the x bit is set on scripts
    selftests: add .gitignore for kcmp
    selftests: fix clean target in kcmp Makefile
    selftests: add .gitignore for vm
    selftests: add hugetlbfstest
    self-test: fix make clean
    selftests: exit 1 on failure
    kernel/resource.c: remove the unneeded assignment in function __find_resource
    aio: fix wrong comment in aio_complete()
    drivers/w1/slaves/w1_ds2408.c: add magic sequence to disable P0 test mode
    drivers/memstick/host/r592.c: convert to module_pci_driver
    drivers/memstick/host/jmb38x_ms: convert to module_pci_driver
    pps-gpio: add device-tree binding and support
    drivers/pps/clients/pps-gpio.c: convert to module_platform_driver
    drivers/pps/clients/pps-gpio.c: convert to devm_* helpers
    drivers/parport/share.c: use kzalloc
    Documentation/accounting/getdelays.c: avoid strncpy in accounting tool
    aoe: update internal version number to v83
    aoe: update copyright date
    aoe: perform I/O completions in parallel
    ...

    Linus Torvalds
     
  • The global variable num_physpages is scheduled to be removed, so use
    totalram_pages instead of num_physpages at runtime.

    Signed-off-by: Jiang Liu
    Cc: Miklos Szeredi
    Cc: "David S. Miller"
    Cc: Alexey Kuznetsov
    Cc: James Morris
    Cc: Hideaki YOSHIFUJI
    Cc: Patrick McHardy
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Pull power management and ACPI updates from Rafael Wysocki:
    "This time the total number of ACPI commits is slightly greater than
    the number of cpufreq commits, but Viresh Kumar (who works on cpufreq)
    remains the most active patch submitter.

    To me, the most significant change is the addition of offline/online
    device operations to the driver core (with the Greg's blessing) and
    the related modifications of the ACPI core hotplug code. Next are the
    freezer updates from Colin Cross that should make the freezing of
    tasks a bit less heavy weight.

    We also have a couple of regression fixes, a number of fixes for
    issues that have not been identified as regressions, two new drivers
    and a bunch of cleanups all over.

    Highlights:

    - Hotplug changes to support graceful hot-removal failures.

    It sometimes is necessary to fail device hot-removal operations
    gracefully if they cannot be carried out completely. For example,
    if memory from a memory module being hot-removed has been allocated
    for the kernel's own use and cannot be moved elsewhere, it's
    desirable to fail the hot-removal operation in a graceful way
    rather than to crash the kernel, but currenty a success or a kernel
    crash are the only possible outcomes of an attempted memory
    hot-removal. Needless to say, that is not a very attractive
    alternative and it had to be addressed.

    However, in order to make it work for memory, I first had to make
    it work for CPUs and for this purpose I needed to modify the ACPI
    processor driver. It's been split into two parts, a resident one
    handling the low-level initialization/cleanup and a modular one
    playing the actual driver's role (but it binds to the CPU system
    device objects rather than to the ACPI device objects representing
    processors). That's been sort of like a live brain surgery on a
    patient who's riding a bike.

    So this is a little scary, but since we found and fixed a couple of
    regressions it caused to happen during the early linux-next testing
    (a month ago), nobody has complained.

    As a bonus we remove some duplicated ACPI hotplug code, because the
    ACPI-based CPU hotplug is now going to use the common ACPI hotplug
    code.

    - Lighter weight freezing of tasks.

    These changes from Colin Cross and Mandeep Singh Baines are
    targeted at making the freezing of tasks a bit less heavy weight
    operation. They reduce the number of tasks woken up every time
    during the freezing, by using the observation that the freezer
    simply doesn't need to wake up some of them and wait for them all
    to call refrigerator(). The time needed for the freezer to decide
    to report a failure is reduced too.

    Also reintroduced is the check causing a lockdep warining to
    trigger when try_to_freeze() is called with locks held (which is
    generally unsafe and shouldn't happen).

    - cpufreq updates

    First off, a commit from Srivatsa S Bhat fixes a resume regression
    introduced during the 3.10 cycle causing some cpufreq sysfs
    attributes to return wrong values to user space after resume. The
    fix is kind of fresh, but also it's pretty obvious once Srivatsa
    has identified the root cause.

    Second, we have a new freqdomain_cpus sysfs attribute for the
    acpi-cpufreq driver to provide information previously available via
    related_cpus. From Lan Tianyu.

    Finally, we fix a number of issues, mostly related to the
    CPUFREQ_POSTCHANGE notifier and cpufreq Kconfig options and clean
    up some code. The majority of changes from Viresh Kumar with bits
    from Jacob Shin, Heiko Stübner, Xiaoguang Chen, Ezequiel Garcia,
    Arnd Bergmann, and Tang Yuantian.

    - ACPICA update

    A usual bunch of updates from the ACPICA upstream.

    During the 3.4 cycle we introduced support for ACPI 5 extended
    sleep registers, but they are only supposed to be used if the
    HW-reduced mode bit is set in the FADT flags and the code attempted
    to use them without checking that bit. That caused suspend/resume
    regressions to happen on some systems. Fix from Lv Zheng causes
    those registers to be used only if the HW-reduced mode bit is set.

    Apart from this some other ACPICA bugs are fixed and code cleanups
    are made by Bob Moore, Tomasz Nowicki, Lv Zheng, Chao Guan, and
    Zhang Rui.

    - cpuidle updates

    New driver for Xilinx Zynq processors is added by Michal Simek.

    Multidriver support simplification, addition of some missing
    kerneldoc comments and Kconfig-related fixes come from Daniel
    Lezcano.

    - ACPI power management updates

    Changes to make suspend/resume work correctly in Xen guests from
    Konrad Rzeszutek Wilk, sparse warning fix from Fengguang Wu and
    cleanups and fixes of the ACPI device power state selection
    routine.

    - ACPI documentation updates

    Some previously missing pieces of ACPI documentation are added by
    Lv Zheng and Aaron Lu (hopefully, that will help people to
    uderstand how the ACPI subsystem works) and one outdated doc is
    updated by Hanjun Guo.

    - Assorted ACPI updates

    We finally nailed down the IA-64 issue that was the reason for
    reverting commit 9f29ab11ddbf ("ACPI / scan: do not match drivers
    against objects having scan handlers"), so we can fix it and move
    the ACPI scan handler check added to the ACPI video driver back to
    the core.

    A mechanism for adding CMOS RTC address space handlers is
    introduced by Lan Tianyu to allow some EC-related breakage to be
    fixed on some systems.

    A spec-compliant implementation of acpi_os_get_timer() is added by
    Mika Westerberg.

    The evaluation of _STA is added to do_acpi_find_child() to avoid
    situations in which a pointer to a disabled device object is
    returned instead of an enabled one with the same _ADR value. From
    Jeff Wu.

    Intel BayTrail PCH (Platform Controller Hub) support is added to
    the ACPI driver for Intel Low-Power Subsystems (LPSS) and that
    driver is modified to work around a couple of known BIOS issues.
    Changes from Mika Westerberg and Heikki Krogerus.

    The EC driver is fixed by Vasiliy Kulikov to use get_user() and
    put_user() instead of dereferencing user space pointers blindly.

    Code cleanups are made by Bjorn Helgaas, Nicholas Mazzuca and Toshi
    Kani.

    - Assorted power management updates

    The "runtime idle" helper routine is changed to take the return
    values of the callbacks executed by it into account and to call
    rpm_suspend() if they return 0, which allows us to reduce the
    overall code bloat a bit (by dropping some code that's not
    necessary any more after that modification).

    The runtime PM documentation is updated by Alan Stern (to reflect
    the "runtime idle" behavior change).

    New trace points for PM QoS are added by Sahara
    ().

    PM QoS documentation is updated by Lan Tianyu.

    Code cleanups are made and minor issues are addressed by Bernie
    Thompson, Bjorn Helgaas, Julius Werner, and Shuah Khan.

    - devfreq updates

    New driver for the Exynos5-bus device from Abhilash Kesavan.

    Minor cleanups, fixes and MAINTAINERS update from MyungJoo Ham,
    Abhilash Kesavan, Paul Bolle, Rajagopal Venkat, and Wei Yongjun.

    - OMAP power management updates

    Adaptive Voltage Scaling (AVS) SmartReflex voltage control driver
    updates from Andrii Tseglytskyi and Nishanth Menon."

    * tag 'pm+acpi-3.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (162 commits)
    cpufreq: Fix cpufreq regression after suspend/resume
    ACPI / PM: Fix possible NULL pointer deref in acpi_pm_device_sleep_state()
    PM / Sleep: Warn about system time after resume with pm_trace
    cpufreq: don't leave stale policy pointer in cdbs->cur_policy
    acpi-cpufreq: Add new sysfs attribute freqdomain_cpus
    cpufreq: make sure frequency transitions are serialized
    ACPI: implement acpi_os_get_timer() according the spec
    ACPI / EC: Add HP Folio 13 to ec_dmi_table in order to skip DSDT scan
    ACPI: Add CMOS RTC Operation Region handler support
    ACPI / processor: Drop unused variable from processor_perflib.c
    cpufreq: tegra: call CPUFREQ_POSTCHANGE notfier in error cases
    cpufreq: s3c64xx: call CPUFREQ_POSTCHANGE notfier in error cases
    cpufreq: omap: call CPUFREQ_POSTCHANGE notfier in error cases
    cpufreq: imx6q: call CPUFREQ_POSTCHANGE notfier in error cases
    cpufreq: exynos: call CPUFREQ_POSTCHANGE notfier in error cases
    cpufreq: dbx500: call CPUFREQ_POSTCHANGE notfier in error cases
    cpufreq: davinci: call CPUFREQ_POSTCHANGE notfier in error cases
    cpufreq: arm-big-little: call CPUFREQ_POSTCHANGE notfier in error cases
    cpufreq: powernow-k8: call CPUFREQ_POSTCHANGE notfier in error cases
    cpufreq: pcc: call CPUFREQ_POSTCHANGE notfier in error cases
    ...

    Linus Torvalds
     

03 Jul, 2013

1 commit

  • Pull workqueue changes from Tejun Heo:
    "Surprisingly, Lai and I didn't break too many things implementing
    custom pools and stuff last time around and there aren't any follow-up
    changes necessary at this point.

    The only change in this pull request is Viresh's patches to make some
    per-cpu workqueues to behave as unbound workqueues dependent on a boot
    param whose default can be configured via a config option. This leads
    to higher processing overhead / lower bandwidth as more work items are
    bounced across CPUs; however, it can lead to noticeable powersave in
    certain configurations - ~10% w/ idlish constant workload on a
    big.LITTLE configuration according to Viresh.

    This is because per-cpu workqueues interfere with how the scheduler
    perceives whether or not each CPU is idle by forcing pinned tasks on
    them, which makes the scheduler's power-aware scheduling decisions
    less effective.

    Its effectiveness is likely less pronounced on homogenous
    configurations and this type of optimization can probably be made
    automatic; however, the changes are pretty minimal and the affected
    workqueues are clearly marked, so it's an easy gain for some
    configurations for the time being with pretty unintrusive changes."

    * 'for-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
    fbcon: queue work on power efficient wq
    block: queue work on power efficient wq
    PHYLIB: queue work on system_power_efficient_wq
    workqueue: Add system wide power_efficient workqueues
    workqueues: Introduce new flag WQ_POWER_EFFICIENT for power oriented workqueues

    Linus Torvalds
     

29 Jun, 2013

1 commit


28 Jun, 2013

2 commits

  • * pm-assorted:
    PM / QoS: Add pm_qos and dev_pm_qos to events-power.txt
    PM / QoS: Add dev_pm_qos_request tracepoints
    PM / QoS: Add pm_qos_request tracepoints
    PM / QoS: Add pm_qos_update_target/flags tracepoints
    PM / QoS: Update Documentation/power/pm_qos_interface.txt
    PM / Sleep: Print last wakeup source on failed wakeup_count write
    PM / QoS: correct the valid range of pm_qos_class
    PM / wakeup: Adjust messaging for wake events during suspend
    PM / Runtime: Update .runtime_idle() callback documentation
    PM / Runtime: Rework the "runtime idle" helper routine
    PM / Hibernate: print physical addresses consistently with other parts of kernel

    Rafael J. Wysocki
     
  • pm_trace uses the system's Real Time Clock (RTC) to save the magic
    number. The reason for this is that the RTC is the only reliably
    available piece of hardware during resume operations where a value
    can be set that will survive a reboot.

    Consequence is that after a resume (even if it is successful) your
    system clock will have a value corresponding to the magic number
    instead of the correct date/time! It is therefore advisable to use
    a program like ntp-date or rdate to reset the correct date/time from
    an external time source when using this trace option.

    There is no run-time message to warn users of the consequences of
    enabling pm_trace. Adding a warning message to pm_trace_store()
    will serve as a reminder to users to set the system date and time
    after resume.

    Signed-off-by: Shuah Khan
    Acked-by: Pavel Machek
    Signed-off-by: Rafael J. Wysocki

    Shuah Khan
     

24 Jun, 2013

2 commits


21 Jun, 2013

2 commits

  • Commit a938da06 introduced a useful little log message to tell
    users/debuggers which wakeup source aborted a suspend. However,
    this message is only printed if the abort happens during the
    in-kernel suspend path (after writing /sys/power/state).

    The full specification of the /sys/power/wakeup_count facility
    allows user-space power managers to double-check if wakeups have
    already happened before it actually tries to suspend (e.g. while it
    was running user-space pre-suspend hooks), by writing the last known
    wakeup_count value to /sys/power/wakeup_count. This patch changes
    the sysfs handler for that node to also print said log message if
    that write fails, so that we can figure out the offending wakeup
    source for both kinds of suspend aborts.

    Signed-off-by: Julius Werner
    Signed-off-by: Rafael J. Wysocki

    Julius Werner
     
  • The valid start index for pm_qos_array is not 0, but
    PM_QOS_CPU_DMA_LATENCY. There is a null_pm_qos at index 0 of
    pm_qos_array. However, null_pm_qos is not created as misc device so
    that inclusion of 0 index for checking pm_qos_class especially for
    file operations is not proper here.

    [rjw: Changelog, a bit]
    Signed-off-by: Sahara
    Signed-off-by: Rafael J. Wysocki

    Sahara
     

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
     

04 Jun, 2013

2 commits

  • Ever since commit 45f035ab9b8f ("CONFIG_HOTPLUG should be always on"),
    it has been basically impossible to build a kernel with CONFIG_HOTPLUG
    turned off. Remove all the remaining references to it.

    Cc: Russell King
    Cc: Doug Thompson
    Cc: Bjorn Helgaas
    Cc: Steven Whitehouse
    Cc: Arnd Bergmann
    Cc: Pavel Machek
    Cc: "Rafael J. Wysocki"
    Cc: Andrew Morton
    Signed-off-by: Stephen Rothwell
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Hans Verkuil
    Signed-off-by: Greg Kroah-Hartman

    Stephen Rothwell
     
  • Print physical address info in a style consistent with the %pR style
    used elsewhere in the kernel.

    Commit 69f1d475cc did this for a similar printk in this file, but I
    must have missed this one.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Rafael J. Wysocki

    Bjorn Helgaas
     

15 May, 2013

1 commit

  • Workqueues can be performance or power-oriented. Currently, most workqueues are
    bound to the CPU they were created on. This gives good performance (due to cache
    effects) at the cost of potentially waking up otherwise idle cores (Idle from
    scheduler's perspective. Which may or may not be physically idle) just to
    process some work. To save power, we can allow the work to be rescheduled on a
    core that is already awake.

    Workqueues created with the WQ_UNBOUND flag will allow some power savings.
    However, we don't change the default behaviour of the system. To enable
    power-saving behaviour, a new config option CONFIG_WQ_POWER_EFFICIENT needs to
    be turned on. This option can also be overridden by the
    workqueue.power_efficient boot parameter.

    tj: Updated config description and comments. Renamed
    CONFIG_WQ_POWER_EFFICIENT to CONFIG_WQ_POWER_EFFICIENT_DEFAULT.

    Signed-off-by: Viresh Kumar
    Reviewed-by: Amit Kucheria
    Signed-off-by: Tejun Heo

    Viresh Kumar
     

12 May, 2013

1 commit


03 May, 2013

1 commit

  • Pull drm updates from Dave Airlie:
    "This is the main drm pull request for 3.10.

    Wierd bits:
    - OMAP drm changes required OMAP dss changes, in drivers/video, so I
    took them in here.
    - one more fbcon fix for font handover
    - VT switch avoidance in pm code
    - scatterlist helpers for gpu drivers - have acks from akpm

    Highlights:
    - qxl kms driver - driver for the spice qxl virtual GPU

    Nouveau:
    - fermi/kepler VRAM compression
    - GK110/nvf0 modesetting support.

    Tegra:
    - host1x core merged with 2D engine support

    i915:
    - vt switchless resume
    - more valleyview support
    - vblank fixes
    - modesetting pipe config rework

    radeon:
    - UVD engine support
    - SI chip tiling support
    - GPU registers initialisation from golden values.

    exynos:
    - device tree changes
    - fimc block support

    Otherwise:
    - bunches of fixes all over the place."

    * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (513 commits)
    qxl: update to new idr interfaces.
    drm/nouveau: fix build with nv50->nvc0
    drm/radeon: fix handling of v6 power tables
    drm/radeon: clarify family checks in pm table parsing
    drm/radeon: consolidate UVD clock programming
    drm/radeon: fix UPLL_REF_DIV_MASK definition
    radeon: add bo tracking debugfs
    drm/radeon: add new richland pci ids
    drm/radeon: add some new SI PCI ids
    drm/radeon: fix scratch reg handling for UVD fence
    drm/radeon: allocate SA bo in the requested domain
    drm/radeon: fix possible segfault when parsing pm tables
    drm/radeon: fix endian bugs in atom_allocate_fb_scratch()
    OMAPDSS: TFP410: return EPROBE_DEFER if the i2c adapter not found
    OMAPDSS: VENC: Add error handling for venc_probe_pdata
    OMAPDSS: HDMI: Add error handling for hdmi_probe_pdata
    OMAPDSS: RFBI: Add error handling for rfbi_probe_pdata
    OMAPDSS: DSI: Add error handling for dsi_probe_pdata
    OMAPDSS: SDI: Add error handling for sdi_probe_pdata
    OMAPDSS: DPI: Add error handling for dpi_probe_pdata
    ...

    Linus Torvalds
     

01 May, 2013

2 commits

  • Merge third batch of fixes from Andrew Morton:
    "Most of the rest. I still have two large patchsets against AIO and
    IPC, but they're a bit stuck behind other trees and I'm about to
    vanish for six days.

    - random fixlets
    - inotify
    - more of the MM queue
    - show_stack() cleanups
    - DMI update
    - kthread/workqueue things
    - compat cleanups
    - epoll udpates
    - binfmt updates
    - nilfs2
    - hfs
    - hfsplus
    - ptrace
    - kmod
    - coredump
    - kexec
    - rbtree
    - pids
    - pidns
    - pps
    - semaphore tweaks
    - some w1 patches
    - relay updates
    - core Kconfig changes
    - sysrq tweaks"

    * emailed patches from Andrew Morton : (109 commits)
    Documentation/sysrq: fix inconstistent help message of sysrq key
    ethernet/emac/sysrq: fix inconstistent help message of sysrq key
    sparc/sysrq: fix inconstistent help message of sysrq key
    powerpc/xmon/sysrq: fix inconstistent help message of sysrq key
    ARM/etm/sysrq: fix inconstistent help message of sysrq key
    power/sysrq: fix inconstistent help message of sysrq key
    kgdb/sysrq: fix inconstistent help message of sysrq key
    lib/decompress.c: fix initconst
    notifier-error-inject: fix module names in Kconfig
    kernel/sys.c: make prctl(PR_SET_MM) generally available
    UAPI: remove empty Kbuild files
    menuconfig: print more info for symbol without prompts
    init/Kconfig: re-order CONFIG_EXPERT options to fix menuconfig display
    kconfig menu: move Virtualization drivers near other virtualization options
    Kconfig: consolidate CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
    relay: use macro PAGE_ALIGN instead of FIX_SIZE
    kernel/relay.c: move FIX_SIZE macro into relay.c
    kernel/relay.c: remove unused function argument actor
    drivers/w1/slaves/w1_ds2760.c: fix the error handling in w1_ds2760_add_slave()
    drivers/w1/slaves/w1_ds2781.c: fix the error handling in w1_ds2781_add_slave()
    ...

    Linus Torvalds
     
  • Currently help message of /proc/sysrq-trigger highlight its
    upper-case characters, like below:

    SysRq : HELP : loglevel(0-9) reBoot Crash terminate-all-tasks(E)
    memory-full-oom-kill(F) kill-all-tasks(I) ...

    this would confuse user trigger sysrq by upper-case character, which is
    inconsistent with the real lower-case character registed key.

    This inconsistent help message will also lead more confused when
    26 upper-case letters put into use in future.

    This patch fix power off sysrq key: "poweroff(o)"

    Signed-off-by: zhangwei(Jovi)
    Cc: Benjamin Herrenschmidt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    zhangwei(Jovi)
     

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
     

19 Mar, 2013

1 commit

  • Backmerge so that I can merge Imre Deak's coalesced sg entries fixes,
    which depend upon the new for_each_sg_page introduce in

    commit a321e91b6d73ed011ffceed384c40d2785cf723b
    Author: Imre Deak
    Date: Wed Feb 27 17:02:56 2013 -0800

    lib/scatterlist: add simple page iterator

    The merge itself is just two trivial conflicts:

    Signed-off-by: Daniel Vetter

    Daniel Vetter
     

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
     

20 Feb, 2013

1 commit

  • KMS drivers can potentially restore the display configuration without
    userspace help. Such drivers can can call a new funciton,
    pm_vt_switch_required(false) if they support this feature. In that
    case, the PM layer won't VT switch to the suspend console at suspend
    time and then back to the original VT on resume, but rather leave things
    alone for a nicer looking suspend and resume sequence.

    v2: make a function so we can handle multiple drivers (Alan)
    v3: use a list to track device requests (Rafael)
    v4: Squash in build fix from Jesse for CONFIG_VT_CONSOLE_SLEEP=n
    v5: Squash in patch from Wu Fengguang to add a few missing static
    qualifiers.
    v6: Add missing EXPORT_SYMBOL.

    Signed-off-by: Jesse Barnes
    Reviewed-by: Rafael J. Wysocki (v3)
    Signed-off-by: Daniel Vetter

    Jesse Barnes
     

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