1. 21 7月, 2014 1 次提交
  2. 18 7月, 2014 1 次提交
    • B
      cpufreq: make table sentinel macros unsigned to match use · 2b1987a9
      Brian W Hart 提交于
      Commit 5eeaf1f1 (cpufreq: Fix build error on some platforms that
      use cpufreq_for_each_*) moved function cpufreq_next_valid() to a public
      header.  Warnings are now generated when objects including that header
      are built with -Wsign-compare (as an out-of-tree module might be):
      
      .../include/linux/cpufreq.h: In function ‘cpufreq_next_valid’:
      .../include/linux/cpufreq.h:519:27: warning: comparison between signed
      and unsigned integer expressions [-Wsign-compare]
        while ((*pos)->frequency != CPUFREQ_TABLE_END)
                                 ^
      .../include/linux/cpufreq.h:520:25: warning: comparison between signed
      and unsigned integer expressions [-Wsign-compare]
         if ((*pos)->frequency != CPUFREQ_ENTRY_INVALID)
                               ^
      
      Constants CPUFREQ_ENTRY_INVALID and CPUFREQ_TABLE_END are signed, but
      are used with unsigned member 'frequency' of cpufreq_frequency_table.
      Update the macro definitions to be explicitly unsigned to match their
      use.
      
      This also corrects potentially wrong behavior of clk_rate_table_iter()
      if unsigned long is wider than usigned int.
      
      Fixes: 5eeaf1f1 (cpufreq: Fix build error on some platforms that use cpufreq_for_each_*)
      Signed-off-by: NBrian W Hart <hartb@linux.vnet.ibm.com>
      Reviewed-by: NSimon Horman <horms+renesas@verge.net.au>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2b1987a9
  3. 06 6月, 2014 1 次提交
    • V
      cpufreq: add support for intermediate (stable) frequencies · 1c03a2d0
      Viresh Kumar 提交于
      Douglas Anderson, recently pointed out an interesting problem due to which
      udelay() was expiring earlier than it should.
      
      While transitioning between frequencies few platforms may temporarily switch to
      a stable frequency, waiting for the main PLL to stabilize.
      
      For example: When we transition between very low frequencies on exynos, like
      between 200MHz and 300MHz, we may temporarily switch to a PLL running at 800MHz.
      No CPUFREQ notification is sent for that. That means there's a period of time
      when we're running at 800MHz but loops_per_jiffy is calibrated at between 200MHz
      and 300MHz. And so udelay behaves badly.
      
      To get this fixed in a generic way, introduce another set of callbacks
      get_intermediate() and target_intermediate(), only for drivers with
      target_index() and CPUFREQ_ASYNC_NOTIFICATION unset.
      
      get_intermediate() should return a stable intermediate frequency platform wants
      to switch to, and target_intermediate() should set CPU to that frequency,
      before jumping to the frequency corresponding to 'index'. Core will take care of
      sending notifications and driver doesn't have to handle them in
      target_intermediate() or target_index().
      
      NOTE: ->target_index() should restore to policy->restore_freq in case of
      failures as core would send notifications for that.
      Tested-by: NStephen Warren <swarren@nvidia.com>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Reviewed-by: NDoug Anderson <dianders@chromium.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1c03a2d0
  4. 08 5月, 2014 1 次提交
  5. 07 5月, 2014 2 次提交
    • N
      PM / OPP: Move cpufreq specific OPP functions out of generic OPP library · a0dd7b79
      Nishanth Menon 提交于
      CPUFreq specific helper functions for OPP (Operating Performance Points)
      now use generic OPP functions that allow CPUFreq to be be moved back
      into CPUFreq framework. This allows for independent modifications
      or future enhancements as needed isolated to just CPUFreq framework
      alone.
      
      Here, we just move relevant code and documentation to make this part of
      CPUFreq infrastructure.
      
      Cc: Kevin Hilman <khilman@deeprootsystems.com>
      Signed-off-by: NNishanth Menon <nm@ti.com>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a0dd7b79
    • S
      cpufreq: Catch double invocations of cpufreq_freq_transition_begin/end · ca654dc3
      Srivatsa S. Bhat 提交于
      Some cpufreq drivers were redundantly invoking the _begin() and _end()
      APIs around frequency transitions, and this double invocation (one from
      the cpufreq core and the other from the cpufreq driver) used to result
      in a self-deadlock, leading to system hangs during boot. (The _begin()
      API makes contending callers wait until the previous invocation is
      complete. Hence, the cpufreq driver would end up waiting on itself!).
      
      Now all such drivers have been fixed, but debugging this issue was not
      very straight-forward (even lockdep didn't catch this). So let us add a
      debug infrastructure to the cpufreq core to catch such issues more easily
      in the future.
      
      We add a new field called 'transition_task' to the policy structure, to keep
      track of the task which is performing the frequency transition. Using this
      field, we make note of this task during _begin() and print a warning if we
      find a case where the same task is calling _begin() again, before completing
      the previous frequency transition using the corresponding _end().
      
      We have left out ASYNC_NOTIFICATION drivers from this debug infrastructure
      for 2 reasons:
      
      1. At the moment, we have no way to avoid a particular scenario where this
         debug infrastructure can emit false-positive warnings for such drivers.
         The scenario is depicted below:
      
               Task A						Task B
      
          /* 1st freq transition */
          Invoke _begin() {
                  ...
                  ...
          }
      
          Change the frequency
      
          /* 2nd freq transition */
          Invoke _begin() {
      	    ...	//waiting for B to
                  ... //finish _end() for
      	    ... //the 1st transition
      	    ...	      |				Got interrupt for successful
      	    ...	      |				change of frequency (1st one).
      	    ...       |
      	    ...	      |				/* 1st freq transition */
      	    ...	      |				Invoke _end() {
      	    ...	      |					...
      	    ...	      V				}
      	    ...
      	    ...
          }
      
         This scenario is actually deadlock-free because, once Task A changes the
         frequency, it is Task B's responsibility to invoke the corresponding
         _end() for the 1st frequency transition. Hence it is perfectly legal for
         Task A to go ahead and attempt another frequency transition in the meantime.
         (Of course it won't be able to proceed until Task B finishes the 1st _end(),
         but this doesn't cause a deadlock or a hang).
      
         The debug infrastructure cannot handle this scenario and will treat it as
         a deadlock and print a warning. To avoid this, we exclude such drivers
         from the purview of this code.
      
      2. Luckily, we don't _need_ this infrastructure for ASYNC_NOTIFICATION drivers
         at all! The cpufreq core does not automatically invoke the _begin() and
         _end() APIs during frequency transitions in such drivers. Thus, the driver
         alone is responsible for invoking _begin()/_end() and hence there shouldn't
         be any conflicts which lead to double invocations. So, we can skip these
         drivers, since the probability that such drivers will hit this problem is
         extremely low, as outlined above.
      Signed-off-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ca654dc3
  6. 30 4月, 2014 1 次提交
  7. 07 4月, 2014 1 次提交
    • V
      cpufreq: create another field .flags in cpufreq_frequency_table · 7f4b0461
      Viresh Kumar 提交于
      Currently cpufreq frequency table has two fields: frequency and driver_data.
      driver_data is only for drivers' internal use and cpufreq core shouldn't use
      it at all. But with the introduction of BOOST frequencies, this assumption
      was broken and we started using it as a flag instead.
      
      There are two problems due to this:
      - It is against the description of this field, as driver's data is used by
        the core now.
      - if drivers fill it with -3 for any frequency, then those frequencies are
        never considered by cpufreq core as it is exactly same as value of
        CPUFREQ_BOOST_FREQ, i.e. ~2.
      
      The best way to get this fixed is by creating another field flags which
      will be used for such flags. This patch does that. Along with that various
      drivers need modifications due to the change of struct cpufreq_frequency_table.
      Reviewed-by: NGautham R Shenoy <ego@linux.vnet.ibm.com>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      7f4b0461
  8. 26 3月, 2014 2 次提交
    • V
      cpufreq: Make cpufreq_notify_transition & cpufreq_notify_post_transition static · 236a9800
      Viresh Kumar 提交于
      cpufreq_notify_transition() and cpufreq_notify_post_transition() shouldn't be
      called directly by cpufreq drivers anymore and so these should be marked static.
      Reviewed-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      236a9800
    • S
      cpufreq: Make sure frequency transitions are serialized · 12478cf0
      Srivatsa S. Bhat 提交于
      Whenever we change the frequency of a CPU, we call the PRECHANGE and POSTCHANGE
      notifiers. They must be serialized, i.e. PRECHANGE and POSTCHANGE notifiers
      should strictly alternate, thereby preventing two different sets of PRECHANGE or
      POSTCHANGE notifiers from interleaving arbitrarily.
      
      The following examples illustrate why this is important:
      
      Scenario 1:
      -----------
      A thread reading the value of cpuinfo_cur_freq, will call
      __cpufreq_cpu_get()->cpufreq_out_of_sync()->cpufreq_notify_transition()
      
      The ondemand governor can decide to change the frequency of the CPU at the same
      time and hence it can end up sending the notifications via ->target().
      
      If the notifiers are not serialized, the following sequence can occur:
      - PRECHANGE Notification for freq A (from cpuinfo_cur_freq)
      - PRECHANGE Notification for freq B (from target())
      - Freq changed by target() to B
      - POSTCHANGE Notification for freq B
      - POSTCHANGE Notification for freq A
      
      We can see from the above that the last POSTCHANGE Notification happens for freq
      A but the hardware is set to run at freq B.
      
      Where would we break then?: adjust_jiffies() in cpufreq.c & cpufreq_callback()
      in arch/arm/kernel/smp.c (which also adjusts the jiffies). All the
      loops_per_jiffy calculations will get messed up.
      
      Scenario 2:
      -----------
      The governor calls __cpufreq_driver_target() to change the frequency. At the
      same time, if we change scaling_{min|max}_freq from sysfs, it will end up
      calling the governor's CPUFREQ_GOV_LIMITS notification, which will also call
      __cpufreq_driver_target(). And hence we end up issuing concurrent calls to
      ->target().
      
      Typically, platforms have the following logic in their ->target() routines:
      (Eg: cpufreq-cpu0, omap, exynos, etc)
      
      A. If new freq is more than old: Increase voltage
      B. Change freq
      C. If new freq is less than old: decrease voltage
      
      Now, if the two concurrent calls to ->target() are X and Y, where X is trying to
      increase the freq and Y is trying to decrease it, we get the following race
      condition:
      
      X.A: voltage gets increased for larger freq
      Y.A: nothing happens
      Y.B: freq gets decreased
      Y.C: voltage gets decreased
      X.B: freq gets increased
      X.C: nothing happens
      
      Thus we can end up setting a freq which is not supported by the voltage we have
      set. That will probably make the clock to the CPU unstable and the system might
      not work properly anymore.
      
      This patch introduces a set of synchronization primitives to serialize frequency
      transitions, which are to be used as shown below:
      
      cpufreq_freq_transition_begin();
      
      //Perform the frequency change
      
      cpufreq_freq_transition_end();
      
      The _begin() call sends the PRECHANGE notification whereas the _end() call sends
      the POSTCHANGE notification. Also, all the necessary synchronization is handled
      within these calls. In particular, even drivers which set the ASYNC_NOTIFICATION
      flag can also use these APIs for performing frequency transitions (ie., you can
      call _begin() from one task, and call the corresponding _end() from a different
      task).
      
      The actual synchronization underneath is not that complicated:
      
      The key challenge is to allow drivers to begin the transition from one thread
      and end it in a completely different thread (this is to enable drivers that do
      asynchronous POSTCHANGE notification from bottom-halves, to also use the same
      interface).
      
      To achieve this, a 'transition_ongoing' flag, a 'transition_lock' spinlock and a
      wait-queue are added per-policy. The flag and the wait-queue are used in
      conjunction to create an "uninterrupted flow" from _begin() to _end(). The
      spinlock is used to ensure that only one such "flow" is in flight at any given
      time. Put together, this provides us all the necessary synchronization.
      Signed-off-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      12478cf0
  9. 20 3月, 2014 1 次提交
  10. 19 3月, 2014 1 次提交
  11. 12 3月, 2014 2 次提交
  12. 06 3月, 2014 2 次提交
  13. 17 1月, 2014 3 次提交
    • L
      cpufreq: Add boost frequency support in core · 6f19efc0
      Lukasz Majewski 提交于
      This commit adds boost frequency support in cpufreq core (Hardware &
      Software). Some SoCs (like Exynos4 - e.g. 4x12) allow setting frequency
      above its normal operation limits. Such mode shall be only used for a
      short time.
      
      Overclocking (boost) support is essentially provided by platform
      dependent cpufreq driver.
      
      This commit unifies support for SW and HW (Intel) overclocking solutions
      in the core cpufreq driver. Previously the "boost" sysfs attribute was
      defined in the ACPI processor driver code. By default boost is disabled.
      One global attribute is available at: /sys/devices/system/cpu/cpufreq/boost.
      
      It only shows up when cpufreq driver supports overclocking.
      Under the hood frequencies dedicated for boosting are marked with a
      special flag (CPUFREQ_BOOST_FREQ) at driver's frequency table.
      It is the user's concern to enable/disable overclocking with a proper call
      to sysfs.
      
      The cpufreq_boost_trigger_state() function is defined non static on purpose.
      It is used later with thermal subsystem to provide automatic enable/disable
      of the BOOST feature.
      Signed-off-by: NLukasz Majewski <l.majewski@samsung.com>
      Signed-off-by: NMyungjoo Ham <myungjoo.ham@samsung.com>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6f19efc0
    • V
      cpufreq: introduce cpufreq_generic_get() routine · 652ed95d
      Viresh Kumar 提交于
      CPUFreq drivers that use clock frameworks interface,i.e. clk_get_rate(),
      to get CPUs clk rate, have similar sort of code used in most of them.
      
      This patch adds a generic ->get() which will do the same thing for them.
      All those drivers are required to now is to set .get to cpufreq_generic_get()
      and set their clk pointer in policy->clk during ->init().
      Acked-by: NHans-Christian Egtvedt <egtvedt@samfundet.no>
      Acked-by: NShawn Guo <shawn.guo@linaro.org>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      Acked-by: NShawn Guo <shawn.guo@linaro.org>
      Acked-by: NStephen Warren <swarren@nvidia.com>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      652ed95d
    • V
      cpufreq: stats: handle cpufreq_unregister_driver() and suspend/resume properly · fcd7af91
      Viresh Kumar 提交于
      There are several problems with cpufreq stats in the way it handles
      cpufreq_unregister_driver() and suspend/resume..
      
       - We must not lose data collected so far when suspend/resume happens
         and so stats directories must not be removed/allocated during these
         operations, which is done currently.
      
       - cpufreq_stat has registered notifiers with both cpufreq and hotplug.
         It adds sysfs stats directory with a cpufreq notifier: CPUFREQ_NOTIFY
         and removes this directory with a notifier from hotplug core.
      
         In case cpufreq_unregister_driver() is called (on rmmod cpufreq driver),
         stats directories per cpu aren't removed as CPUs are still online. The
         only call cpufreq_stats gets is cpufreq_stats_update_policy_cpu() for
         all CPUs except the last of each policy. And pointer to stat information
         is stored in the entry for last CPU in the per-cpu cpufreq_stats_table.
         But policy structure would be freed inside cpufreq core and so that will
         result in memory leak inside cpufreq stats (as we are never freeing
         memory for stats).
      
         Now if we again insert the module cpufreq_register_driver() will be
         called and we will again allocate stats data and put it on for first
         CPU of every policy.  In case we only have a single CPU per policy, we
         will return with a error from cpufreq_stats_create_table() due to this
         code:
      
      	if (per_cpu(cpufreq_stats_table, cpu))
      		return -EBUSY;
      
         And so probably cpufreq stats directory would not show up anymore (as
         it was added inside last policies->kobj which doesn't exist anymore).
         I haven't tested it, though. Also the values in stats files wouldn't
         be refreshed as we are using the earlier stats structure.
      
       - CPUFREQ_NOTIFY is called from cpufreq_set_policy() which is called for
         scenarios where we don't really want cpufreq_stat_notifier_policy() to get
         called. For example whenever we are changing anything related to a policy:
         min/max/current freq, etc. cpufreq_set_policy() is called and so cpufreq
         stats is notified. Where we don't do any useful stuff other than simply
         returning with -EBUSY from cpufreq_stats_create_table(). And so this
         isn't the right notifier that cpufreq stats..
      
       Due to all above reasons this patch does following changes:
       - Add new notifiers CPUFREQ_CREATE_POLICY and CPUFREQ_REMOVE_POLICY,
         which are only called when policy is created/destroyed. They aren't
         called for suspend/resume paths..
       - Use these notifiers in cpufreq_stat_notifier_policy() to create/destory
         stats sysfs entries. And so cpufreq_unregister_driver() or suspend/resume
         shouldn't be a problem for cpufreq_stats.
       - Return early from cpufreq_stat_cpu_callback() for suspend/resume sequence,
         so that we don't free stats structure.
      Acked-by: NNicolas Pitre <nico@linaro.org>
      Tested-by: NNicolas Pitre <nico@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      fcd7af91
  14. 06 1月, 2014 3 次提交
    • V
      cpufreq: Make sure CPU is running on a freq from freq-table · d3916691
      Viresh Kumar 提交于
      Sometimes boot loaders set CPU frequency to a value outside of frequency table
      present with cpufreq core. In such cases CPU might be unstable if it has to run
      on that frequency for long duration of time and so its better to set it to a
      frequency which is specified in freq-table. This also makes cpufreq stats
      inconsistent as cpufreq-stats would fail to register because current frequency
      of CPU isn't found in freq-table.
      
      Because we don't want this change to affect boot process badly, we go for the
      next freq which is >= policy->cur ('cur' must be set by now, otherwise we will
      end up setting freq to lowest of the table as 'cur' is initialized to zero).
      
      In case current frequency doesn't match any frequency from freq-table, we throw
      warnings to user, so that user can get this fixed in their bootloaders or
      freq-tables.
      Reported-by: NCarlos Hernandez <ceh@ti.com>
      Reported-and-tested-by: NNishanth Menon <nm@ti.com>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d3916691
    • V
      cpufreq: Mark ARM drivers with CPUFREQ_NEED_INITIAL_FREQ_CHECK flag · ae6b4271
      Viresh Kumar 提交于
      Sometimes boot loaders set CPU frequency to a value outside of frequency table
      present with cpufreq core. In such cases CPU might be unstable if it has to run
      on that frequency for long duration of time and so its better to set it to a
      frequency which is specified in frequency table.
      
      On some systems we can't really say what frequency we're running at the moment
      and so for these we shouldn't check if we are running at a frequency present in
      frequency table. And so we really can't force this for all the cpufreq drivers.
      
      Hence we are created another flag here: CPUFREQ_NEED_INITIAL_FREQ_CHECK that
      will be marked by platforms which want to go for this check at boot time.
      
      Initially this is done for all ARM platforms but others may follow if required.
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ae6b4271
    • V
      cpufreq: Introduce cpufreq_notify_post_transition() · f7ba3b41
      Viresh Kumar 提交于
      This introduces a new routine cpufreq_notify_post_transition() which
      can be used to send POSTCHANGE notification for new freq with or
      without both {PRE|POST}CHANGE notifications for last freq. This is
      useful at multiple places, especially for sending transition failure
      notifications.
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f7ba3b41
  15. 08 12月, 2013 1 次提交
  16. 28 11月, 2013 1 次提交
  17. 31 10月, 2013 1 次提交
  18. 26 10月, 2013 2 次提交
  19. 18 10月, 2013 1 次提交
  20. 16 10月, 2013 5 次提交
  21. 01 10月, 2013 1 次提交
    • V
      cpufreq: Add new helper cpufreq_table_validate_and_show() · 27047a60
      Viresh Kumar 提交于
      Almost every cpufreq driver is required to validate its frequency table with:
      cpufreq_frequency_table_cpuinfo() and then expose it to cpufreq core with:
      cpufreq_frequency_table_get_attr().
      
      This patch creates another helper routine cpufreq_table_validate_and_show() that
      will do both these steps in a single call and will return 0 for success, error
      otherwise.
      
      This also fixes potential bugs in cpufreq drivers where people have called
      cpufreq_frequency_table_get_attr() before calling
      cpufreq_frequency_table_cpuinfo(), as the later may fail.
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      27047a60
  22. 10 9月, 2013 3 次提交
    • R
      Revert "cpufreq: make sure frequency transitions are serialized" · 798282a8
      Rafael J. Wysocki 提交于
      Commit 7c30ed53 (cpufreq: make sure frequency transitions are
      serialized) attempted to serialize frequency transitions by
      adding checks to the CPUFREQ_PRECHANGE and CPUFREQ_POSTCHANGE
      notifications.  However, it assumed that the notifications will
      always originate from the driver's .target() callback, but they
      also can be triggered by cpufreq_out_of_sync() and that leads to
      warnings like this on some systems:
      
       WARNING: CPU: 0 PID: 14543 at drivers/cpufreq/cpufreq.c:317
       __cpufreq_notify_transition+0x238/0x260()
       In middle of another frequency transition
      
      accompanied by a call trace similar to this one:
      
       [<ffffffff81720daa>] dump_stack+0x46/0x58
       [<ffffffff8106534c>] warn_slowpath_common+0x8c/0xc0
       [<ffffffff815b8560>] ? acpi_cpufreq_target+0x320/0x320
       [<ffffffff81065436>] warn_slowpath_fmt+0x46/0x50
       [<ffffffff815b1ec8>] __cpufreq_notify_transition+0x238/0x260
       [<ffffffff815b33be>] cpufreq_notify_transition+0x3e/0x70
       [<ffffffff815b345d>] cpufreq_out_of_sync+0x6d/0xb0
       [<ffffffff815b370c>] cpufreq_update_policy+0x10c/0x160
       [<ffffffff815b3760>] ? cpufreq_update_policy+0x160/0x160
       [<ffffffff81413813>] cpufreq_set_cur_state+0x8c/0xb5
       [<ffffffff814138df>] processor_set_cur_state+0xa3/0xcf
       [<ffffffff8158e13c>] thermal_cdev_update+0x9c/0xb0
       [<ffffffff8159046a>] step_wise_throttle+0x5a/0x90
       [<ffffffff8158e21f>] handle_thermal_trip+0x4f/0x140
       [<ffffffff8158e377>] thermal_zone_device_update+0x57/0xa0
       [<ffffffff81415b36>] acpi_thermal_check+0x2e/0x30
       [<ffffffff81415ca0>] acpi_thermal_notify+0x40/0xdc
       [<ffffffff813e7dbd>] acpi_device_notify+0x19/0x1b
       [<ffffffff813f8241>] acpi_ev_notify_dispatch+0x41/0x5c
       [<ffffffff813e3fbe>] acpi_os_execute_deferred+0x25/0x32
       [<ffffffff81081060>] process_one_work+0x170/0x4a0
       [<ffffffff81082121>] worker_thread+0x121/0x390
       [<ffffffff81082000>] ? manage_workers.isra.20+0x170/0x170
       [<ffffffff81088fe0>] kthread+0xc0/0xd0
       [<ffffffff81088f20>] ? flush_kthread_worker+0xb0/0xb0
       [<ffffffff8173582c>] ret_from_fork+0x7c/0xb0
       [<ffffffff81088f20>] ? flush_kthread_worker+0xb0/0xb0
      
      For this reason, revert commit 7c30ed53 along with the fix 266c13d7
      (cpufreq: Fix serialization of frequency transitions) on top of it
      and we will revisit the serialization problem later.
      Reported-by: NAlessandro Bono <alessandro.bono@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      798282a8
    • S
      cpufreq: Remove temporary fix for race between CPU hotplug and sysfs-writes · 56d07db2
      Srivatsa S. Bhat 提交于
      Commit "cpufreq: serialize calls to __cpufreq_governor()" had been a temporary
      and partial solution to the race condition between writing to a cpufreq sysfs
      file and taking a CPU offline. Now that we have a proper and complete solution
      to that problem, remove the temporary fix.
      Signed-off-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      56d07db2
    • V
      cpufreq: serialize calls to __cpufreq_governor() · 19c76303
      Viresh Kumar 提交于
      We can't take a big lock around __cpufreq_governor() as this causes
      recursive locking for some cases. But calls to this routine must be
      serialized for every policy. Otherwise we can see some unpredictable
      events.
      
      For example, consider following scenario:
      
      __cpufreq_remove_dev()
       __cpufreq_governor(policy, CPUFREQ_GOV_STOP);
         policy->governor->governor(policy, CPUFREQ_GOV_STOP);
          cpufreq_governor_dbs()
           case CPUFREQ_GOV_STOP:
            mutex_destroy(&cpu_cdbs->timer_mutex)
            cpu_cdbs->cur_policy = NULL;
        <PREEMPT>
      store()
       __cpufreq_set_policy()
        __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS);
          policy->governor->governor(policy, CPUFREQ_GOV_LIMITS);
           case CPUFREQ_GOV_LIMITS:
            mutex_lock(&cpu_cdbs->timer_mutex); <-- Warning (destroyed mutex)
             if (policy->max < cpu_cdbs->cur_policy->cur) <- cur_policy == NULL
      
      And so store() will eventually result in a crash if cur_policy is
      NULL at this point.
      
      Introduce an additional variable which would guarantee serialization
      here.
      Reported-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      19c76303
  23. 10 8月, 2013 2 次提交
  24. 08 8月, 2013 1 次提交