1. 14 Mar, 2011 29 commits
    • Alexandre Courbot's avatar
      PM: Documentation/power/states.txt: fix repetition · a8b7228c
      Alexandre Courbot authored
      Remove repetition of "called swsusp".
      Signed-off-by: default avatarAlexandre Courbot <gnurou@gmail.com>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      a8b7228c
    • Rafael J. Wysocki's avatar
      PM: Make system-wide PM and runtime PM treat subsystems consistently · 9659cc06
      Rafael J. Wysocki authored
      The code handling system-wide power transitions (eg. suspend-to-RAM)
      can in theory execute callbacks provided by the device's bus type,
      device type and class in each phase of the power transition.  In
      turn, the runtime PM core code only calls one of those callbacks at
      a time, preferring bus type callbacks to device type or class
      callbacks and device type callbacks to class callbacks.
      
      It seems reasonable to make them both behave in the same way in that
      respect.  Moreover, even though a device may belong to two subsystems
      (eg. bus type and device class) simultaneously, in practice power
      management callbacks for system-wide power transitions are always
      provided by only one of them (ie. if the bus type callbacks are
      defined, the device class ones are not and vice versa).  Thus it is
      possible to modify the code handling system-wide power transitions
      so that it follows the core runtime PM code (ie. treats the
      subsystem callbacks as mutually exclusive).
      
      On the other hand, the core runtime PM code will choose to execute,
      for example, a runtime suspend callback provided by the device type
      even if the bus type's struct dev_pm_ops object exists, but the
      runtime_suspend pointer in it happens to be NULL.  This is confusing,
      because it may lead to the execution of callbacks from different
      subsystems during different operations (eg. the bus type suspend
      callback may be executed during runtime suspend of the device, while
      the device type callback will be executed during system suspend).
      
      Make all of the power management code treat subsystem callbacks in
      a consistent way, such that:
      (1) If the device's type is defined (eg. dev->type is not NULL)
          and its pm pointer is not NULL, the callbacks from dev->type->pm
          will be used.
      (2) If dev->type is NULL or dev->type->pm is NULL, but the device's
          class is defined (eg. dev->class is not NULL) and its pm pointer
          is not NULL, the callbacks from dev->class->pm will be used.
      (3) If dev->type is NULL or dev->type->pm is NULL and dev->class is
          NULL or dev->class->pm is NULL, the callbacks from dev->bus->pm
          will be used provided that both dev->bus and dev->bus->pm are
          not NULL.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: default avatarKevin Hilman <khilman@ti.com>
      Reasoning-sounds-sane-to: Grant Likely <grant.likely@secretlab.ca>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      9659cc06
    • Jan Beulich's avatar
      PM: Simplify kernel/power/Kconfig · cf4fb80c
      Jan Beulich authored
      'n' defaults are pretty pointless and actually bogus when used with
      prompt-less config options.
      
      The "bool"/"default y" pair with no prompt can be expressed more
      compactly using def_bool.
      
      [rjw: Rebased on top of earlier patches modifying this file.]
      Signed-off-by: default avatarJan Beulich <jbeulich@novell.com>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      cf4fb80c
    • Rafael J. Wysocki's avatar
      PM: Add support for device power domains · 7538e3db
      Rafael J. Wysocki authored
      The platform bus type is often used to handle Systems-on-a-Chip (SoC)
      where all devices are represented by objects of type struct
      platform_device.  In those cases the same "platform" device driver
      may be used with multiple different system configurations, but the
      actions needed to put the devices it handles into a low-power state
      and back into the full-power state may depend on the design of the
      given SoC.  The driver, however, cannot possibly include all the
      information necessary for the power management of its device on all
      the systems it is used with.  Moreover, the device hierarchy in its
      current form also is not suitable for representing this kind of
      information.
      
      The patch below attempts to address this problem by introducing
      objects of type struct dev_power_domain that can be used for
      representing power domains within a SoC.  Every struct
      dev_power_domain object provides a sets of device power
      management callbacks that can be used to perform what's needed for
      device power management in addition to the operations carried out by
      the device's driver and subsystem.
      
      Namely, if a struct dev_power_domain object is pointed to by the
      pwr_domain field in a struct device, the callbacks provided by its
      ops member will be executed in addition to the corresponding
      callbacks provided by the device's subsystem and driver during all
      power transitions.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Tested-and-acked-by: default avatarKevin Hilman <khilman@ti.com>
      7538e3db
    • Rafael J. Wysocki's avatar
      PM: Drop pm_flags that is not necessary · 6831c6ed
      Rafael J. Wysocki authored
      The variable pm_flags is used to prevent APM from being enabled
      along with ACPI, which would lead to problems.  However, acpi_init()
      is always called before apm_init() and after acpi_init() has
      returned, it is known whether or not ACPI will be used.  Namely, if
      acpi_disabled is not set after acpi_init() has returned, this means
      that ACPI is enabled.  Thus, it is sufficient to check acpi_disabled
      in apm_init() to prevent APM from being enabled in parallel with
      ACPI.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: default avatarLen Brown <len.brown@intel.com>
      6831c6ed
    • Rafael J. Wysocki's avatar
      PM: Allow pm_runtime_suspend() to succeed during system suspend · e8665002
      Rafael J. Wysocki authored
      The dpm_prepare() function increments the runtime PM reference
      counters of all devices to prevent pm_runtime_suspend() from
      executing subsystem-level callbacks.  However, this was supposed to
      guard against a specific race condition that cannot happen, because
      the power management workqueue is freezable, so pm_runtime_suspend()
      can only be called synchronously during system suspend and we can
      rely on subsystems and device drivers to avoid doing that
      unnecessarily.
      
      Make dpm_prepare() drop the runtime PM reference to each device
      after making sure that runtime resume is not pending for it.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: default avatarKevin Hilman <khilman@ti.com>
      e8665002
    • Rafael J. Wysocki's avatar
      PM: Clean up PM_TRACE dependencies and drop unnecessary Kconfig option · 88a6f33e
      Rafael J. Wysocki authored
      CONFIG_PM_SLEEP_ADVANCED_DEBUG is not used any more, so drop it
      and CONFIG_CAN_PM_TRACE need not depend on EXPERIMENTAL, so remove
      that dependency.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      88a6f33e
    • Rafael J. Wysocki's avatar
      PM: Remove CONFIG_PM_OPS · aa338601
      Rafael J. Wysocki authored
      After redefining CONFIG_PM to depend on (CONFIG_PM_SLEEP ||
      CONFIG_PM_RUNTIME) the CONFIG_PM_OPS option is redundant and can be
      replaced with CONFIG_PM.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      aa338601
    • Rafael J. Wysocki's avatar
      PM: Reorder power management Kconfig options · 196ec243
      Rafael J. Wysocki authored
      Reorder configuration options in kernel/power/Kconfig so that
      the options depended on are at the top of the list.
      
      This patch doesn't introduce any functional changes.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      196ec243
    • Rafael J. Wysocki's avatar
      PM: Make CONFIG_PM depend on (CONFIG_PM_SLEEP || CONFIG_PM_RUNTIME) · 1eb208ae
      Rafael J. Wysocki authored
      From the users' point of view CONFIG_PM is really only used for
      making it possible to set CONFIG_SUSPEND, CONFIG_HIBERNATION,
      CONFIG_PM_RUNTIME and (surprisingly enough) CONFIG_XEN_SAVE_RESTORE
      (CONFIG_PM_OPP also depends on CONFIG_PM, but quite artificially).
      However, both CONFIG_SUSPEND and CONFIG_HIBERNATION require platform
      support (independent of CONFIG_PM) and it is not quite obvious that
      CONFIG_PM has to be set for CONFIG_XEN_SAVE_RESTORE to be available.
      Thus, from the users' point of view, it would be more logical to
      automatically select CONFIG_PM if any of the above options depending
      on it are set.
      
      Make CONFIG_PM depend on (CONFIG_PM_SLEEP || CONFIG_PM_RUNTIME),
      which will cause it to be selected when any of CONFIG_SUSPEND,
      CONFIG_HIBERNATION, CONFIG_PM_RUNTIME, CONFIG_XEN_SAVE_RESTORE is
      set and will clarify its meaning.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      1eb208ae
    • Rafael J. Wysocki's avatar
      PM / ACPI: Remove references to pm_flags from bus.c · cd51e61c
      Rafael J. Wysocki authored
      If direct references to pm_flags are removed from drivers/acpi/bus.c,
      CONFIG_ACPI will not need to depend on CONFIG_PM any more.  Make that
      happen.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: default avatarLen Brown <len.brown@intel.com>
      cd51e61c
    • Rafael J. Wysocki's avatar
      PM: Do not create wakeup sysfs files for devices that cannot wake up · cb8f51bd
      Rafael J. Wysocki authored
      Currently, wakeup sysfs attributes are created for all devices,
      regardless of whether or not they are wakeup-capable.  This is
      excessive and complicates wakeup device identification from user
      space (i.e. to identify wakeup-capable devices user space has to read
      /sys/devices/.../power/wakeup for all devices and see if they are not
      empty).
      
      Fix this issue by avoiding to create wakeup sysfs files for devices
      that cannot wake up the system from sleep states (i.e. whose
      power.can_wakeup flags are unset during registration) and modify
      device_set_wakeup_capable() so that it adds (or removes) the relevant
      sysfs attributes if a device's wakeup capability status is changed.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      cb8f51bd
    • Rafael J. Wysocki's avatar
      USB / Hub: Do not call device_set_wakeup_capable() under spinlock · 4681b171
      Rafael J. Wysocki authored
      A subsequent patch will modify device_set_wakeup_capable() in such
      a way that it will call functions which may sleep and therefore it
      shouldn't be called under spinlocks.  In preparation to that, modify
      usb_set_device_state() to avoid calling device_set_wakeup_capable()
      under device_state_lock.
      Tested-by: default avatarMinchan Kim <minchan.kim@gmail.com>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      4681b171
    • Mandeep Singh Baines's avatar
      PM: Use appropriate printk() priority level in trace.c · 0295a34d
      Mandeep Singh Baines authored
      printk()s without a priority level default to KERN_WARNING. To reduce
      noise at KERN_WARNING, this patch sets the priority level appriopriately
      for unleveled printks()s. This should be useful to folks that look at
      dmesg warnings closely.
      
      Changed these messages to pr_info().
      Signed-off-by: default avatarMandeep Singh Baines <msb@chromium.org>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      0295a34d
    • Rafael J. Wysocki's avatar
      PM / Wakeup: Don't update events_check_enabled in pm_get_wakeup_count() · 790c7885
      Rafael J. Wysocki authored
      Since pm_save_wakeup_count() has just been changed to clear
      events_check_enabled unconditionally before checking if there are
      any new wakeup events registered since the last read from
      /sys/power/wakeup_count, the detection of wakeup events during
      suspend may be disabled, after it's been enabled, by writing a
      "wrong" value back to /sys/power/wakeup_count.  For this reason,
      it is not necessary to update events_check_enabled in
      pm_get_wakeup_count() any more.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      790c7885
    • Rafael J. Wysocki's avatar
      PM / Wakeup: Make pm_save_wakeup_count() work as documented · 378eef99
      Rafael J. Wysocki authored
      According to Documentation/ABI/testing/sysfs-power, the
      /sys/power/wakeup_count interface should only make the kernel react
      to wakeup events during suspend if the last write to it has been
      successful.  However, if /sys/power/wakeup_count is written to two
      times in a row, where the first write is successful and the second
      is not, the kernel will still react to wakeup events during suspend
      due to a bug in pm_save_wakeup_count().
      
      Fix the bug by making pm_save_wakeup_count() clear
      events_check_enabled unconditionally before checking if there are
      any new wakeup events registered since the previous read from
      /sys/power/wakeup_count.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      378eef99
    • Rafael J. Wysocki's avatar
      PM / Wakeup: Combine atomic counters to avoid reordering issues · 023d3779
      Rafael J. Wysocki authored
      The memory barrier in wakeup_source_deactivate() is supposed to
      prevent the callers of pm_wakeup_pending() and pm_get_wakeup_count()
      from seeing the new value of events_in_progress (0, in particular)
      and the old value of event_count at the same time.  However, if
      wakeup_source_deactivate() is executed by CPU0 and, for instance,
      pm_wakeup_pending() is executed by CPU1, where both processors can
      reorder operations, the memory barrier in wakeup_source_deactivate()
      doesn't affect CPU1 which can reorder reads.  In that case CPU1 may
      very well decide to fetch event_count before it's modified and
      events_in_progress after it's been updated, so pm_wakeup_pending()
      may fail to detect a wakeup event.  This issue can be addressed by
      using a single atomic variable to store both events_in_progress
      and event_count, so that they can be updated together in a single
      atomic operation.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      023d3779
    • Oleg Nesterov's avatar
      oom: oom_kill_process: fix the child_points logic · dc1b83ab
      Oleg Nesterov authored
      oom_kill_process() starts with victim_points == 0.  This means that
      (most likely) any child has more points and can be killed erroneously.
      
      Also, "children has a different mm" doesn't match the reality, we should
      check child->mm != t->mm.  This check is not exactly correct if t->mm ==
      NULL but this doesn't really matter, oom_kill_task() will kill them
      anyway.
      
      Note: "Kill all processes sharing p->mm" in oom_kill_task() is wrong
      too.
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      dc1b83ab
    • Linus Torvalds's avatar
      Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6 · 5f40d420
      Linus Torvalds authored
      * 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
        NFS: NFSROOT should default to "proto=udp"
        nfs4: remove duplicated #include
        NFSv4: nfs4_state_mark_reclaim_nograce() should be static
        NFSv4: Fix the setlk error handler
        NFSv4.1: Fix the handling of the SEQUENCE status bits
        NFSv4/4.1: Fix nfs4_schedule_state_recovery abuses
        NFSv4.1 reclaim complete must wait for completion
        NFSv4: remove duplicate clientid in struct nfs_client
        NFSv4.1: Retry CREATE_SESSION on NFS4ERR_DELAY
        sunrpc: Propagate errors from xs_bind() through xs_create_sock()
        (try3-resend) Fix nfs_compat_user_ino64 so it doesn't cause problems if bit 31 or 63 are set in fileid
        nfs: fix compilation warning
        nfs: add kmalloc return value check in decode_and_add_ds
        SUNRPC: Remove resource leak in svc_rdma_send_error()
        nfs: close NFSv4 COMMIT vs. CLOSE race
        SUNRPC: Close a race in __rpc_wait_for_completion_task()
      5f40d420
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6 · 215fd2fa
      Linus Torvalds authored
      * 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
        drm/radeon: fix problem with changing active VRAM size. (v2)
      215fd2fa
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog · 786c58b7
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog:
        watchdog: hpwdt: eliminate section mismatch warning
        watchdog: w83697ug_wdt: Fix set bit 0 to activate GPIO2
        watchdog: sch311x_wdt: fix printk condition
        watchdog: sch311x_wdt: Fix LDN active check
        watchdog: cpwd: Fix buffer-overflow
      786c58b7
    • Timo Warns's avatar
      Fix corrupted OSF partition table parsing · 1eafbfeb
      Timo Warns authored
      The kernel automatically evaluates partition tables of storage devices.
      The code for evaluating OSF partitions contains a bug that leaks data
      from kernel heap memory to userspace for certain corrupted OSF
      partitions.
      
      In more detail:
      
        for (i = 0 ; i < le16_to_cpu(label->d_npartitions); i++, partition++) {
      
      iterates from 0 to d_npartitions - 1, where d_npartitions is read from
      the partition table without validation and partition is a pointer to an
      array of at most 8 d_partitions.
      
      Add the proper and obvious validation.
      Signed-off-by: default avatarTimo Warns <warns@pre-sense.de>
      Cc: stable@kernel.org
      [ Changed the patch trivially to not repeat the whole le16_to_cpu()
        thing, and to use an explicit constant for the magic value '8' ]
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1eafbfeb
    • Hugh Dickins's avatar
      thp+memcg-numa: fix BUG at include/linux/mm.h:370! · 2fbfac4e
      Hugh Dickins authored
      THP's collapse_huge_page() has an understandable but ugly difference
      in when its huge page is allocated: inside if NUMA but outside if not.
      It's hardly surprising that the memcg failure path forgot that, freeing
      the page in the non-NUMA case, then hitting a VM_BUG_ON in get_page()
      (or even worse, using the freed page).
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Reviewed-by: default avatarMinchan Kim <minchan.kim@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2fbfac4e
    • Axel Lin's avatar
      watchdog: hpwdt: eliminate section mismatch warning · b77b7088
      Axel Lin authored
      hpwdt_init_nmi_decoding() is called in hpwdt_init_one error handling,
      thus remove the  __devexit annotation of hpwdt_exit_nmi_decoding().
      
      This patch fixes below warning:
      
      WARNING: drivers/watchdog/hpwdt.o(.devinit.text+0x36f): Section mismatch in reference from the function hpwdt_init_one() to the function .devexit.text:hpwdt_exit_nmi_decoding()
      The function __devinit hpwdt_init_one() references
      a function __devexit hpwdt_exit_nmi_decoding().
      This is often seen when error handling in the init function
      uses functionality in the exit path.
      The fix is often to remove the __devexit annotation of
      hpwdt_exit_nmi_decoding() so it may be used outside an exit section.
      Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
      Acked-by: default avatarThomas Mingarelli <Thomas.Mingarelli@hp.com>
      Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
      b77b7088
    • Wim Van Sebroeck's avatar
      watchdog: w83697ug_wdt: Fix set bit 0 to activate GPIO2 · 943413c5
      Wim Van Sebroeck authored
      outb_p(c || 0x01, WDT_EFDR); -> || should be |
      Reported-By: default avatarToralf Förster <toralf.foerster@gmx.de>
      Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
      943413c5
    • Dan Carpenter's avatar
      watchdog: sch311x_wdt: fix printk condition · 6899a8e1
      Dan Carpenter authored
      "==" has higher precedence than "&".  Since
      if (sch311x_sio_inb(sio_config_port, 0x30) & (0x01 == 0)) is always
      false the message is never printed.
      Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
      Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
      6899a8e1
    • Wim Van Sebroeck's avatar
      watchdog: sch311x_wdt: Fix LDN active check · a450c786
      Wim Van Sebroeck authored
      if (sch311x_sio_inb(sio_config_port, 0x30) && 0x01 == 0) -> && should be &
      Reported-By: default avatarToralf Förster <toralf.foerster@gmx.de>
      Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
      a450c786
    • Wim Van Sebroeck's avatar
      watchdog: cpwd: Fix buffer-overflow · bbd562d7
      Wim Van Sebroeck authored
      cppcheck-1.47 reports:
      [drivers/watchdog/cpwd.c:650]: (error) Buffer access out-of-bounds: p.devs
      
      The source code is
      	for (i = 0; i < 4; i++) {
      		misc_deregister(&p->devs[i].misc);
      
      where devs is defined as WD_NUMDEVS big and WD_NUMDEVS is equal to 3.
      So the 4 should be a 3 or WD_NUMDEVS.
      
      Reported-By: David Binderman
      Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
      bbd562d7
    • Dave Airlie's avatar
      drm/radeon: fix problem with changing active VRAM size. (v2) · 53595338
      Dave Airlie authored
      So we used to use lpfn directly to restrict VRAM when we couldn't
      access the unmappable area, however this was removed in
      93225b0d as it also restricted
      the gtt placements. However it was only later noticed that this
      broke on some hw.
      
      This removes the active_vram_size, and just explicitly sets it
      when it changes, TTM/drm_mm will always use the real_vram_size,
      and the active vram size will change the TTM size used for lpfn
      setting.
      
      We should re-work the fpfn/lpfn to per-placement at some point
      I suspect, but that is too late for this kernel.
      
      Hopefully this addresses:
      https://bugs.freedesktop.org/show_bug.cgi?id=35254
      
      v2: fix reported useful VRAM size to userspace to be correct.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      53595338
  2. 13 Mar, 2011 11 commits