我洗完澡打开 graymon-Latitude-5530 #28~24.04.1-Ubuntu 正准备开始____,结果电脑卡得不行,连在中文输入法下打双引号都能卡住——开启了标点配对,输入左双引自动输出右双引,然后光标自动移到中间,现在需要卡一秒才能完成这个自动化。
mpstat -P ALL 1 看 cpu 状态都是 50%+ 的 idle,没理由啊。迁怒了一会儿 Firefox 因为它是吃 CPU 最多的进程,重启两次后依然不解决问题,生气了,我可是 Linux native engineer,最近正在恶补性能,今天居然欺负到我头上跟我玩这三脚猫把戏,不答应!
来了几个 sar -uq 1 和 bpftrace one-liner 发现一切正常,隐隐感到有点不对劲,拉起一个 taskset -c 3 sh -c 'while :; do :; done' 跑一个纯用户态吃满 cpu 的进程,然后 perf stat -d -p $(pidof sh) ,结果大吃遗精:
2,005.31 msec task-clock # 0.999 CPUs utilized
799,677,211 cpu_core/cycles/ # 0.399 GHz
3,741,885,529 cpu_core/instructions/ # 4.68 insn per cycle
cpu 频率 0.399 GHz? 跑满了 0.999 CPU? 硬件问题?我是软体工程师啊,蔫了。
接下来一小时我毕恭毕敬无脑运行了 o3 老师喂给我的所有命令,虽然花了好几个初始回合才让它相信这 400MHz 是有问题的😀
1. intel_pstate limits: cat /sys/devices/system/cpu/intel_pstate/{min_perf_pct,max_perf_pct,no_turbo}
2. policy limits: cat /sys/devices/system/cpu/cpu3/cpufreq/{scaling_min_freq,scaling_max_freq}
3. thermal throttle: grep -r . /sys/devices/system/cpu/cpu3/thermal_throttle
4. cpu power settings: cpupower -c 3 frequency-set -g performance
5. PROCHOT: rdmsr -p3 0x19c && ...
6. userspace daemons: sudo systemctl stop thermald tlp power-profiles-daemon
7. rapl: echo 15000000 | sudo tee /sys/class/powercap/intel-rapl:0/constraint_0_power_limit_uw
8. BIOS/firmwares
依然毫无好转!绝望了,开始谷歌,一定是邪恶的 Dell 干的好事,对老电脑老电池在硬件级别限制 CPU,逼消费者换新电脑,太坏了🤬
又尝试了各路网友神仙的无效方案后(其中 https://github.com/yyearth/turnoff-BD-PROCHOT 更是验证了我的猜测,就是戴尔干的!
The cause of the signal activation usually are aging power adapter, aging battery, or bad sensor on matherboard
),我已经准备调查一下哪家的电脑比较适合失业人士,然后我看到了这个回答: https://unix.stackexchange.com/a/781888
I had the same problem, with ubuntu 24.04 and a slimbook with a Intel Core i7-1165G7 processor. The workaround was simple, just unplug/plug the charger and that's it.
just unplug/plug the charger 😀
我眼看着 CPU 瞬间飙上了 4.351 GHz😀
😀
mpstat -P ALL 1 看 cpu 状态都是 50%+ 的 idle,没理由啊。迁怒了一会儿 Firefox 因为它是吃 CPU 最多的进程,重启两次后依然不解决问题,生气了,我可是 Linux native engineer,最近正在恶补性能,今天居然欺负到我头上跟我玩这三脚猫把戏,不答应!
来了几个 sar -uq 1 和 bpftrace one-liner 发现一切正常,隐隐感到有点不对劲,拉起一个 taskset -c 3 sh -c 'while :; do :; done' 跑一个纯用户态吃满 cpu 的进程,然后 perf stat -d -p $(pidof sh) ,结果大吃遗精:
2,005.31 msec task-clock # 0.999 CPUs utilized
799,677,211 cpu_core/cycles/ # 0.399 GHz
3,741,885,529 cpu_core/instructions/ # 4.68 insn per cycle
cpu 频率 0.399 GHz? 跑满了 0.999 CPU? 硬件问题?我是软体工程师啊,蔫了。
接下来一小时我毕恭毕敬无脑运行了 o3 老师喂给我的所有命令,虽然花了好几个初始回合才让它相信这 400MHz 是有问题的😀
1. intel_pstate limits: cat /sys/devices/system/cpu/intel_pstate/{min_perf_pct,max_perf_pct,no_turbo}
2. policy limits: cat /sys/devices/system/cpu/cpu3/cpufreq/{scaling_min_freq,scaling_max_freq}
3. thermal throttle: grep -r . /sys/devices/system/cpu/cpu3/thermal_throttle
4. cpu power settings: cpupower -c 3 frequency-set -g performance
5. PROCHOT: rdmsr -p3 0x19c && ...
6. userspace daemons: sudo systemctl stop thermald tlp power-profiles-daemon
7. rapl: echo 15000000 | sudo tee /sys/class/powercap/intel-rapl:0/constraint_0_power_limit_uw
8. BIOS/firmwares
依然毫无好转!绝望了,开始谷歌,一定是邪恶的 Dell 干的好事,对老电脑老电池在硬件级别限制 CPU,逼消费者换新电脑,太坏了🤬
又尝试了各路网友神仙的无效方案后(其中 https://github.com/yyearth/turnoff-BD-PROCHOT 更是验证了我的猜测,就是戴尔干的!
The cause of the signal activation usually are aging power adapter, aging battery, or bad sensor on matherboard
),我已经准备调查一下哪家的电脑比较适合失业人士,然后我看到了这个回答: https://unix.stackexchange.com/a/781888
I had the same problem, with ubuntu 24.04 and a slimbook with a Intel Core i7-1165G7 processor. The workaround was simple, just unplug/plug the charger and that's it.
just unplug/plug the charger 😀
我眼看着 CPU 瞬间飙上了 4.351 GHz😀
😀