1. 02 7月, 2011 8 次提交
    • R
      PM: Rename clock management functions · 3d5c3036
      Rafael J. Wysocki 提交于
      The common PM clock management functions may be used for system
      suspend/resume as well as for runtime PM, so rename them
      accordingly.  Modify kerneldoc comments describing these functions
      and kernel messages printed by them, so that they refer to power
      management in general rather that to runtime PM.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      3d5c3036
    • R
      PM: Allow the clocks management code to be used during system suspend · b7b95920
      Rafael J. Wysocki 提交于
      The common clocks management code in drivers/base/power/clock_ops.c
      is going to be used during system-wide power transitions as well as
      for runtime PM, so it shouldn't depend on CONFIG_PM_RUNTIME.
      However, the suspend/resume functions provided by it for
      CONFIG_PM_RUNTIME unset, to be used during system-wide power
      transitions, should not behave in the same way as their counterparts
      defined for CONFIG_PM_RUNTIME set, because in that case the clocks
      are managed differently at run time.
      
      The names of the functions still contain the word "runtime" after
      this change, but that is going to be modified by a separate patch
      later.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      b7b95920
    • R
      PM / Domains: Wakeup devices support for system sleep transitions · d4f2d87a
      Rafael J. Wysocki 提交于
      There is the problem how to handle devices set up to wake up the
      system from sleep states during system-wide power transitions.
      In some cases, those devices can be turned off entirely, because the
      wakeup signals will be generated on their behalf anyway.  In some
      other cases, they will generate wakeup signals if their clocks are
      stopped, but only if power is not removed from them.  Finally, in
      some cases, they can only generate wakeup signals if power is not
      removed from them and their clocks are enabled.
      
      To allow platform-specific code to decide whether or not to put
      wakeup devices (and their PM domains) into low-power state during
      system-wide transitions, such as system suspend, introduce a new
      generic PM domain callback, .active_wakeup(), that will be used
      during the "noirq" phase of system suspend and hibernation (after
      image creation) to decide what to do with wakeup devices.
      Specifically, if this callback is present and returns "true", the
      generic PM domain code will not execute .stop_device() for the
      given wakeup device and its PM domain won't be powered off.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NKevin Hilman <khilman@ti.com>
      d4f2d87a
    • R
      PM / Domains: System-wide transitions support for generic domains (v5) · 596ba34b
      Rafael J. Wysocki 提交于
      Make generic PM domains support system-wide power transitions
      (system suspend and hibernation).  Add suspend, resume, freeze, thaw,
      poweroff and restore callbacks to be associated with struct
      generic_pm_domain objects and make pm_genpd_init() use them as
      appropriate.
      
      The new callbacks do nothing for devices belonging to power domains
      that were powered down at run time (before the transition).  For the
      other devices the action carried out depends on the type of the
      transition.  During system suspend the power domain .suspend()
      callback executes pm_generic_suspend() for the device, while the
      PM domain .suspend_noirq() callback runs pm_generic_suspend_noirq()
      for it, stops it and eventually removes power from the PM domain it
      belongs to (after all devices in the domain have been stopped and its
      subdomains have been powered off).
      
      During system resume the PM domain .resume_noirq() callback
      restores power to the PM domain (when executed for it first time),
      starts the device and executes pm_generic_resume_noirq() for it,
      while the .resume() callback executes pm_generic_resume() for the
      device.  Finally, the .complete() callback executes pm_runtime_idle()
      for the device which should put it back into the suspended state if
      its runtime PM usage count is equal to zero at that time.
      
      The actions carried out during hibernation and resume from it are
      analogous to the ones described above.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      596ba34b
    • R
      PM / Domains: Move code from under #ifdef CONFIG_PM_RUNTIME (v2) · 5248051b
      Rafael J. Wysocki 提交于
      There is some code in drivers/base/power/domain.c that will be useful
      for both runtime PM and system-wide power transitions, so make it
      depend on CONFIG_PM instead of CONFIG_PM_RUNTIME.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      5248051b
    • R
      PM: Introduce generic "noirq" callback routines for subsystems (v2) · e5291928
      Rafael J. Wysocki 提交于
      Introduce generic "noirq" power management callback routines for
      subsystems in addition to the "regular" generic PM callback routines.
      
      The new routines will be used, among other things, for implementing
      system-wide PM transitions support for generic PM domains.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      e5291928
    • R
      PM / Domains: Support for generic I/O PM domains (v8) · f721889f
      Rafael J. Wysocki 提交于
      Introduce common headers, helper functions and callbacks allowing
      platforms to use simple generic power domains for runtime power
      management.
      
      Introduce struct generic_pm_domain to be used for representing
      power domains that each contain a number of devices and may be
      parent domains or subdomains with respect to other power domains.
      Among other things, this structure includes callbacks to be
      provided by platforms for performing specific tasks related to
      power management (i.e. ->stop_device() may disable a device's
      clocks, while ->start_device() may enable them, ->power_off() is
      supposed to remove power from the entire power domain
      and ->power_on() is supposed to restore it).
      
      Introduce functions that can be used as power domain runtime PM
      callbacks, pm_genpd_runtime_suspend() and pm_genpd_runtime_resume(),
      as well as helper functions for the initialization of a power
      domain represented by a struct generic_power_domain object,
      adding a device to or removing a device from it and adding or
      removing subdomains.
      
      Introduce configuration option CONFIG_PM_GENERIC_DOMAINS to be
      selected by the platforms that want to use the new code.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      f721889f
    • R
      PM / Domains: Rename struct dev_power_domain to struct dev_pm_domain · 564b905a
      Rafael J. Wysocki 提交于
      The naming convention used by commit 7538e3db6e015e890825fbd9f86599b
      (PM: Add support for device power domains), which introduced the
      struct dev_power_domain type for representing device power domains,
      evidently confuses some developers who tend to think that objects
      of this type must correspond to "power domains" as defined by
      hardware, which is not the case.  Namely, at the kernel level, a
      struct dev_power_domain object can represent arbitrary set of devices
      that are mutually dependent power management-wise and need not belong
      to one hardware power domain.  To avoid that confusion, rename struct
      dev_power_domain to struct dev_pm_domain and rename the related
      pointers in struct device and struct pm_clk_notifier_block from
      pwr_domain to pm_domain.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NKevin Hilman <khilman@ti.com>
      564b905a
  2. 22 6月, 2011 3 次提交
    • R
      PM / Runtime: Handle clocks correctly if CONFIG_PM_RUNTIME is unset · 4d1518f5
      Rafael J. Wysocki 提交于
      Commit 85eb8c8d (PM / Runtime:
      Generic clock manipulation rountines for runtime PM (v6)) converted
      the shmobile platform to using generic code for runtime PM clock
      management, but it changed the behavior for CONFIG_PM_RUNTIME unset
      incorrectly.
      
      Specifically, for CONFIG_PM_RUNTIME unset pm_runtime_clk_notify()
      should enable clocks for action equal to BUS_NOTIFY_BIND_DRIVER and
      it should disable them for action equal to BUS_NOTIFY_UNBOUND_DRIVER
      (instead of BUS_NOTIFY_ADD_DEVICE and BUS_NOTIFY_DEL_DEVICE,
      respectively).  Make this function behave as appropriate.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NMagnus Damm <damm@opensource.se>
      4d1518f5
    • A
      PM: Fix async resume following suspend failure · 6d0e0e84
      Alan Stern 提交于
      The PM core doesn't handle suspend failures correctly when it comes to
      asynchronously suspended devices.  These devices are moved onto the
      dpm_suspended_list as soon as the corresponding async thread is
      started up, and they remain on the list even if they fail to suspend
      or the sleep transition is cancelled before they get suspended.  As a
      result, when the PM core unwinds the transition, it tries to resume
      the devices even though they were never suspended.
      
      This patch (as1474) fixes the problem by adding a new "is_suspended"
      flag to dev_pm_info.  Devices are resumed only if the flag is set.
      
      [rjw:
       * Moved the dev->power.is_suspended check into device_resume(),
         because we need to complete dev->power.completion and clear
         dev->power.is_prepared too for devices whose
         dev->power.is_suspended flags are unset.
       * Fixed __device_suspend() to avoid setting dev->power.is_suspended
         if async_error is different from zero.]
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Cc: stable@kernel.org
      6d0e0e84
    • A
      PM: Rename dev_pm_info.in_suspend to is_prepared · f76b168b
      Alan Stern 提交于
      This patch (as1473) renames the "in_suspend" field in struct
      dev_pm_info to "is_prepared", in preparation for an upcoming change.
      The new name is more descriptive of what the field really means.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Cc: stable@kernel.org
      f76b168b
  3. 08 6月, 2011 2 次提交
  4. 25 5月, 2011 1 次提交
    • K
      mm: per-node vmstat: show proper vmstats · fa25c503
      KOSAKI Motohiro 提交于
      commit 2ac39037 ("writeback: add
      /sys/devices/system/node/<node>/vmstat") added vmstat entry.  But
      strangely it only show nr_written and nr_dirtied.
      
              # cat /sys/devices/system/node/node20/vmstat
              nr_written 0
              nr_dirtied 0
      
      Of course, It's not adequate.  With this patch, the vmstat show all vm
      stastics as /proc/vmstat.
      
              # cat /sys/devices/system/node/node0/vmstat
      	nr_free_pages 899224
      	nr_inactive_anon 201
      	nr_active_anon 17380
      	nr_inactive_file 31572
      	nr_active_file 28277
      	nr_unevictable 0
      	nr_mlock 0
      	nr_anon_pages 17321
      	nr_mapped 8640
      	nr_file_pages 60107
      	nr_dirty 33
      	nr_writeback 0
      	nr_slab_reclaimable 6850
      	nr_slab_unreclaimable 7604
      	nr_page_table_pages 3105
      	nr_kernel_stack 175
      	nr_unstable 0
      	nr_bounce 0
      	nr_vmscan_write 0
      	nr_writeback_temp 0
      	nr_isolated_anon 0
      	nr_isolated_file 0
      	nr_shmem 260
      	nr_dirtied 1050
      	nr_written 938
      	numa_hit 962872
      	numa_miss 0
      	numa_foreign 0
      	numa_interleave 8617
      	numa_local 962872
      	numa_other 0
      	nr_anon_transparent_hugepages 0
      
      [akpm@linux-foundation.org: no externs in .c files]
      Signed-off-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Michael Rubin <mrubin@google.com>
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Acked-by: NDavid Rientjes <rientjes@google.com>
      Cc: Randy Dunlap <rdunlap@xenotime.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fa25c503
  5. 18 5月, 2011 7 次提交
    • R
      PM: Introduce generic prepare and complete callbacks for subsystems · 6538df80
      Rafael J. Wysocki 提交于
      Introduce generic .prepare() and .complete() power management
      callbacks, currently missing, that can be used by subsystems and
      power domains and export them.  Provide NULL definitions of all
      the generic system sleep callbacks for CONFIG_PM_SLEEP unset.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      6538df80
    • R
      PM: Allow drivers to allocate memory from .prepare() callbacks safely · 91e7c75b
      Rafael J. Wysocki 提交于
      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: NRafael J. Wysocki <rjw@sisk.pl>
      91e7c75b
    • R
      PM: Remove CONFIG_PM_VERBOSE · c650da23
      Rafael J. Wysocki 提交于
      Now that we have CONFIG_DYNAMIC_DEBUG there is no need for yet
      another flag causing dev_dbg() and pr_debug() statements in the
      core PM code to produce output.  Moreover, CONFIG_PM_VERBOSE
      causes so much output to be generated that it's not really useful
      and almost no one sets it.
      
      References: https://bugzilla.kernel.org/show_bug.cgi?id=23182Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      c650da23
    • E
      PM / Wakeup: Remove useless synchronize_rcu() call · 13e38136
      Eric Dumazet 提交于
      wakeup_source_add() adds an item into wakeup_sources list.
      
      There is no need to call synchronize_rcu() at this point.
      
      Its only needed in wakeup_source_remove()
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      13e38136
    • R
      PM / Wakeup: Fix build warning related to the "wakeup" sysfs file · e762318b
      Rafael J. Wysocki 提交于
      The "wakeup" device sysfs file is only created if CONFIG_PM_SLEEP
      is set, so put it under CONFIG_PM_SLEEP and make a build warning
      related to it go away.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e762318b
    • R
      PM: Print a warning if firmware is requested when tasks are frozen · a144c6a6
      Rafael J. Wysocki 提交于
      Some drivers erroneously use request_firmware() from their ->resume()
      (or ->thaw(), or ->restore()) callbacks, which is not going to work
      unless the firmware has been built in.  This causes system resume to
      stall until the firmware-loading timeout expires, which makes users
      think that the resume has failed and reboot their machines
      unnecessarily.  For this reason, make _request_firmware() print a
      warning and return immediately with error code if it has been called
      when tasks are frozen and it's impossible to start any new usermode
      helpers.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Reviewed-by: NValdis Kletnieks <valdis.kletnieks@vt.edu>
      a144c6a6
    • R
      PM / Runtime: Rework runtime PM handling during driver removal · e1866b33
      Rafael J. Wysocki 提交于
      The driver core tries to prevent race conditions between runtime PM
      and driver removal from happening by incrementing the runtime PM
      usage counter of the device and executing pm_runtime_barrier() before
      running the bus notifier and the ->remove() callbacks provided by the
      device's subsystem or driver.  This guarantees that, if a future
      runtime suspend of the device has been scheduled or a runtime resume
      or idle request has been queued up right before the driver removal,
      it will be canceled or waited for to complete and no other
      asynchronous runtime suspend or idle requests for the device will be
      put into the PM workqueue until the ->remove() callback returns.
      However, it doesn't prevent resume requests from being queued up
      after pm_runtime_barrier() has been called and it doesn't prevent
      pm_runtime_resume() from executing the device subsystem's runtime
      resume callback.  Morever, it prevents the device's subsystem or
      driver from putting the device into the suspended state by calling
      pm_runtime_suspend() from its ->remove() routine.  This turns out to
      be a major inconvenience for some subsystems and drivers that want to
      leave the devices they handle in the suspended state.
      
      To really prevent runtime PM callbacks from racing with the bus
      notifier callback in __device_release_driver(), which is necessary,
      because the notifier is used by some subsystems to carry out
      operations affecting the runtime PM functionality, use
      pm_runtime_get_sync() instead of the combination of
      pm_runtime_get_noresume() and pm_runtime_barrier().  This will resume
      the device if it's in the suspended state and will prevent it from
      being suspended again until pm_runtime_put_*() is called.
      
      To allow subsystems and drivers to put devices into the suspended
      state by calling pm_runtime_suspend() from their ->remove() routines,
      execute pm_runtime_put_sync() after running the bus notifier in
      __device_release_driver().  This will require subsystems and drivers
      to make their ->remove() callbacks avoid races with runtime PM
      directly, but it will allow of more flexibility in the handling of
      devices during the removal of their drivers.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      e1866b33
  6. 17 5月, 2011 2 次提交
  7. 13 5月, 2011 1 次提交
  8. 12 5月, 2011 2 次提交
    • A
      memory hotplug: Speed up add/remove when blocks are larger than PAGES_PER_SECTION · 5409d2cd
      Anton Blanchard 提交于
      On ppc64 the minimum memory section for hotplug is 16MB but most
      recent machines have a memory block size of 256MB. This means
      memory_block_change_state does 16 separate calls to
      memory_section_action.
      
      This also means we call the notifiers 16 times and the hook
      in the ehea network driver is quite costly. To offline one 256MB
      region takes:
      
      # time echo offline > /sys/devices/system/memory/memory32/state
      7.9s
      
      This patch removes the loop and calls online_pages or
      remove_memory once for the entire region and in doing so makes
      the logic simpler since we don't have to back out if things fail
      part way through.
      
      The same test to offline one region now takes:
      
      # time echo online > /sys/devices/system/memory/memory32/state
      0.67s
      
      Over 11 times faster.
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5409d2cd
    • R
      PM: Remove sysdev suspend, resume and shutdown operations · 2e711c04
      Rafael J. Wysocki 提交于
      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: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2e711c04
  9. 30 4月, 2011 1 次提交
  10. 29 4月, 2011 3 次提交
    • R
      PM / Platform: Use generic runtime PM callbacks directly · 8b313a38
      Rafael J. Wysocki 提交于
      Once shmobile platforms have been converted to using power domains
      for overriding the platform bus type's PM callbacks, it isn't
      necessary to use the __weakly defined wrappers around the generinc
      runtime PM callbacks in the platform bus type any more.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      8b313a38
    • R
      PM: Export platform bus type's default PM callbacks · 69c9dd1e
      Rafael J. Wysocki 提交于
      Export the default PM callbacks defined for the platform bus type so
      that they can be used by power domains for suspending and resuming
      platform devices in the future.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      69c9dd1e
    • R
      PM: Make power domain callbacks take precedence over subsystem ones · 4d27e9dc
      Rafael J. Wysocki 提交于
      Change the PM core's behavior related to power domains in such a way
      that, if a power domain is defined for a given device, its callbacks
      will be executed instead of and not in addition to the device
      subsystem's PM callbacks.
      
      The idea behind the initial implementation of power domains handling
      by the PM core was that power domain callbacks would be executed in
      addition to subsystem callbacks, so that it would be possible to
      extend the subsystem callbacks by using power domains.  It turns out,
      however, that this wouldn't be really convenient in some important
      situations.
      
      For example, there are systems in which power can only be removed
      from entire power domains.  On those systems it is not desirable to
      execute device drivers' PM callbacks until it is known that power is
      going to be removed from the devices in question, which means that
      they should be executed by power domain callbacks rather then by
      subsystem (e.g. bus type) PM callbacks, because subsystems generally
      have no information about what devices belong to which power domain.
      Thus, for instance, if the bus type in question is the platform bus
      type, its PM callbacks generally should not be called in addition to
      power domain callbacks, because they run device drivers' callbacks
      unconditionally if defined.
      
      While in principle the default subsystem PM callbacks, or a subset of
      them, may be replaced with different functions, it doesn't seem
      correct to do so, because that would change the subsystem's behavior
      with respect to all devices in the system, regardless of whether or
      not they belong to any power domains.  Thus, the only remaining
      option is to make power domain callbacks take precedence over
      subsystem callbacks.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGrant Likely <grant.likely@secretlab.ca>
      Acked-by: NKevin Hilman <khilman@ti.com>
      4d27e9dc
  11. 26 4月, 2011 2 次提交
    • R
      PM / Wakeup: Fix initialization of wakeup-related device sysfs files · 22110faf
      Rafael J. Wysocki 提交于
      It turns out that some PCI devices are only found to be
      wakeup-capable during registration, in which case, when
      device_set_wakeup_capable() is called, device_is_registered() already
      returns 'true' for the given device, but dpm_sysfs_add() hasn't been
      called for it yet.  This leads to situations in which the device's
      power.can_wakeup flag is not set as requested because of failing
      wakeup_sysfs_add() and its wakeup-related sysfs files are not
      created, although they should be present.  This is a post-2.6.38
      regression introduced by commit cb8f51bd
      (PM: Do not create wakeup sysfs files for devices that cannot wake
      up).
      
      To work around this problem initialize the device's power.entry
      field to an empty list head and make device_set_wakeup_capable()
      check if it is still empty before attempting to add the devices
      wakeup-related sysfs files with wakeup_sysfs_add().  Namely, if
      power.entry is still empty at this point, device_pm_add() hasn't been
      called yet for the device and its wakeup-related files will be
      created later, so device_set_wakeup_capable() doesn't have to create
      them.
      Reported-and-tested-by: NTino Keitel <tino.keitel@tikei.de>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      22110faf
    • W
      drivers:base:fix the coding format of memory.c · 85723943
      Wanlong Gao 提交于
      Fix the line longer than 80 of memory_uevent function .
      Signed-off-by: NWanlong Gao <wanlong.gao@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      85723943
  12. 23 4月, 2011 7 次提交
  13. 20 4月, 2011 1 次提交