1. 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
  2. 08 6月, 2011 2 次提交
  3. 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
  4. 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
  5. 17 5月, 2011 2 次提交
  6. 13 5月, 2011 1 次提交
  7. 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
  8. 30 4月, 2011 1 次提交
  9. 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
  10. 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
  11. 23 4月, 2011 7 次提交
  12. 20 4月, 2011 2 次提交
  13. 12 4月, 2011 2 次提交
    • S
      mfd: Fetch cell pointer from platform_device->mfd_cell · e710d7d5
      Samuel Ortiz 提交于
      In order for MFD drivers to fetch their cell pointer but also their
      platform data one, an mfd cell pointer is added to the platform_device
      structure.
      That allows all MFD sub devices drivers to be MFD agnostic, unless
      they really need to access their MFD cell data. Most of them don't,
      especially the ones for IPs used by both MFD and non MFD SoCs.
      
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Acked-by: NGreg KH <gregkh@suse.de>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      e710d7d5
    • R
      PM / Hibernate: Introduce CONFIG_HIBERNATE_CALLBACKS · 1f112cee
      Rafael J. Wysocki 提交于
      Xen save/restore is going to use hibernate device callbacks for
      quiescing devices and putting them back to normal operations and it
      would need to select CONFIG_HIBERNATION for this purpose.  However,
      that also would cause the hibernate interfaces for user space to be
      enabled, which might confuse user space, because the Xen kernels
      don't support hibernation.  Moreover, it would be wasteful, as it
      would make the Xen kernels include a substantial amount of code that
      they would never use.
      
      To address this issue introduce new power management Kconfig option
      CONFIG_HIBERNATE_CALLBACKS, such that it will only select the code
      that is necessary for the hibernate device callbacks to work and make
      CONFIG_HIBERNATION select it.  Then, Xen save/restore will be able to
      select CONFIG_HIBERNATE_CALLBACKS without dragging the entire
      hibernate code along with it.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Tested-by: NShriram Rajagopalan <rshriram@cs.ubc.ca>
      1f112cee
  14. 10 4月, 2011 1 次提交
  15. 31 3月, 2011 1 次提交
  16. 24 3月, 2011 1 次提交
    • R
      Introduce ARCH_NO_SYSDEV_OPS config option (v2) · d47d81c0
      Rafael J. Wysocki 提交于
      Introduce Kconfig option allowing architectures where sysdev
      operations used during system suspend, resume and shutdown have been
      completely replaced with struct sycore_ops operations to avoid
      building sysdev code that will never be used.
      
      Make callbacks in struct sys_device and struct sysdev_driver depend
      on ARCH_NO_SYSDEV_OPS to allows us to verify if all of the references
      have been actually removed from the code the given architecture
      depends on.
      
      Make x86 select ARCH_NO_SYSDEV_OPS.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      d47d81c0
  17. 15 3月, 2011 2 次提交
    • R
      PM / Core: Introduce struct syscore_ops for core subsystems PM · 40dc166c
      Rafael J. Wysocki 提交于
      Some subsystems need to carry out suspend/resume and shutdown
      operations with one CPU on-line and interrupts disabled.  The only
      way to register such operations is to define a sysdev class and
      a sysdev specifically for this purpose which is cumbersome and
      inefficient.  Moreover, the arguments taken by sysdev suspend,
      resume and shutdown callbacks are practically never necessary.
      
      For this reason, introduce a simpler interface allowing subsystems
      to register operations to be executed very late during system suspend
      and shutdown and very early during resume in the form of
      strcut syscore_ops objects.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      40dc166c
    • N
      PM / OPP: opp_find_freq_exact() documentation fix · 7ae49618
      Nishanth Menon 提交于
      opp_find_freq_exact() documentation has is_available instead
      of available. This also fixes warning with the kernel-doc:
      scripts/kernel-doc drivers/base/power/opp.c >/dev/null
      Warning(drivers/base/power/opp.c:246): No description found for parameter 'available'
      Warning(drivers/base/power/opp.c:246): Excess function parameter 'is_available' description in 'opp_find_freq_exact'
      Signed-off-by: NNishanth Menon <nm@ti.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      7ae49618