1. 02 4月, 2018 1 次提交
    • V
      thermal: Add cooling device's statistics in sysfs · 8ea22951
      Viresh Kumar 提交于
      This extends the sysfs interface for thermal cooling devices and exposes
      some pretty useful statistics. These statistics have proven to be quite
      useful specially while doing benchmarks related to the task scheduler,
      where we want to make sure that nothing has disrupted the test,
      specially the cooling device which may have put constraints on the CPUs.
      The information exposed here tells us to what extent the CPUs were
      constrained by the thermal framework.
      
      The write-only "reset" file is used to reset the statistics.
      
      The read-only "time_in_state_ms" file shows the time (in msec) spent by the
      device in the respective cooling states, and it prints one line per
      cooling state.
      
      The read-only "total_trans" file shows single positive integer value
      showing the total number of cooling state transitions the device has
      gone through since the time the cooling device is registered or the time
      when statistics were reset last.
      
      The read-only "trans_table" file shows a two dimensional matrix, where
      an entry <i,j> (row i, column j) represents the number of transitions
      from State_i to State_j.
      
      This is how the directory structure looks like for a single cooling
      device:
      
      $ ls -R /sys/class/thermal/cooling_device0/
      /sys/class/thermal/cooling_device0/:
      cur_state  max_state  power  stats  subsystem  type  uevent
      
      /sys/class/thermal/cooling_device0/power:
      autosuspend_delay_ms  runtime_active_time  runtime_suspended_time
      control               runtime_status
      
      /sys/class/thermal/cooling_device0/stats:
      reset  time_in_state_ms  total_trans  trans_table
      
      This is tested on ARM 64-bit Hisilicon hikey620 board running Ubuntu and
      ARM 64-bit Hisilicon hikey960 board running Android.
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      8ea22951
  2. 11 8月, 2017 2 次提交
  3. 08 8月, 2017 1 次提交
  4. 24 5月, 2017 1 次提交
  5. 05 5月, 2017 2 次提交
    • K
      thermal: core: Add a back up thermal shutdown mechanism · ef1d87e0
      Keerthy 提交于
      orderly_poweroff is triggered when a graceful shutdown
      of system is desired. This may be used in many critical states of the
      kernel such as when subsystems detects conditions such as critical
      temperature conditions. However, in certain conditions in system
      boot up sequences like those in the middle of driver probes being
      initiated, userspace will be unable to power off the system in a clean
      manner and leaves the system in a critical state. In cases like these,
      the /sbin/poweroff will return success (having forked off to attempt
      powering off the system. However, the system overall will fail to
      completely poweroff (since other modules will be probed) and the system
      is still functional with no userspace (since that would have shut itself
      off).
      
      However, there is no clean way of detecting such failure of userspace
      powering off the system. In such scenarios, it is necessary for a backup
      workqueue to be able to force a shutdown of the system when orderly
      shutdown is not successful after a configurable time period.
      Reported-by: NNishanth Menon <nm@ti.com>
      Signed-off-by: NKeerthy <j-keerthy@ti.com>
      Acked-by: NEduardo Valentin <edubezval@gmail.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      ef1d87e0
    • K
      thermal: core: Allow orderly_poweroff to be called only once · e441fd68
      Keerthy 提交于
      thermal_zone_device_check --> thermal_zone_device_update -->
      handle_thermal_trip --> handle_critical_trips --> orderly_poweroff
      
      The above sequence happens every 250/500 mS based on the configuration.
      The orderly_poweroff function is getting called every 250/500 mS.
      With a full fledged file system it takes at least 5-10 Seconds to
      power off gracefully.
      
      In that period due to the thermal_zone_device_check triggering
      periodically the thermal work queues bombard with
      orderly_poweroff calls multiple times eventually leading to
      failures in gracefully powering off the system.
      
      Make sure that orderly_poweroff is called only once.
      Signed-off-by: NKeerthy <j-keerthy@ti.com>
      Acked-by: NEduardo Valentin <edubezval@gmail.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      e441fd68
  6. 06 1月, 2017 1 次提交
    • J
      thermal: core: move tz->device.groups cleanup to thermal_release · f53345e8
      Jacob von Chorus 提交于
      The device_unregister call in thermal_zone_device_unregister causes the
      thermal_zone_device structure to be freed before the call to free the
      dynamically allocated attribute groups. This leads to a kernel panic.
      
      Furthermore, the 4 calls to free the trip point attribute structures
      occur before the call to unregister the device, leading to a kernel
      panic when sysfs attempts to access the attributes to remove them.
      
      Here is an example of a kernel panic when the cpu thermal zones are
      removed upon cpu offline:
      BUG: unable to handle kernel NULL pointer dereference at (null)
      IP: strlen+0x0/0x20
      <snip>
      Call Trace:
         ? kernfs_name_hash+0x17/0x80
         kernfs_find_ns+0x3f/0xd0
         kernfs_remove_by_name_ns+0x36/0xa0
         remove_files.isra.1+0x36/0x70
         sysfs_remove_group+0x44/0x90
         sysfs_remove_groups+0x2e/0x50
         device_remove_attrs+0x5e/0x90
         device_del+0x1ea/0x350
         device_unregister+0x1a/0x60
         thermal_zone_device_unregister+0x1f2/0x210
         pkg_thermal_cpu_offline+0x14f/0x1a0 [x86_pkg_temp_thermal]
         ? kzalloc.constprop.2+0x10/0x10 [x86_pkg_temp_thermal]
         cpuhp_invoke_callback+0x8d/0x3f0
         cpuhp_down_callbacks+0x42/0x80
         cpuhp_thread_fun+0x8b/0xf0
         smpboot_thread_fn+0x110/0x160
         kthread+0x101/0x140
         ? sort_range+0x30/0x30
         ? kthread_park+0x90/0x90
         ret_from_fork+0x25/0x30
      
      This patch moves the kfree calls to clean up the dynamic attributes to
      the thermal_class's thermal_zone_device release function.
      
      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
      Tested-by: NYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Signed-off-by: NJacob von Chorus <jacobvonchorus@cwphoto.ca>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      f53345e8
  7. 04 1月, 2017 1 次提交
  8. 23 11月, 2016 31 次提交