这里会显示出您选择的修订版和当前版本之间的差别。
jaysnote:linux_cooling_device [2019/04/15 14:04] jaylee |
jaysnote:linux_cooling_device [2021/06/22 23:14] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | < | ||
- | |||
- | # linux cooling device | ||
- | |||
- | 这里详细介绍并理解基于 allwinner a64 linux 下根据[热量传感器](http:// | ||
- | |||
- | ## thermal sensor | ||
- | |||
- | - http:// | ||
- | |||
- | a64集两个热量传感器分别监控gpu和cpu温度。 | ||
- | |||
- | ```bash | ||
- | The thermal sensors have become common elements in wide range of modern system on chip (SOC) platform. | ||
- | Thermal sensors are used to constantly monitor the temperature on the chip. | ||
- | A64 embeds three thermal sensors in possible hot spots on the die, sensor0 located in the CPU, sensor1 and | ||
- | sensor2 located in the GPU. The thermal sensor Generates interrupt to SW to lower temperature via DVFS, on | ||
- | reaching a certain thermal threshold | ||
- | ``` | ||
- | |||
- | > **提示**:Allwinner_A64_User_Manual_V1.1_decrypted.pdf-> | ||
- | |||
- | 挂载在sysfs数据属性 | ||
- | |||
- | ```bash | ||
- | pi@350-tf-s2 ~$ tree / | ||
- | / | ||
- | ├── mode # | ||
- | ├── policy | ||
- | ├── temp # | ||
- | ├── trip_point_0_hyst | ||
- | ├── trip_point_0_temp | ||
- | ├── trip_point_0_type | ||
- | ├── ...... | ||
- | ├── trip_point_6_hyst | ||
- | ├── trip_point_6_temp | ||
- | ├── trip_point_6_type | ||
- | ├── type # | ||
- | └── uevent | ||
- | ``` | ||
- | |||
- | |||
- | |||
- | ## governor | ||
- | |||
- | * [ CPU frequency and voltage scaling code in the Linux(TM) kernel](https:// | ||
- | * http:// | ||
- | |||
- | 挂载sysfs 数据属性。 | ||
- | |||
- | ```bash | ||
- | pi@350-tf-s2 ~$ tree / | ||
- | / | ||
- | ├── affected_cpus | ||
- | ├── boot_lock | ||
- | ├── cpuinfo_boot_freq | ||
- | ├── cpuinfo_cur_freq | ||
- | ├── cpuinfo_max_freq | ||
- | ├── cpuinfo_min_freq | ||
- | ├── cpuinfo_transition_latency | ||
- | ├── related_cpus | ||
- | ├── scaling_available_frequencies #480000 600000 720000 816000 1008000 1104000 1152000 1200000 1344000 | ||
- | ├── scaling_available_governors | ||
- | ├── scaling_cur_freq | ||
- | ├── scaling_driver | ||
- | ├── scaling_governor | ||
- | ├── scaling_max_freq | ||
- | ├── scaling_min_freq | ||
- | ├── scaling_setspeed | ||
- | └── stats | ||
- | ├── time_in_state | ||
- | ├── total_trans | ||
- | └── trans_table | ||
- | ``` | ||
- | |||
- | ## cooling device | ||
- | |||
- | 挂载在sysfs数据属性 | ||
- | |||
- | ```bash | ||
- | pi@350-tf-s2 ~$ tree / | ||
- | / | ||
- | ├── cur_state | ||
- | ├── max_state | ||
- | ├── power | ||
- | │ ├── async | ||
- | │ ├── autosuspend_delay_ms | ||
- | │ ├── control | ||
- | │ ├── runtime_active_kids | ||
- | │ ├── runtime_active_time | ||
- | │ ├── runtime_enabled | ||
- | │ ├── runtime_status | ||
- | │ ├── runtime_suspended_time | ||
- | │ └── runtime_usage | ||
- | ├── subsystem -> ../ | ||
- | ├── type | ||
- | └── uevent | ||
- | ``` | ||
- | |||
- | |||
- | |||
- | `/ | ||
- | |||
- | ```bash | ||
- | kernel: [239144.300372] CPU Budget: | ||
- | kernel: [239144.302585] CPU Budget hotplug: cluster0 min:0 max:4 | ||
- | kernel: [239144.792365] CPU Budget: | ||
- | kernel: [239144.794593] CPU Budget hotplug: cluster0 min:0 max:4 | ||
- | kernel: [239145.776364] CPU Budget: | ||
- | kernel: [239145.778579] CPU Budget hotplug: cluster0 min:0 max:4 | ||
- | ``` | ||
- | |||
- | 如上日志表示基于cpu核心温度变化自动调节了cpu主频最大值。 | ||
- | |||
- | ## test script | ||
- | |||
- | 如下代码片段设计: | ||
- | |||
- | * 设计cpu压力测试(温度高会自自动调频); | ||
- | |||
- | * 增加手动切换调频; | ||
- | |||
- | * 实时打印温度、频率范围、当前频率值; | ||
- | |||
- | * 可以尝试去掉cpu自动调频; | ||
- | |||
- | |||
- | ```bash | ||
- | # !/ | ||
- | [ -f /usr/bin/bc ] || { | ||
- | wget https:// | ||
- | sudo dpkg -i bc_1.06.95-9_arm64.deb | ||
- | } | ||
- | #cpu pressure test | ||
- | echo " | ||
- | echo " | ||
- | echo " | ||
- | echo " | ||
- | echo " | ||
- | echo 4 |sudo tee / | ||
- | let flag=1 | ||
- | while [ 1 ] | ||
- | do | ||
- | if [ $flag -eq 0 ];then | ||
- | let flag=1 | ||
- | echo 2 |sudo tee / | ||
- | else | ||
- | let flag=0 | ||
- | echo 3 |sudo tee / | ||
- | fi | ||
- | |||
- | echo -e " | ||
- | echo "temp: $(cat / | ||
- | echo " | ||
- | echo " | ||
- | echo " | ||
- | echo " | ||
- | top -bn 1 -i -c |head -n 5 | ||
- | echo "" | ||
- | sleep 1 | ||
- | done | ||
- | ``` | ||
- | </ | ||