1. 23 11月, 2016 21 次提交
  2. 27 9月, 2016 3 次提交
  3. 08 8月, 2016 1 次提交
    • M
      thermal: fix race condition when updating cooling device · d0b7306d
      Michele Di Giorgio 提交于
      When multiple thermal zones are bound to the same cooling device, multiple
      kernel threads may want to update the cooling device state by calling
      thermal_cdev_update(). Having cdev not protected by a mutex can lead to a race
      condition. Consider the following situation with two kernel threads k1 and k2:
      
      	    Thread k1				Thread k2
                                          ||
                                          ||  call thermal_cdev_update()
                                          ||      ...
                                          ||      set_cur_state(cdev, target);
          call power_actor_set_power()    ||
              ...                         ||
              instance->target = state;   ||
              cdev->updated = false;      ||
                                          ||      cdev->updated = true;
                                          ||      // completes execution
          call thermal_cdev_update()      ||
              // cdev->updated == true    ||
              return;                     ||
                                          \/
                                          time
      
      k2 has already looped through the thermal instances looking for the deepest
      cooling device state and is preempted right before setting cdev->updated to
      true. Now, k1 runs, modifies the thermal instance state and sets cdev->updated
      to false. Then, k1 is preempted and k2 continues the execution by setting
      cdev->updated to true, therefore preventing k1 from performing the update.
      Notice that this is not an issue if k2 looks at the instance->target modified by
      k1 "after" it is assigned by k1. In fact, in this case the update will happen
      anyway and k1 can safely return immediately from thermal_cdev_update().
      
      This may lead to a situation where a thermal governor never updates the cooling
      device. For example, this is the case for the step_wise governor: when calling
      the function thermal_zone_trip_update(), the governor may always get a new state
      equal to the old one (which, however, wasn't notified to the cooling device) and
      will therefore skip the update.
      
      CC: Zhang Rui <rui.zhang@intel.com>
      CC: Eduardo Valentin <edubezval@gmail.com>
      CC: Peter Feuerer <peter@piie.net>
      Reported-by: NToby Huang <toby.huang@arm.com>
      Signed-off-by: NMichele Di Giorgio <michele.digiorgio@arm.com>
      Reviewed-by: NJavi Merino <javi.merino@arm.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      d0b7306d
  4. 28 4月, 2016 1 次提交
  5. 21 4月, 2016 1 次提交
  6. 18 3月, 2016 1 次提交
  7. 07 1月, 2016 1 次提交
  8. 29 12月, 2015 3 次提交
  9. 14 9月, 2015 1 次提交
  10. 03 8月, 2015 7 次提交
    • S
      thermal: Add comment explaining test for critical temperature · 934c93b8
      Sascha Hauer 提交于
      The code testing if a temperature should be emulated or not is
      not obvious. Add a comment explaining why this test is done.
      Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de>
      Reviewed-by: NMikko Perttunen <mperttunen@nvidia.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      934c93b8
    • S
      thermal: Use IS_ENABLED instead of #ifdef · 79e5421c
      Sascha Hauer 提交于
      Use IS_ENABLED(CONFIG_THERMAL_EMULATION) to make the code more readable
      and to get rid of the addtional #ifdef around the variable definitions
      in thermal_zone_get_temp().
      Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de>
      Reviewed-by: NLukasz Majewski <l.majewski@samsung.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      79e5421c
    • S
      thermal: remove unnecessary call to thermal_zone_device_set_polling · dbdf2532
      Sascha Hauer 提交于
      When the thermal zone has no get_temp callback then thermal_zone_device_register()
      calls thermal_zone_device_set_polling() with a polling delay of 0. This
      only cancels the poll_queue. Since the poll_queue hasn't been scheduled this
      is a no-op. Remove it.
      Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de>
      Acked-by: NEduardo Valentin <edubezval@gmail.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      dbdf2532
    • S
      f6be0584
    • S
      thermal: consistently use int for temperatures · 17e8351a
      Sascha Hauer 提交于
      The thermal code uses int, long and unsigned long for temperatures
      in different places.
      
      Using an unsigned type limits the thermal framework to positive
      temperatures without need. Also several drivers currently will report
      temperatures near UINT_MAX for temperatures below 0°C. This will probably
      immediately shut the machine down due to overtemperature if started below
      0°C.
      
      'long' is 64bit on several architectures. This is not needed since INT_MAX °mC
      is above the melting point of all known materials.
      
      Consistently use a plain 'int' for temperatures throughout the thermal code and
      the drivers. This only changes the places in the drivers where the temperature
      is passed around as pointer, when drivers internally use another type this is
      not changed.
      Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de>
      Acked-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: NJean Delvare <jdelvare@suse.de>
      Reviewed-by: NLukasz Majewski <l.majewski@samsung.com>
      Reviewed-by: NDarren Hart <dvhart@linux.intel.com>
      Reviewed-by: NHeiko Stuebner <heiko@sntech.de>
      Reviewed-by: NPeter Feuerer <peter@piie.net>
      Cc: Punit Agrawal <punit.agrawal@arm.com>
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Eduardo Valentin <edubezval@gmail.com>
      Cc: linux-pm@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: Jean Delvare <jdelvare@suse.de>
      Cc: Peter Feuerer <peter@piie.net>
      Cc: Heiko Stuebner <heiko@sntech.de>
      Cc: Lukasz Majewski <l.majewski@samsung.com>
      Cc: Stephen Warren <swarren@wwwdotorg.org>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: linux-acpi@vger.kernel.org
      Cc: platform-driver-x86@vger.kernel.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-omap@vger.kernel.org
      Cc: linux-samsung-soc@vger.kernel.org
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
      Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: lm-sensors@lm-sensors.org
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      17e8351a
    • N
      thermal: add available policies sysfs attribute · 25a0a5ce
      Ni Wade 提交于
      The Linux thermal framework support to change thermal governor
      policy in userspace, but it can't show what available policies
      supported.
      
      This patch adds available_policies attribute to the thermal
      framework, it can list the thermal governors which can be
      used for a particular zone. This attribute is read only.
      Signed-off-by: NWei Ni <wni@nvidia.com>
      Reviewed-by: NJavi Merino <javi.merino@arm.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      25a0a5ce
    • V
      thermal: remove dangling 'weight_attr' device file · 528464ea
      Viresh Kumar 提交于
      This file isn't getting removed while we unbind a device from thermal
      zone. And this causes following messages when the device is registered
      again:
      
      WARNING: CPU: 0 PID: 2228 at /home/viresh/linux/fs/sysfs/dir.c:31 sysfs_warn_dup+0x60/0x70()
      sysfs: cannot create duplicate filename '/devices/virtual/thermal/thermal_zone0/cdev0_weight'
      Modules linked in: cpufreq_dt(+) [last unloaded: cpufreq_dt]
      CPU: 0 PID: 2228 Comm: insmod Not tainted 4.2.0-rc3-00059-g44fffd9473eb #272
      Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      [<c00153e8>] (unwind_backtrace) from [<c0012368>] (show_stack+0x10/0x14)
      [<c0012368>] (show_stack) from [<c053a684>] (dump_stack+0x84/0xc4)
      [<c053a684>] (dump_stack) from [<c002284c>] (warn_slowpath_common+0x80/0xb0)
      [<c002284c>] (warn_slowpath_common) from [<c00228ac>] (warn_slowpath_fmt+0x30/0x40)
      [<c00228ac>] (warn_slowpath_fmt) from [<c012d524>] (sysfs_warn_dup+0x60/0x70)
      [<c012d524>] (sysfs_warn_dup) from [<c012d244>] (sysfs_add_file_mode_ns+0x13c/0x190)
      [<c012d244>] (sysfs_add_file_mode_ns) from [<c012d2d4>] (sysfs_create_file_ns+0x3c/0x48)
      [<c012d2d4>] (sysfs_create_file_ns) from [<c03c04a8>] (thermal_zone_bind_cooling_device+0x260/0x358)
      [<c03c04a8>] (thermal_zone_bind_cooling_device) from [<c03c2e70>] (of_thermal_bind+0x88/0xb4)
      [<c03c2e70>] (of_thermal_bind) from [<c03c10d0>] (__thermal_cooling_device_register+0x17c/0x2e0)
      [<c03c10d0>] (__thermal_cooling_device_register) from [<c03c3f50>] (__cpufreq_cooling_register+0x3a0/0x51c)
      [<c03c3f50>] (__cpufreq_cooling_register) from [<bf00505c>] (cpufreq_ready+0x44/0x88 [cpufreq_dt])
      [<bf00505c>] (cpufreq_ready [cpufreq_dt]) from [<c03d6c30>] (cpufreq_add_dev+0x4a0/0x7dc)
      [<c03d6c30>] (cpufreq_add_dev) from [<c02cd3ec>] (subsys_interface_register+0x94/0xd8)
      [<c02cd3ec>] (subsys_interface_register) from [<c03d785c>] (cpufreq_register_driver+0x10c/0x1f0)
      [<c03d785c>] (cpufreq_register_driver) from [<bf0057d4>] (dt_cpufreq_probe+0x60/0x8c [cpufreq_dt])
      [<bf0057d4>] (dt_cpufreq_probe [cpufreq_dt]) from [<c02d03e4>] (platform_drv_probe+0x44/0xa4)
      [<c02d03e4>] (platform_drv_probe) from [<c02cead8>] (driver_probe_device+0x174/0x2b4)
      [<c02cead8>] (driver_probe_device) from [<c02ceca4>] (__driver_attach+0x8c/0x90)
      [<c02ceca4>] (__driver_attach) from [<c02cd078>] (bus_for_each_dev+0x68/0x9c)
      [<c02cd078>] (bus_for_each_dev) from [<c02ce2f0>] (bus_add_driver+0x19c/0x214)
      [<c02ce2f0>] (bus_add_driver) from [<c02cf490>] (driver_register+0x78/0xf8)
      [<c02cf490>] (driver_register) from [<c0009710>] (do_one_initcall+0x8c/0x1d4)
      [<c0009710>] (do_one_initcall) from [<c05396b0>] (do_init_module+0x5c/0x1b8)
      [<c05396b0>] (do_init_module) from [<c0086490>] (load_module+0xd34/0xed8)
      [<c0086490>] (load_module) from [<c0086704>] (SyS_init_module+0xd0/0x120)
      [<c0086704>] (SyS_init_module) from [<c000f480>] (ret_fast_syscall+0x0/0x3c)
      ---[ end trace 3be0e7b7dc6e3c4f ]---
      
      Fixes: db916513 ("thermal: export weight to sysfs")
      Acked-by: NJavi Merino <javi.merino@arm.com>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NEduardo Valentin <edubezval@gmail.com>
      528464ea