CPUFreq、Devfreq 与功率 Cooling

CPUFreq、Devfreq 与功率 Cooling

1. Cooling state

state 0通常代表无额外限制,state增大代表更强限制。具体频率表由 driver生成,不能假设 state等于频率索引的固定方向。

2. CPUFreq cooling

1
2
3
4
5
6
7
cpufreq_cooling_register()
-> collect policy/frequency/EM
-> thermal_cooling_device

set_cur_state()
-> update max frequency QoS/clip
-> cpufreq policy transition

同一 policy的 CPUs共享 cooling device。

3. CPU power actor

有 Energy Model时可:

  • state2power;
  • power2state;
  • get_requested_power;
  • static/dynamic power估算。

power allocator据此按 mW分配。

4. Devfreq cooling

适用于 GPU/NPU等 devfreq设备:

1
2
3
4
thermal state
-> devfreq cooling
-> max frequency constraint
-> devfreq governor选择不超过上限的 OPP

power extension需要 OPP/EM和兼容 devfreq governor。

5. RK3588 DTS

soc zone cooling map引用:

  • cpu_l0
  • cpu_b0
  • cpu_b2
  • gpu

NPU未在该 map内,即使有 npu-thermal zone,也不表示公共 DTS由 Thermal Core直接限制 NPU。

6. Cooling vs DVFS governor

Thermal设置上限,schedutil/simple_ondemand等在上限内选频。看到低频需区分:

  • workload不足;
  • thermal cap;
  • power/OPP constraint;
  • userspace QoS;
  • regulator;
  • scheduler。

7. Pressure

CPU thermal pressure向 scheduler描述因热限制损失的 capacity,帮助任务放置。它不是实际温度,也不是独立 cooling设备。

8. Idle cooling

CPU idle cooling通过注入 idle限制计算能力,依赖 IDLE_INJECT。本主配置未显式启用 CPU_IDLE_THERMAL,常规路径是 cpufreq cooling。

9. 风扇

PWM fan cdev把 thermal state映射到 duty levels。RK厂商 pwm-fan还可能走 system monitor notifier而不是 generic cdev;需避免和 Thermal governor双控。

10. 验证

同时观察:

1
2
3
4
5
6
thermal zone temp
cooling cur_state
cpufreq scaling_cur/max_freq
devfreq cur/max_freq
thermal pressure
workload throughput

只看温度无法证明 cooling动作正确。

文章互动

阅读 --

留言

0 条留言

正在加载留言…