![在启动时禁用 GPE ACPI 中断?](https://linux22.com/image/77076/%E5%9C%A8%E5%90%AF%E5%8A%A8%E6%97%B6%E7%A6%81%E7%94%A8%20GPE%20ACPI%20%E4%B8%AD%E6%96%AD%EF%BC%9F.png)
如果我寻找 ACPI 中断,我会发现:
/sys/firmware/acpi/interrupts/sci: 55414
/sys/firmware/acpi/interrupts/error: 0
/sys/firmware/acpi/interrupts/gpe00: 0 invalid
/sys/firmware/acpi/interrupts/gpe01: 0 invalid
/sys/firmware/acpi/interrupts/gpe02: 0 invalid
/sys/firmware/acpi/interrupts/gpe03: 0 invalid
/sys/firmware/acpi/interrupts/gpe04: 0 invalid
/sys/firmware/acpi/interrupts/gpe05: 0 invalid
/sys/firmware/acpi/interrupts/gpe06: 0 enabled
/sys/firmware/acpi/interrupts/gpe07: 0 enabled
/sys/firmware/acpi/interrupts/gpe08: 0 invalid
/sys/firmware/acpi/interrupts/gpe09: 0 disabled
/sys/firmware/acpi/interrupts/gpe10: 0 enabled
/sys/firmware/acpi/interrupts/gpe11: 0 invalid
/sys/firmware/acpi/interrupts/gpe12: 0 invalid
/sys/firmware/acpi/interrupts/gpe13: 0 invalid
/sys/firmware/acpi/interrupts/gpe14: 1 enabled
/sys/firmware/acpi/interrupts/gpe15: 0 invalid
/sys/firmware/acpi/interrupts/gpe16: 1 enabled
/sys/firmware/acpi/interrupts/gpe0A: 0 invalid
/sys/firmware/acpi/interrupts/gpe17: 54753 enabled
/sys/firmware/acpi/interrupts/gpe0B: 0 invalid
/sys/firmware/acpi/interrupts/gpe18: 0 invalid
/sys/firmware/acpi/interrupts/gpe0C: 0 invalid
/sys/firmware/acpi/interrupts/gpe19: 0 invalid
/sys/firmware/acpi/interrupts/gpe0D: 0 disabled
/sys/firmware/acpi/interrupts/gpe0E: 0 invalid
/sys/firmware/acpi/interrupts/gpe20: 0 invalid
/sys/firmware/acpi/interrupts/gpe0F: 0 invalid
/sys/firmware/acpi/interrupts/gpe21: 0 invalid
/sys/firmware/acpi/interrupts/gpe22: 0 invalid
/sys/firmware/acpi/interrupts/gpe23: 0 enabled
/sys/firmware/acpi/interrupts/gpe24: 0 invalid
/sys/firmware/acpi/interrupts/gpe25: 0 invalid
/sys/firmware/acpi/interrupts/gpe26: 0 invalid
/sys/firmware/acpi/interrupts/gpe1A: 0 invalid
/sys/firmware/acpi/interrupts/gpe27: 0 invalid
/sys/firmware/acpi/interrupts/gpe1B: 0 invalid
/sys/firmware/acpi/interrupts/gpe28: 0 invalid
/sys/firmware/acpi/interrupts/gpe1C: 0 invalid
/sys/firmware/acpi/interrupts/gpe29: 0 invalid
/sys/firmware/acpi/interrupts/gpe1D: 0 invalid
/sys/firmware/acpi/interrupts/gpe1E: 0 invalid
/sys/firmware/acpi/interrupts/gpe30: 0 invalid
/sys/firmware/acpi/interrupts/gpe1F: 0 invalid
/sys/firmware/acpi/interrupts/gpe31: 0 invalid
/sys/firmware/acpi/interrupts/gpe32: 0 invalid
/sys/firmware/acpi/interrupts/gpe33: 0 invalid
/sys/firmware/acpi/interrupts/gpe34: 0 invalid
/sys/firmware/acpi/interrupts/gpe35: 0 invalid
/sys/firmware/acpi/interrupts/gpe36: 0 invalid
/sys/firmware/acpi/interrupts/gpe2A: 0 invalid
/sys/firmware/acpi/interrupts/gpe37: 0 invalid
/sys/firmware/acpi/interrupts/gpe2B: 0 invalid
/sys/firmware/acpi/interrupts/gpe38: 0 invalid
/sys/firmware/acpi/interrupts/gpe2C: 0 invalid
/sys/firmware/acpi/interrupts/gpe39: 0 invalid
/sys/firmware/acpi/interrupts/gpe2D: 0 invalid
/sys/firmware/acpi/interrupts/gpe2E: 0 invalid
/sys/firmware/acpi/interrupts/gpe2F: 0 invalid
/sys/firmware/acpi/interrupts/gpe3A: 0 invalid
/sys/firmware/acpi/interrupts/gpe3B: 0 invalid
/sys/firmware/acpi/interrupts/gpe3C: 0 invalid
/sys/firmware/acpi/interrupts/gpe3D: 0 invalid
/sys/firmware/acpi/interrupts/gpe3E: 0 invalid
/sys/firmware/acpi/interrupts/gpe3F: 0 invalid
/sys/firmware/acpi/interrupts/sci_not: 0
/sys/firmware/acpi/interrupts/ff_pmtimer: 0 invalid
/sys/firmware/acpi/interrupts/ff_rt_clk: 0 disabled
/sys/firmware/acpi/interrupts/gpe_all: 55414
/sys/firmware/acpi/interrupts/ff_gbl_lock: 0 enabled
/sys/firmware/acpi/interrupts/ff_pwr_btn: 0 enabled
/sys/firmware/acpi/interrupts/ff_slp_btn: 0 invalid
我编写了一个服务脚本来在启动时禁用此功能:
#!/bin/bash
### BEGIN INIT INFO
# Provides: disable-gpe17
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
logger -t gpe17 -s "Disabling gpe17 interrupts..."
/etc/pm/sleep.d/30_disable_gpe17 thaw
exit 0
这调用了我的 PM 脚本:
#!/bin/sh
echo 0 > /sys/firmware/acpi/interrupts/gpe17 2>/dev/null
我已经使这两个脚本都可执行,并添加disable-gpe17
到启动脚本中:
sudo update-rc.d disable-gpe17 defaults
当我查看启动日志时,我没有看到系统日志条目的记录表明 gpe17 已被禁用。
有没有更好的方法(也许是 udev)来禁用启动时的某些中断?如果没有,为什么我的服务脚本没有在启动时运行?
我使用的是 MacBook Pro 11.5,运行内核 3.19 和 Ubuntu 14.04。
答案1
我有同样的问题,我需要为 kworker 禁用 gpe16 和 gpe17 以停止占用 CPU。我按照这里找到的食谱进行操作:http://sudoremember.blogspot.com.au/2013/05/high-cpu-usage-due-to-kworker.html
一个缩写(并已更正,至少对于我的例子)版本如下:
$ sudo -s
# echo "disable" > /sys/firmware/acpi/interrupts/gpe16
# echo "disable" > /sys/firmware/acpi/interrupts/gpe17
您现在应该可以看到 CPU 负载/听到风扇转动的声音。确保在重新启动时再次发生这种情况 - 仍然是在 root 权限下:
# crontab -e
这将打开您最喜欢的编辑器。添加这些行:
@reboot echo "disable" > /sys/firmware/acpi/interrupts/gpe16
@reboot echo "disable" > /sys/firmware/acpi/interrupts/gpe17
由于挂起模式对我不起作用,我没有费心遵循有关如何创建脚本以在挂起后恢复时重新激活这些设置的其余说明。
答案2
在 Linux 4.19 中,我发现禁用 GPE ( echo "disable" > /sys/firmware/acpi/interrupts/gpe17
) 并不能再解决这个问题。即使 GPE 被禁用,数字仍然在增加并且 CPU 仍然忙碌。自 Linux 4.10 以来,新的解决方案似乎是屏蔽而不是禁用:
# echo mask > /sys/firmware/acpi/interrupts/gpe17
或者使用启动参数acpi_mask_gpe=0x17
(在 Debian/Ubuntu 中将其添加到/etc/default/grub
行GRUB_CMDLINE_LINUX_DEFAULT
,然后运行update-grub
并重新启动)。
有关更多详细信息,请参阅Linux 内核提交 9c4aa1ee它首先合并在 Linux 4.10-rc3 中,并且错误报告链接到那里。
答案3
我在旧 Macbook 2006 上运行 Lubuntu 20.10、5.8 内核时遇到同样的问题。就我而言,解决方案是使用 Peter Nowee 建议。
我将启动参数添加acpi_mask_gpe=0x17
到 GRUB 并重新启动。这样就解决了CPU占用率高的问题。
我发现这个命令有问题:
grep . -r /sys/firmware/acpi/interrupts/
问题:
/sys/firmware/acpi/interrupts/gpe17: 3491042 EN enabled unmasked
答案4
在 Linux Lite 5.2、MacBook Pro 9.2、Bios 233.0.0.0 (6/10/2020) 上,我遇到了 gpe17 和 sci 中断问题。
上述 Peter Nowee 的解决方案有效!
我用systemctl屏蔽了它:
- 创建文件
/etc/systemd/system/mask-gpe17.service
- 将以下行复制到其中并保存文件:
[Unit] Description=Mask GPE 17 [Service] ExecStart=/usr/bin/bash -c 'echo "mask" > /sys/firmware/acpi/interrupts/gpe17' [Install] WantedBy=multi-user.target
- 创建文件
/etc/systemd/system/mask-sci.service
- 将以下行复制到其中并保存文件:
[Unit] Description=Mask SCI [Service] ExecStart=/usr/bin/bash -c 'echo "mask" > /sys/firmware/acpi/interrupts/sci' [Install] WantedBy=multi-user.target
- 然后在终端中启用服务:
sudo systemctl enable mask-gpe17.service sudo systemctl enable mask-sci.service