1. 10 12月, 2011 1 次提交
    • S
      PM / Sleep: Fix freezer failures due to racy usermodehelper_is_disabled() · b298d289
      Srivatsa S. Bhat 提交于
      Commit a144c6a6 (PM: Print a warning if firmware is requested when tasks
      are frozen) introduced usermodehelper_is_disabled() to warn and exit
      immediately if firmware is requested when usermodehelpers are disabled.
      
      However, it is racy. Consider the following scenario, currently used in
      drivers/base/firmware_class.c:
      
      ...
      if (usermodehelper_is_disabled())
              goto out;
      
      /* Do actual work */
      ...
      
      out:
              return err;
      
      Nothing prevents someone from disabling usermodehelpers just after the check
      in the 'if' condition, which means that it is quite possible to try doing the
      "actual work" with usermodehelpers disabled, leading to undesirable
      consequences.
      
      In particular, this race condition in _request_firmware() causes task freezing
      failures whenever suspend/hibernation is in progress because, it wrongly waits
      to get the firmware/microcode image from userspace when actually the
      usermodehelpers are disabled or userspace has been frozen.
      Some of the example scenarios that cause freezing failures due to this race
      are those that depend on userspace via request_firmware(), such as x86
      microcode module initialization and microcode image reload.
      
      Previous discussions about this issue can be found at:
      http://thread.gmane.org/gmane.linux.kernel/1198291/focus=1200591
      
      This patch adds proper synchronization to fix this issue.
      
      It is to be noted that this patchset fixes the freezing failures but doesn't
      remove the warnings. IOW, it does not attempt to add explicit synchronization
      to x86 microcode driver to avoid requesting microcode image at inopportune
      moments. Because, the warnings were introduced to highlight such cases, in the
      first place. And we need not silence the warnings, since we take care of the
      *real* problem (freezing failure) and hence, after that, the warnings are
      pretty harmless anyway.
      Signed-off-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      b298d289
  2. 09 12月, 2011 6 次提交
  3. 07 12月, 2011 8 次提交
  4. 25 11月, 2011 1 次提交
  5. 24 11月, 2011 14 次提交
    • S
      PM / Hibernate: Refactor and simplify hibernation_snapshot() code · 953a2063
      Srivatsa S. Bhat 提交于
      The goto statements in hibernation_snapshot() are a bit complex.
      Refactor the code to remove some of them, thereby simplifying the
      implementation.
      Signed-off-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      953a2063
    • R
      PM / Sleep: Simplify device_suspend_noirq() · 64e94aaf
      Rafael J. Wysocki 提交于
      Remove a few if () and return statements in device_suspend_noirq()
      that aren't really necessary.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      64e94aaf
    • R
      PM / Sleep: Remove unnecessary label and jumps to it form PM core code · d74e278a
      Rafael J. Wysocki 提交于
      The "End" label in device_prepare() in drivers/base/power/main.c is
      not necessary and the jumps to it have no real effect, so remove them
      all.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      d74e278a
    • S
      PM / Memory-hotplug: Avoid task freezing failures · 6a76b7a9
      Srivatsa S. Bhat 提交于
      The lock_system_sleep() function is used in the memory hotplug code at
      several places in order to implement mutual exclusion with hibernation.
      However, this function tries to acquire the 'pm_mutex' lock using
      mutex_lock() and hence blocks in TASK_UNINTERRUPTIBLE state if it doesn't
      get the lock. This would lead to task freezing failures and hence
      hibernation failure as a consequence, even though the hibernation call path
      successfully acquired the lock.
      
      But it is to be noted that, since this task tries to acquire pm_mutex, if it
      blocks due to this, we are *100% sure* that this task is not going to run
      as long as hibernation sequence is in progress, since hibernation releases
      'pm_mutex' only at the very end, when everything is done.
      And this means, this task is going to be anyway blocked for much more longer
      than what the freezer intends to achieve; which means, freezing and thawing
      doesn't really make any difference to this task!
      
      So, to fix freezing failures, we just ask the freezer to skip freezing this
      task, since it is already "frozen enough".
      
      But instead of calling freezer_do_not_count() and freezer_count() as it is,
      we use only the relevant parts of those functions, because restrictions
      such as 'the task should be a userspace one' etc., might not be relevant in
      this scenario.
      Signed-off-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      6a76b7a9
    • S
      PM: Fix indentation and remove extraneous whitespaces in kernel/power/main.c · 341d4166
      Srivatsa S. Bhat 提交于
      Lack of proper indentation of the goto statement decreases the readability
      of code significantly. In fact, this made me look twice at the code to check
      whether it really does what it should be doing. Fix this.
      
      And in the same file, there are some extra whitespaces. Get rid of them too.
      Signed-off-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      341d4166
    • R
      Merge branch 'pm-freezer' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc into pm-freezer · 986b11c3
      Rafael J. Wysocki 提交于
      * 'pm-freezer' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc: (24 commits)
        freezer: fix wait_event_freezable/__thaw_task races
        freezer: kill unused set_freezable_with_signal()
        dmatest: don't use set_freezable_with_signal()
        usb_storage: don't use set_freezable_with_signal()
        freezer: remove unused @sig_only from freeze_task()
        freezer: use lock_task_sighand() in fake_signal_wake_up()
        freezer: restructure __refrigerator()
        freezer: fix set_freezable[_with_signal]() race
        freezer: remove should_send_signal() and update frozen()
        freezer: remove now unused TIF_FREEZE
        freezer: make freezing() test freeze conditions in effect instead of TIF_FREEZE
        cgroup_freezer: prepare for removal of TIF_FREEZE
        freezer: clean up freeze_processes() failure path
        freezer: kill PF_FREEZING
        freezer: test freezable conditions while holding freezer_lock
        freezer: make freezing indicate freeze condition in effect
        freezer: use dedicated lock instead of task_lock() + memory barrier
        freezer: don't distinguish nosig tasks on thaw
        freezer: remove racy clear_freeze_flag() and set PF_NOFREEZE on dead tasks
        freezer: rename thaw_process() to __thaw_task() and simplify the implementation
        ...
      986b11c3
    • R
      PM / Hibernate: Do not leak memory in error/test code paths · bb58dd5d
      Rafael J. Wysocki 提交于
      The hibernation core code forgets to release memory preallocated
      for hibernation if there's an error in its early stages or if test
      modes causing hibernation_snapshot() to return early are used.  This
      causes the system to be hardly usable, because the amount of
      preallocated memory is usually huge.  Fix this problem.
      Reported-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      bb58dd5d
    • L
      f10cdea6
    • L
      Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging · 5907c5f8
      Linus Torvalds 提交于
      * 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
        i2c: Make i2cdev_notifier_call static
        i2c: Delete ANY_I2C_BUS
        i2c: Fix device name for 10-bit slave address
        i2c-algo-bit: Generate correct i2c address sequence for 10-bit target
      5907c5f8
    • L
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator · 0a2c9865
      Linus Torvalds 提交于
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
        regulator: TPS65910: Fix VDD1/2 voltage selector count
      0a2c9865
    • L
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · 2d0f2400
      Linus Torvalds 提交于
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (31 commits)
        drm: integer overflow in drm_mode_dirtyfb_ioctl()
        drivers/gpu/vga/vgaarb.c: add missing kfree
        drm/radeon/kms/atom: unify i2c gpio table handling
        drm/radeon/kms: fix up gpio i2c mask bits for r4xx for real
        ttm: Don't return the bo reserved on error path
        drm/radeon/kms: add a CS ioctl flag not to rewrite tiling flags in the CS
        drm/i915: Fix inconsistent backlight level during disabled
        drm, i915: Fix memory leak in i915_gem_busy_ioctl().
        drm/i915: Use DPCD value for max DP lanes.
        drm/i915: Initiate DP link training only on the lanes we'll be using
        drm/i915: Remove trailing white space
        drm/i915: Try harder during dp pattern 1 link training
        drm/i915: Make DP prepare/commit consistent with DP dpms
        drm/i915: Let panel power sequencing hardware do its job
        drm/i915: Treat PCH eDP like DP in most places
        drm/i915: Remove link_status field from intel_dp structure
        drm/i915: Move common PCH_PP_CONTROL setup to ironlake_get_pp_control
        drm/i915: Module parameters using '-1' as default must be signed type
        drm/i915: Turn on another required clock gating bit on gen6.
        drm/i915: Turn on a required 3D clock gating bit on Sandybridge.
        ...
      2d0f2400
    • O
      freezer: fix wait_event_freezable/__thaw_task races · 24b7ead3
      Oleg Nesterov 提交于
      wait_event_freezable() and friends stop the waiting if try_to_freeze()
      fails. This is not right, we can race with __thaw_task() and in this
      case
      
      	- wait_event_freezable() returns the wrong ERESTARTSYS
      
      	- wait_event_freezable_timeout() can return the positive
      	  value while condition == F
      
      Change the code to always check __retval/condition before return.
      
      Note: with or without this patch the timeout logic looks strange,
      probably we should recalc timeout if try_to_freeze() returns T.
      Signed-off-by: NOleg Nesterov <oleg@redhat.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      24b7ead3
    • T
      freezer: kill unused set_freezable_with_signal() · 34b087e4
      Tejun Heo 提交于
      There's no in-kernel user of set_freezable_with_signal() left.  Mixing
      TIF_SIGPENDING with kernel threads can lead to nasty corner cases as
      kernel threads never travel signal delivery path on their own.
      
      e.g. the current implementation is buggy in the cancelation path of
      __thaw_task().  It calls recalc_sigpending_and_wake() in an attempt to
      clear TIF_SIGPENDING but the function never clears it regardless of
      sigpending state.  This means that signallable freezable kthreads may
      continue executing with !freezing() && stuck TIF_SIGPENDING, which can
      be troublesome.
      
      This patch removes set_freezable_with_signal() along with
      PF_FREEZER_NOSIG and recalc_sigpending*() calls in freezer.  User
      tasks get TIF_SIGPENDING, kernel tasks get woken up and the spurious
      sigpending is dealt with in the usual signal delivery path.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NOleg Nesterov <oleg@redhat.com>
      34b087e4
    • T
      dmatest: don't use set_freezable_with_signal() · adfa543e
      Tejun Heo 提交于
      Commit 981ed70d (dmatest: make dmatest threads freezable) made
      dmatest kthread use set_freezable_with_signal(); however, the
      interface is scheduled to be removed in the next merge window.
      
      The problem is that unlike userland tasks there's no default place
      which handles signal pending state and it isn't clear who owns and/or
      is responsible for clearing TIF_SIGPENDING.  For example, in the
      current code, try_to_freeze() clears TIF_SIGPENDING but it isn't sure
      whether it actually owns the TIF_SIGPENDING nor is it race-free -
      ie. the task may continue to run with TIF_SIGPENDING set after the
      freezable section.
      
      Unfortunately, we don't have wait_for_completion_freezable_timeout().
      This patch open codes it and uses wait_event_freezable_timeout()
      instead and removes timeout reloading - wait_event_freezable_timeout()
      won't return across freezing events (currently racy but fix scheduled)
      and timer doesn't decrement while the task is in freezer.  Although
      this does lose timer-reset-over-freezing, given that timeout is
      supposed to be long enough and failure to finish inside is considered
      irrecoverable, I don't think this is worth the complexity.
      
      While at it, move completion to outer scope and explain that we're
      ignoring dangling pointer problem after timeout.  This should give
      slightly better chance at avoiding oops after timeout.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NDan Williams <dan.j.williams@intel.com>
      Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
      Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
      adfa543e
  6. 23 11月, 2011 10 次提交