内核加载时间长

内核加载时间长

在 Dell XPS 9370 上运行 Ubuntu 18.04,内核加载时间超过 30 秒。

systemd-analyze输出:

Startup finished in 12.834s (firmware) + 1.331s (loader) + 33.643s (kernel) + 11.692s (userspace) = 59.502s

systemd-analyze blame仅显示用户空间的加载时间,所以我不会将其包括在这里。

相关dmesg输出:

[    5.154052] pcieport 0000:04:00.0: Refused to change power state, currently in D3
[    5.155956] pci_bus 0000:05: busn_res: [bus 05] is released
[    5.156127] pci_bus 0000:06: busn_res: [bus 06-38] is released
[    5.156235] pci_bus 0000:39: busn_res: [bus 39] is released
[    5.156300] pci_bus 0000:3a: busn_res: [bus 3a-6d] is released
[    5.156352] pci_bus 0000:04: busn_res: [bus 04-6d] is released
[   33.556238] EXT4-fs (dm-0): mounted filesystem with ordered data mode. Opts: (null)

完整dmesg输出:https://pastebin.com/0JmWuLtZ

我尝试/etc/initramfs-tools/conf.d/resume按照描述进行编辑这里并添加noresume至我的GRUB_CMDLINE_LINUX_DEFAULT

我该如何解决这个问题?

答案1

我该如何解决这个问题?

第一步是找出产生错误的 PCI 设备:

pcieport 0000:04:00.0: Refused to change power state, currently in D3

我的系统没有0000:04:00.0但是它有0000:03:00.0所以我会使用:

$ cd /sys/bus/pci/devices/0000:03:00.0

$ ls -la
total 0
drwxr-xr-x 5 root root    0 Aug  8 17:15 .
drwxr-xr-x 8 root root    0 Aug  8 17:15 ..
drwxr-xr-x 3 root root    0 Aug  9 17:53 0000:03:00.0:pcie208
-rw-r--r-- 1 root root 4096 Aug  9 17:53 broken_parity_status
-r--r--r-- 1 root root 4096 Aug  8 17:15 class
-rw-r--r-- 1 root root 4096 Aug  8 17:15 config
-r--r--r-- 1 root root 4096 Aug  9 17:53 consistent_dma_mask_bits
-r--r--r-- 1 root root 4096 Aug  9 17:53 current_link_speed
-r--r--r-- 1 root root 4096 Aug  9 17:53 current_link_width
-rw-r--r-- 1 root root 4096 Aug  9 17:53 d3cold_allowed
-r--r--r-- 1 root root 4096 Aug  8 17:15 device
-r--r--r-- 1 root root 4096 Aug  9 17:53 dma_mask_bits
lrwxrwxrwx 1 root root    0 Aug  8 17:15 driver -> ../../../../../bus/pci/drivers/pcieport
-rw-r--r-- 1 root root 4096 Aug  9 17:53 driver_override
-rw-r--r-- 1 root root 4096 Aug  9 17:53 enable
-r--r--r-- 1 root root 4096 Aug  8 17:15 irq
-r--r--r-- 1 root root 4096 Aug  9 17:53 local_cpulist
-r--r--r-- 1 root root 4096 Aug  9 17:53 local_cpus
-r--r--r-- 1 root root 4096 Aug  9 17:53 max_link_speed
-r--r--r-- 1 root root 4096 Aug  9 17:53 max_link_width
-r--r--r-- 1 root root 4096 Aug  9 17:53 modalias
-rw-r--r-- 1 root root 4096 Aug  9 17:53 msi_bus
-rw-r--r-- 1 root root 4096 Aug  9 17:53 numa_node
drwxr-xr-x 3 root root    0 Aug  9 17:53 pci_bus
drwxr-xr-x 2 root root    0 Aug  8 17:15 power
--w--w---- 1 root root 4096 Aug  9 17:53 remove
--w--w---- 1 root root 4096 Aug  9 17:53 rescan
-r--r--r-- 1 root root 4096 Aug  8 17:15 resource
-r--r--r-- 1 root root 4096 Aug  9 17:53 revision
-r--r--r-- 1 root root 4096 Aug  9 17:53 secondary_bus_number
-r--r--r-- 1 root root 4096 Aug  9 17:53 subordinate_bus_number
lrwxrwxrwx 1 root root    0 Aug  9 17:53 subsystem -> ../../../../../bus/pci
-r--r--r-- 1 root root 4096 Aug  9 17:53 subsystem_device
-r--r--r-- 1 root root 4096 Aug  9 17:53 subsystem_vendor
-rw-r--r-- 1 root root 4096 Aug  9 17:53 uevent
-r--r--r-- 1 root root 4096 Aug  8 17:15 vendor

$ cat vendor
0x8086

$ cat device
0x1576

$ cat class
0x060400

$ cat max_link_speed
2.5 GT/s

$ cat max_link_width
4

$ lspci -n | tail -8
03:00.0 0604: 8086:1576
03:01.0 0604: 8086:1576
03:02.0 0604: 8086:1576
39:00.0 0c03: 8086:15b5
3b:00.0 0200: 1969:e0a1 (rev 10)
3c:00.0 0280: 168c:003e (rev 32)
3d:00.0 ff00: 10ec:5227 (rev 01)
3e:00.0 0108: 144d:a804

$ lspci | tail -8
03:00.0 PCI bridge: Intel Corporation DSL6340 Thunderbolt 3 Bridge [Alpine Ridge 2C 2015]
03:01.0 PCI bridge: Intel Corporation DSL6340 Thunderbolt 3 Bridge [Alpine Ridge 2C 2015]
03:02.0 PCI bridge: Intel Corporation DSL6340 Thunderbolt 3 Bridge [Alpine Ridge 2C 2015]
39:00.0 USB controller: Intel Corporation DSL6340 USB 3.1 Controller [Alpine Ridge]
3b:00.0 Ethernet controller: Qualcomm Atheros Killer E2400 Gigabit Ethernet Controller (rev 10)
3c:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 32)
3d:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5227 PCI Express Card Reader (rev 01)
3e:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM961/PM961

如果我的系统出现错误,那么它可能是由 Thunderbolt 子系统引起的,我可能需要先拔掉 Thunderbolt DPI 至 HDMI 适配器。

根据您的情况,请用上面的内容替换0000:03:00.00000:04:00.0根据tail需要调整行数。

这是解决问题的第一步。

信用: -在 Linux 主机上解码 PCI 数据和 lspci 输出


解决方案:它是位于的 Intel SpeedStep 0000:04:00.0,在 BIOS 中启用它可以消除 30 秒的启动延迟。

答案2

我在 BIOS 中禁用了 Intel SpeedStep® 技术,该技术阻止 CPU 切换电源状态。启用该技术可将内核加载时间缩短至约 3 秒。

相关内容