1. 26 Feb, 2010 19 commits
    • Rafael J. Wysocki's avatar
      PM / Hibernate: Fix preallocating of memory · a9c9b442
      Rafael J. Wysocki authored
      The hibernate memory preallocation code allocates memory to push some
      user space data out of physical RAM, so that the hibernation image is
      not too large.  It allocates more memory than necessary for creating
      the image, so it has to release some pages to make room for
      allocations made while suspending devices and disabling nonboot CPUs,
      or the system will hang due to the lack of free pages to allocate
      from.  Unfortunately, the function used for freeing these pages,
      free_unnecessary_pages(), contains a bug that prevents it from doing
      the job on all systems without highmem.
      
      Fix this problem, which is a regression from the 2.6.30 kernel, by
      using the right condition for the termination of the loop in
      free_unnecessary_pages().
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Reported-and-tested-by: default avatarAlan Jenkins <sourcejedi.lkml@googlemail.com>
      Cc: stable@kernel.org
      a9c9b442
    • Jiri Slaby's avatar
      PM / Hibernate: Remove swsusp.c finally · f8bb0db8
      Jiri Slaby authored
      Its contents and entry in Makefile were already removed in
      8e60c6a1
      (Shift remaining code from swsusp.c to hibernate.c)
      but somehow it remained in-place (rjw: which most likely was my
      mistake).
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Acked-by: default avatarNigel Cunningham <nigel@tuxonice.net>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      f8bb0db8
    • Frans Pop's avatar
      PM / Hibernate: Remove trailing space in message · 07c3bb57
      Frans Pop authored
      Remove a trailing space from a message in swsusp_save().
      Signed-off-by: default avatarFrans Pop <elendil@planet.nl>
      Acked-by: default avatarPavel Machek <pavel@ucw.cz>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      07c3bb57
    • Rafael J. Wysocki's avatar
      PM: Allow SCSI devices to suspend/resume asynchronously · 4cb077d9
      Rafael J. Wysocki authored
      Set power.async_suspend for all SCSI devices, targets and hosts, so
      that they can be suspended and resumed in parallel with the main
      suspend/resume thread and possibly with other devices they don't
      depend on in a known way (i.e. devices which are not their parents or
      children).
      
      The power.async_suspend flag is also set for devices that don't have
      suspend or resume callbacks, because otherwise they would make the
      main suspend/resume thread wait for their "asynchronous" children
      (during suspend) or parents (during resume), effectively negating the
      possible gains from executing these devices' suspend and resume
      callbacks asynchronously.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      4cb077d9
    • Rafael J. Wysocki's avatar
      PM: Allow USB devices to suspend/resume asynchronously · 927bc916
      Rafael J. Wysocki authored
      Set power.async_suspend for USB devices, endpoints and interfaces,
      allowing them to be suspended and resumed asynchronously during
      system sleep transitions.
      
      The power.async_suspend flag is also set for devices that don't have
      suspend or resume callbacks, because otherwise they would make the
      main suspend/resume thread wait for their "asynchronous" children
      (during suspend) or parents (during resume), effectively negating the
      possible gains from executing these devices' suspend and resume
      callbacks asynchronously.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      927bc916
    • Alan Stern's avatar
      USB: implement non-tree resume ordering constraints for PCI host controllers · 6d19c009
      Alan Stern authored
      This patch (as1331) adds non-tree ordering constraints needed for
      proper resume of PCI USB host controllers from hibernation.  The main
      issue is that non-high-speed devices must not be resumed before the
      high-speed root hub, because it is the ehci_bus_resume() routine which
      takes care of handing the device connection over to the companion
      controller.  If the device resume is attempted before the handover
      then the device won't be found and it will be treated as though it had
      disconnected.
      
      The patch adds a new field to the usb_bus structure; for each
      full/low-speed bus this field will contain a pointer to the companion
      high-speed bus (if one exists).  It is used during normal device
      resume; if the hs_companion pointer isn't NULL then we wait for the
      root-hub device on the hs_companion bus.
      
      A secondary issue is that an EHCI controlller shouldn't be resumed
      before any of its companions.  On some machines I have observed
      handovers failing if the companion controller is reinitialized after
      the handover.  Thus, the EHCI resume routine must wait for the
      companion controllers to be resumed.
      
      The patch also fixes a small bug in usb_hcd_pci_probe(); an error path
      jumps to the wrong label, causing a memory leak.
      
      [rjw: Fixed compilation for CONFIG_PM_SLEEP unset.]
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      6d19c009
    • Rafael J. Wysocki's avatar
      PM: Allow PCI devices to suspend/resume asynchronously · a1e4d72c
      Rafael J. Wysocki authored
      Set power.async_suspend for all PCI devices and PCIe port services,
      so that they can be suspended and resumed in parallel with other
      devices they don't depend on in a known way (i.e. devices which are
      not their parents or children).
      
      This only affects the "regular" suspend and resume stages, which
      means in particular that the restoration of the PCI devices' standard
      configuration registers during resume will still be carried out
      synchronously (at the "early" resume stage).
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      a1e4d72c
    • Jiri Slaby's avatar
      PM / Hibernate: Swap, remove useless check from swsusp_read() · 09c09bc6
      Jiri Slaby authored
      It will never reach here if the sws_resume_bdev is erratic.
      swsusp_read() is called only from software_resume(), but after
      swsusp_check() which would catch the error state.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      09c09bc6
    • Jiri Slaby's avatar
      PM / Hibernate: Really deprecate deprecated user ioctls · b694e52e
      Jiri Slaby authored
      They were deprecated and removed from exported headers more than 2
      years ago. Inform users about their removal in the future now.
      
      (Switch cases needed to be reorderded for an easy fall through.)
      
      And add an entry to feature-removal-schedule.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Acked-by: default avatarPavel Machek <pavel@ucw.cz>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      b694e52e
    • Rafael J. Wysocki's avatar
      PM: Allow device drivers to use dpm_wait() · f8824cee
      Rafael J. Wysocki authored
      There are some dependencies between devices (in particular, between
      EHCI USB controllers and their OHCI/UHCI siblings) which are not
      reflected by the structure of the device tree.  With synchronous
      suspend and resume these dependencies are taken into accout
      automatically, because the devices in question are always registered
      in the right order, but to meet these constraints with asynchronous
      suspend and resume the drivers of these devices will need to use
      dpm_wait() in their suspend/resume routines, so introduce a helper
      function allowing them to do that.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      f8824cee
    • Rafael J. Wysocki's avatar
      PM: Start asynchronous resume threads upfront · 97df8c12
      Rafael J. Wysocki authored
      It has been shown by testing that total device resume time can be
      reduced significantly (by as much as 50% or more) if the async
      threads executing some devices' resume routines are all started
      before the main resume thread starts to handle the "synchronous"
      devices.
      
      This is a consequence of the fact that the slowest devices tend to be
      located at the end of dpm_list, so their resume routines are started
      very late.  Consequently, they have to wait for all the preceding
      "synchronous" devices before their resume routines can be started
      by the main resume thread, even if they are "asynchronous".  By
      starting their async threads upfront we effectively move those
      devices towards the beginning of dpm_list, without breaking their
      ordering with respect to their parents and children.  As a result,
      their resume routines are started much earlier and we are able to
      save much more device resume time this way.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      97df8c12
    • Rafael J. Wysocki's avatar
      PM: Add facility for advanced testing of async suspend/resume · 5a2eb858
      Rafael J. Wysocki authored
      Add configuration switch CONFIG_PM_ADVANCED_DEBUG for compiling in
      extra PM debugging/testing code allowing one to access some
      PM-related attributes of devices from the user space via sysfs.
      
      If CONFIG_PM_ADVANCED_DEBUG is set, add sysfs attribute power/async
      for every device allowing the user space to access the device's
      power.async_suspend flag and modify it, if desired.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      5a2eb858
    • Rafael J. Wysocki's avatar
      PM: Add a switch for disabling/enabling asynchronous suspend/resume · 0e06b4a8
      Rafael J. Wysocki authored
      Add sysfs attribute /sys/power/pm_async allowing the user space to
      disable/enable asynchronous suspend/resume of devices.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      0e06b4a8
    • Rafael J. Wysocki's avatar
      PM: Asynchronous suspend and resume of devices · 5af84b82
      Rafael J. Wysocki authored
      Theoretically, the total time of system sleep transitions (suspend
      to RAM, hibernation) can be reduced by running suspend and resume
      callbacks of device drivers in parallel with each other.  However,
      there are dependencies between devices such that we're not allowed
      to suspend the parent of a device before suspending the device
      itself.  Analogously, we're not allowed to resume a device before
      resuming its parent.
      
      The most straightforward way to take these dependencies into accout
      is to start the async threads used for suspending and resuming
      devices at the core level, so that async_schedule() is called for
      each suspend and resume callback supposed to be executed
      asynchronously.
      
      For this purpose, introduce a new device flag, power.async_suspend,
      used to mark the devices whose suspend and resume callbacks are to be
      executed asynchronously (ie. in parallel with the main suspend/resume
      thread and possibly in parallel with each other) and helper function
      device_enable_async_suspend() allowing one to set power.async_suspend
      for given device (power.async_suspend is unset by default for all
      devices).  For each device with the power.async_suspend flag set the
      PM core will use async_schedule() to execute its suspend and resume
      callbacks.
      
      The async threads started for different devices as a result of
      calling async_schedule() are synchronized with each other and with
      the main suspend/resume thread with the help of completions, in the
      following way:
      (1) There is a completion, power.completion, for each device object.
      (2) Each device's completion is reset before calling async_schedule()
          for the device or, in the case of devices with the
          power.async_suspend flags unset, before executing the device's
          suspend and resume callbacks.
      (3) During suspend, right before running the bus type, device type
          and device class suspend callbacks for the device, the PM core
          waits for the completions of all the device's children to be
          completed.
      (4) During resume, right before running the bus type, device type and
          device class resume callbacks for the device, the PM core waits
          for the completion of the device's parent to be completed.
      (5) The PM core completes power.completion for each device right
          after the bus type, device type and device class suspend (or
          resume) callbacks executed for the device have returned.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      5af84b82
    • Rafael J. Wysocki's avatar
      PM: Add parent information to timing messages · 8cc6b39f
      Rafael J. Wysocki authored
      Add parent information to the messages printed by the suspend/resume
      core when initcall_debug is set.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      8cc6b39f
    • Rafael J. Wysocki's avatar
      PM: Document device power attributes in sysfs · 971cb7fb
      Rafael J. Wysocki authored
      There are sysfs attributes in /sys/devices/.../power/ that haven't
      been documented yet in Documentation/ABI/.  Document them as
      appropriate.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      971cb7fb
    • Rafael J. Wysocki's avatar
      PM / Runtime: Add sysfs switch for disabling device run-time PM · 53823639
      Rafael J. Wysocki authored
      Add new device sysfs attribute, power/control, allowing the user
      space to block the run-time power management of the devices.  If this
      attribute is set to "on", the driver of the device won't be able to power
      manage it at run time (without breaking the rules) and the device will
      always be in the full power state (except when the entire system goes
      into a sleep state).
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      53823639
    • Linus Torvalds's avatar
      Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 · 68c6b859
      Linus Torvalds authored
      * 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (48 commits)
        x86/PCI: Prevent mmconfig memory corruption
        ACPI: Use GPE reference counting to support shared GPEs
        x86/PCI: use host bridge _CRS info by default on 2008 and newer machines
        PCI: augment bus resource table with a list
        PCI: add pci_bus_for_each_resource(), remove direct bus->resource[] refs
        PCI: read bridge windows before filling in subtractive decode resources
        PCI: split up pci_read_bridge_bases()
        PCIe PME: use pci_pcie_cap()
        PCI PM: Run-time callbacks for PCI bus type
        PCIe PME: use pci_is_pcie()
        PCI / ACPI / PM: Platform support for PCI PME wake-up
        ACPI / ACPICA: Multiple system notify handlers per device
        ACPI / PM: Add more run-time wake-up fields
        ACPI: Use GPE reference counting to support shared GPEs
        PCI PM: Make it possible to force using INTx for PCIe PME signaling
        PCI PM: PCIe PME root port service driver
        PCI PM: Add function for checking PME status of devices
        PCI: mark is_pcie obsolete
        PCI: set PCI_PREF_RANGE_TYPE_64 in pci_bridge_check_ranges
        PCI: pciehp: second try to get big range for pcie devices
        ...
      68c6b859
    • Linus Torvalds's avatar
      Lower USB storage settling delay to something more reasonable · a4a47bc0
      Linus Torvalds authored
      The five-second delay can be rather annoying, and makes the system
      appear much less responsive when you connect a USB drive.
      
      It's also not entirely clear that it is needed - the settling delay has
      at least historically been an issue on some Apple iPods, for example,
      and some devices have been reported to need even more than the old 5s
      delay.
      
      But before we penalize them all, let's see how bad it really is.  Some
      of the reasons for long delays seem to be actual historical kernel bugs
      that should probably never have been papered over with a delay in the
      first place (there's a Ubuntu bug report for 2.6.20 about a NULL pointer
      dereference unless 'delay_use' is 8 or more, for example).
      
      It also looks like some distros have already shipped with delay_use=0,
      so the five second default may well be totally historical.
      
      In other words: "Let's see if anybody screams".
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a4a47bc0
  2. 25 Feb, 2010 12 commits
  3. 24 Feb, 2010 9 commits