![连接交流适配器时无法写入 /sys/devices/system/cpu/cpufreq/*/energy_performance_preference](https://linux22.com/image/206399/%E8%BF%9E%E6%8E%A5%E4%BA%A4%E6%B5%81%E9%80%82%E9%85%8D%E5%99%A8%E6%97%B6%E6%97%A0%E6%B3%95%E5%86%99%E5%85%A5%20%2Fsys%2Fdevices%2Fsystem%2Fcpu%2Fcpufreq%2F*%2Fenergy_performance_preference.png)
交流适配器已拔出:
$ echo power | sudo tee energy_performance_preference
power
$ echo $?
0
交流适配器已插入:
$ echo power | sudo tee energy_performance_preference
power
tee: energy_performance_preference: Device or resource busy
是的,我有英特尔 p 状态 HWP- 有能力的CPU,否则我不会有上面那个设置。
我的笔记本电脑运行的是经过内核强化的 Gentoo Linux 5.17.4-gentoo-x86_64
。
也许有某种关联,但是/var/log/系统日志显示拔掉适配器后:
May 27 17:19:27 mathroom laptop-mode: enabled, active
May 27 17:19:27 mathroom rfkill: block set for type bluetooth
May 27 17:19:27 mathroom laptop-mode: LCD Brightness Command succeeded.
May 27 17:19:27 mathroom kernel: EXT4-fs (sda3): re-mounted. Quota mode: disabled.
May 27 17:19:27 mathroom kernel: EXT4-fs (sda4): re-mounted. Quota mode: disabled.
May 27 17:19:27 mathroom kernel: r8169 0000:02:00.0 enp2s0: Link is Down
May 27 17:19:28 mathroom root: ACPI event unhandled: battery PNP0C0A:00 00000080 00000001
May 27 17:19:28 mathroom root: ACPI event unhandled: battery PNP0C0A:00 00000081 00000001
May 27 17:19:28 mathroom root: ACPI event unhandled: battery PNP0C0A:00 00000080 00000001
May 27 17:19:28 mathroom root: ACPI event unhandled: battery PNP0C0A:00 00000001 00000001
,插回去之后是这样的:
May 27 17:20:36 mathroom laptop-mode: enabled, active
May 27 17:20:36 mathroom rfkill: unblock set for type bluetooth
May 27 17:20:36 mathroom laptop-mode: LCD Brightness Command succeeded.
May 27 17:20:36 mathroom kernel: NMI watchdog: Enabled. Permanently consumes one hw-PMU counter.
May 27 17:20:36 mathroom kernel: EXT4-fs (sda3): re-mounted. Quota mode: disabled.
May 27 17:20:36 mathroom kernel: EXT4-fs (sda4): re-mounted. Quota mode: disabled.
May 27 17:20:36 mathroom kernel: r8169 0000:02:00.0 enp2s0: Link is Down
May 27 17:20:36 mathroom root: ACPI event unhandled: battery PNP0C0A:00 00000080 00000001
May 27 17:20:36 mathroom root: ACPI event unhandled: ac_adapter ACPI0003:00 00000080 00000001
May 27 17:20:37 mathroom root: ACPI event unhandled: battery PNP0C0A:00 00000081 00000001
May 27 17:20:37 mathroom root: ACPI event unhandled: battery PNP0C0A:00 00000080 00000001
May 27 17:20:37 mathroom root: ACPI event unhandled: battery PNP0C0A:00 00000001 00000001
还有,没有diff
-erence/etc/mtab更改适配器状态之前和之后。
值得注意的是,例如,在连接交流适配器时,我可以写入scaling_governor
,但不能写入energy_performance_preference
。
这帖子对我没有帮助(lsof +D /sys
输出不相关)。
任何帮助将不胜感激。
答案1
以下命令的输出是什么(我知道这个问题更适合评论,但我还没有足够的声誉):
$ cat /sys/devices/system/cpu/cpufreq/*/energy_performance_available_preferences
$ cat /sys/devices/system/cpu/cpufreq/*/scaling_governor
在我的 Arch Linux 上,amd_pstate_epp
当 myscaling_governor
设置为时,performance
我只能选择performance
作为 EPP 首选项(energy_performance_available_preferences
也仅包含performance
)。当我尝试选择不可用的 EPP 首选项时,出现错误Device or resource busy
。也许插入交流适配器会改变您的调速器设置?
$ uname -a
Linux some-hostname 6.7.4-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 05 Feb 2024 22:07:49 +0000 x86_64 GNU/Linux
$ cd /sys/devices/system/cpu/cpufreq/policy0/
$ echo powersave | sudo tee scaling_governor
powersave
$ cat energy_performance_available_preferences
default performance balance_performance balance_power power
$ echo power | sudo tee energy_performance_preference
power
$ echo performance | sudo tee scaling_governor
performance
$ cat energy_performance_available_preferences
performance
$ echo power | sudo tee energy_performance_preference
power
tee: energy_performance_preference: Device or resource busy
然而,其确切原因超出了我的了解。