CPU没有自动调频造成发热巨大的解决办法
Tofloor
poster avatar
joo
deepin
2020-09-14 01:48
Author
本帖最后由 joo_tsao 于 2020-9-13 18:50 编辑

系统默认安装的情况下CPU调频是高性能模式,这会造成发热巨大,论坛有各种各样的解决方法。
1、关闭intel_pstate,这种方法缺点很明显:固定在GRUB,无法随时更改配置;最重要的是intel的CPU通过intel_pstate进行调频是最优的。
2、安装tlp替换laptop mode tool,如果安装tlp需要卸载laptop mode tool,就会破坏深度的节能配置,这可能不是想要的结果。
3、cpupowergui这是很酷的工具,也十分管用,我也十分喜欢,但时间一长,审美疲劳,我更希望有系统级的标准解决方案。

下面我参考了其他发行版的做法,这才是标准的解决方案。

Reply Favorite View the author
All Replies
1 / 2
To page
joo
deepin
2020-09-14 02:12
#1
本帖最后由 joo_tsao 于 2020-9-15 15:15 编辑

1、安装cpupower
  1. sudo apt-get install linux-cpupower
Copy the Code

2、查看cpu有效的调速器
  1. sudo cpupower -c all frequency-info
Copy the Code
以我的电脑为例,你们参考自己的查看的信息。
  1. analyzing CPU 0:
  2.   driver: intel_pstate
  3.   CPUs which run at the same hardware frequency: 0
  4.   CPUs which need to have their frequency coordinated by software: 0
  5.   maximum transition latency:  Cannot determine or is not supported.
  6.   hardware limits: 400 MHz - 2.80 GHz
  7.   available cpufreq governors: performance powersave
  8.   current policy: frequency should be within 400 MHz and 2.80 GHz.
  9.                   The governor "powersave" may decide which speed to use
  10.                   within this range.
  11.   current CPU frequency: Unable to call hardware
  12.   current CPU frequency: 1.88 GHz (asserted by call to kernel)
  13.   boost state support:
  14.     Supported: yes
  15.     Active: yes
  16. analyzing CPU 1:
  17.   driver: intel_pstate
  18.   CPUs which run at the same hardware frequency: 1
  19.   CPUs which need to have their frequency coordinated by software: 1
  20.   maximum transition latency:  Cannot determine or is not supported.
  21.   hardware limits: 400 MHz - 2.80 GHz
  22.   available cpufreq governors: performance powersave
  23.   current policy: frequency should be within 400 MHz and 2.80 GHz.
  24.                   The governor "powersave" may decide which speed to use
  25.                   within this range.
  26.   current CPU frequency: Unable to call hardware
  27.   current CPU frequency: 1.88 GHz (asserted by call to kernel)
  28.   boost state support:
  29.     Supported: yes
  30.     Active: yes
  31. analyzing CPU 2:
  32.   driver: intel_pstate
  33.   CPUs which run at the same hardware frequency: 2
  34.   CPUs which need to have their frequency coordinated by software: 2
  35.   maximum transition latency:  Cannot determine or is not supported.
  36.   hardware limits: 400 MHz - 2.80 GHz
  37.   available cpufreq governors: performance powersave
  38.   current policy: frequency should be within 400 MHz and 2.80 GHz.
  39.                   The governor "powersave" may decide which speed to use
  40.                   within this range.
  41.   current CPU frequency: Unable to call hardware
  42.   current CPU frequency: 1.87 GHz (asserted by call to kernel)
  43.   boost state support:
  44.     Supported: yes
  45.     Active: yes
  46. analyzing CPU 3:
  47.   driver: intel_pstate
  48.   CPUs which run at the same hardware frequency: 3
  49.   CPUs which need to have their frequency coordinated by software: 3
  50.   maximum transition latency:  Cannot determine or is not supported.
  51.   hardware limits: 400 MHz - 2.80 GHz
  52.   available cpufreq governors: performance powersave
  53.   current policy: frequency should be within 400 MHz and 2.80 GHz.
  54.                   The governor "powersave" may decide which speed to use
  55.                   within this range.
  56.   current CPU frequency: Unable to call hardware
  57.   current CPU frequency: 1.88 GHz (asserted by call to kernel)
  58.   boost state support:
  59.     Supported: yes
  60.     Active: yes
Copy the Code
3、设置CPU调速器为powersave
  1. sudo cpupower -c all frequency-set -g powersave
Copy the Code
4、当然需要每次重启电脑都设置为自己指定的调速器
建立配置文件
  1. sudo touch /etc/default/cpupower
Copy the Code
请用自己喜欢的编辑器添加下面内容
  1. # 自己设置调度
  2. CPUPOWER_START_OPTS="-c all frequency-set -g powersave"
Copy the Code
建立systemd服务文件,每次重启设置CPU的调速器
  1. sudo touch /etc/systemd/system/cpupower.service
Copy the Code
请用自己喜欢的编辑器添加下面内容
  1. [Unit]
  2. Description=Configure CPU power related settings
  3. After=syslog.target

  4. [Service]
  5. Type=oneshot
  6. RemainAfterExit=yes
  7. EnvironmentFile=/etc/default/cpupower
  8. ExecStart=/usr/bin/cpupower $CPUPOWER_START_OPTS

  9. [Install]
  10. WantedBy=multi-user.target
Copy the Code
5、重启服务
  1. sudo systemctl daemon-reload
Copy the Code
6、开机自动启动
  1. sudo systemctl enable cpupower.service
Copy the Code


Reply View the author
joo
deepin
2020-09-14 02:19
#2
随时可以更改调速器,按如下2个步骤
1、修改/etc/default/cpupower配置文件
  1. # 自己设置调度
  2. CPUPOWER_START_OPTS="-c all frequency-set -g performance"
Copy the Code


2、重启服务
  1. sudo systemctl daemon-reload
Copy the Code
Reply View the author
灵兮之
deepin
2020-09-14 02:25
#3
mark。。
Reply View the author
joo
deepin
2020-09-14 02:34
#4
本帖最后由 joo_tsao 于 2020-9-13 18:37 编辑

其实深度应该像其他发行版那样,将配置文件和服务放入基本包,默认应该设为powersave,当然不同生产商的cpu和型号,要设为对应可用的调速器比我自用这个帖子复杂,好在cpupower -c all frequency-info会给出有用的信息,安装自动化脚本可以提取对应的调速器。
  1. available cpufreq governors: performance powersave
Copy the Code


Reply View the author
SamLukeYes
deepin
2020-09-14 02:41
#5
可以搞个 GUI 然后打个包
Reply View the author
灵兮之
deepin
2020-09-15 17:31
#6
是哪个CPUpower?第一条安装的命令好像找不到这个软件

Reply View the author
joo
deepin
2020-09-15 23:14
#7
是linux-cpupower,上面写错,谢谢!
Reply View the author
deltacatxx
deepin beta test group
2020-09-16 03:02
#8
mark 一下,谢谢楼主
Reply View the author
chen5903710
deepin
2020-09-16 03:40
#9
mark 一下。。
Reply View the author
灵兮之
deepin
2020-09-17 02:06
#10
https://bbs.deepin.org/post/202001
是linux-cpupower,上面写错,谢谢!

已经装好,设置好了,重启之后sudo cpupower -c all frequency-info显示还是available cpufreq governors: performance powersave,不应该是available cpufreq governors: powersave吗
Reply View the author
rekees2020
deepin
2020-09-17 04:42
#11
tlp有什么原罪?和laptop mode tool是同类。laptop mode tool也不是高度嵌入deepin的,系统设置里的省电模式与它无关,那里的省电模式比较浅层,只是亮度之类的调节,删了laptop mode tool一样还在。
Reply View the author
joo
deepin
2020-09-17 05:30
#12
本帖最后由 joo_tsao 于 2020-9-16 21:31 编辑
https://bbs.deepin.org/post/202001
已经装好,设置好了,重启之后sudo cpupower -c all frequency-info显示还是available cpufreq governors ...
下面这是当前调度器,这available cpufreq governors可用的调度器。
  1. current policy: frequency should be within 400 MHz and 2.80 GHz.
  2.                   The governor "powersave" may decide which speed to use
  3.                   within this range.
Copy the Code
Reply View the author
joo
deepin
2020-09-17 05:37
#13
https://bbs.deepin.org/post/202001
tlp有什么原罪?和laptop mode tool是同类。laptop mode tool也不是高度嵌入deepin的,系统设置里的省电模 ...

深度的节能使用的是laptop mode tool工具


Reply View the author
joo
deepin
2020-09-17 05:48
#14
你自己可以测试一下,开启和关闭节能模式,/etc/laptop-mode/laptop-mode.conf这个配置文件是变化的,也就是深度的节能模式使用laptop-mode,为什么要开启节能模式?呵呵,节能不单单只有CPU调频,还有各种设备的节能,例如蓝牙、鼠标、硬盘、USB、无线网卡等等。
Reply View the author
joo
deepin
2020-09-17 06:01
#15
其实,你也可以不用这些工具,例如:cat /proc/sys/vm/laptop_mode,如果是0就禁用节能模式,1就是使用电池时,2就是电池和AC电源都启用,你可以直接改变这些内核参数 echo 2  > /proc/sys/vm/laptop_mode,完整的内核参数还有很多,所以针对节能内核提供这么一组工具laptop mode tools.
Reply View the author
joo
deepin
2020-09-17 06:27
#16
你也可以在深度控制面板开启和关闭节能模式(深度只是通过图像界面设置进入那种模式,节能的工作是laptop_mode),分别看看cat /proc/sys/vm/laptop_mode是否发生变化,以及去看看/etc/laptop-mode下面的配置文件就知道,laptop mode的节能模式不是浅层的,而是深度节能的,除非你说Linux的内核开发者是傻瓜。
Reply View the author
rekees2020
deepin
2020-09-17 07:04
#17
本帖最后由 rekees2020 于 2020-9-16 23:18 编辑
https://bbs.deepin.org/post/202001
深度的节能使用的是laptop mode tool工具。

我早删了laptop mode tools,没有/etc/laptop-mode文件夹
测试过了,截图里的节能模式,拔掉电源就会自动成使能状态,并且屏幕亮度降低,说明这些选项都在发挥作用,与laptop mode tools没有必然联系,也可能是tlp接管;不过我没有测试laptop mode tools和tlp都删除后这些选项还有没有用,大概率是没用了
Reply View the author
rekees2020
deepin
2020-09-17 07:05
#18
本帖最后由 rekees2020 于 2020-9-16 23:13 编辑
https://bbs.deepin.org/post/202001
你自己可以测试一下,开启和关闭节能模式,/etc/laptop-mode/laptop-mode.conf这个配置文件是变化的,也就 ...

我早删了laptop mode tools,没有/etc/laptop-mode文件夹
测试过了,截图里的节能模式,拔掉电源就会自动成使能状态,并且屏幕亮度降低,说明这些选项都在发挥作用,与laptop mode tools没有必然联系
Reply View the author
rekees2020
deepin
2020-09-17 07:10
#19
本帖最后由 rekees2020 于 2020-9-16 23:15 编辑
https://bbs.deepin.org/post/202001
你也可以在深度控制面板开启和关闭节能模式(深度只是通过图像界面设置进入那种模式,节能的工作是laptop_m ...

我没说laptop mode tools是浅层的,相反,我说了它和tlp一样,可以做很多设置
我只说了系统里那几个简单的选项像是浅层的,简单的“节能模式”四个字,没有任何地方设置具体参数;当然,这些可能来自laptop mode tools,但是laptop mode tools能设置的不止这么简单
我只有tlp,那几个选项一样能用
有可能是删了laptop mode tools、装了tlp后,这些选项被tlp接管
laptop mode是Linux内核的东西,但是laptop mode tools不是
Reply View the author
rekees2020
deepin
2020-09-17 07:17
#20
本帖最后由 rekees2020 于 2020-9-16 23:20 编辑
https://bbs.deepin.org/post/202001
你也可以在深度控制面板开启和关闭节能模式(深度只是通过图像界面设置进入那种模式,节能的工作是laptop_m ...

cat /proc/sys/vm/laptop_mode  这个有结果,并且和当前的状态一致;没有/etc/laptop-mode文件夹
laptop mode是Linux内核的一部分,laptop mode tools只是一款软件,和tlp地位一样
卸载laptop mode tools之后,tlp管理laptop mode
按测试的情况,我只能这么理解
Reply View the author
1 / 2
To page