Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Software] Minimizing kernel time during boot

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
Yonder0002
Posts: 3
Joined: 2023-01-25 04:56

[Software] Minimizing kernel time during boot

#1 Post by Yonder0002 »

Hello!

I noticed while poking around with systemd-analyze, that my kernel boot time was 7.067s. I'm trying to see what I can do to minimize this a bit, just for the hell of it. I think my hardware set up is pretty standard? The biggest outlier would be that I have windows(nvme0n1) and debian (nvme1n1) installed each on their own m.2 nvme drive

inxi -Fxz

Code: Select all

debian:~$ inxi -Fxz
System:    Kernel: 5.10.0-21-amd64 x86_64 bits: 64 compiler: gcc v: 10.2.1 Desktop: GNOME 3.38.6 
           Distro: Debian GNU/Linux 11 (bullseye) 
Machine:   Type: Desktop Mobo: Gigabyte model: B550I AORUS PRO AX serial: <filter> BIOS: American Megatrends LLC. v: F16e 
           date: 07/20/2022 
CPU:       Info: 6-Core model: AMD Ryzen 5 5600X bits: 64 type: MT MCP arch: Zen 3 rev: 0 L2 cache: 3 MiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 88637 
           Speed: 3092 MHz min/max: 2200/4650 MHz boost: enabled Core speeds (MHz): 1: 3092 2: 2873 3: 2869 4: 3593 5: 3592 
           6: 2866 7: 2872 8: 3591 9: 2871 10: 2871 11: 3659 12: 2872 
Graphics:  Device-1: NVIDIA GP104 [GeForce GTX 1070] vendor: Gigabyte driver: nvidia v: 470.161.03 bus ID: 07:00.0 
           Display: x11 server: X.Org 1.20.11 driver: loaded: nvidia unloaded: fbdev,modesetting,nouveau,vesa 
           resolution: 3440x1440~60Hz 
           OpenGL: renderer: NVIDIA GeForce GTX 1070/PCIe/SSE2 v: 4.6.0 NVIDIA 470.161.03 direct render: Yes 
Audio:     Device-1: NVIDIA GP104 High Definition Audio vendor: Gigabyte driver: snd_hda_intel v: kernel bus ID: 07:00.1 
           Device-2: Advanced Micro Devices [AMD] Starship/Matisse HD Audio vendor: Gigabyte driver: snd_hda_intel v: kernel 
           bus ID: 09:00.4 
           Sound Server: ALSA v: k5.10.0-21-amd64 
Network:   Device-1: Realtek RTL8125 2.5GbE vendor: Gigabyte driver: r8169 v: kernel port: f000 bus ID: 05:00.0 
           IF: eno1 state: down mac: <filter> 
           Device-2: Intel Wi-Fi 6 AX200 driver: iwlwifi v: kernel port: f000 bus ID: 06:00.0 
           IF: wlp6s0 state: up mac: <filter> 
           IF-ID-1: br-2d1508cdb618 state: down mac: <filter> 
           IF-ID-2: br-613cc1964d04 state: down mac: <filter> 
           IF-ID-3: br-cb48f4622c19 state: down mac: <filter> 
           IF-ID-4: docker0 state: down mac: <filter> 
Bluetooth: Device-1: Intel AX200 Bluetooth type: USB driver: btusb v: 0.8 bus ID: 1-8:4 
           Report: ID: hci0 state: up running pscan iscan bt-v: 3.0 lmp-v: 5.2 address: <filter> 
Drives:    Local Storage: total: 1.16 TiB used: 156.03 GiB (13.1%) 
           ID-1: /dev/nvme0n1 vendor: Seagate model: XPG GAMMIX S50 Lite size: 953.87 GiB 
           ID-2: /dev/nvme1n1 vendor: Samsung model: SSD 980 PRO 250GB size: 232.89 GiB 
Partition: ID-1: / size: 227.23 GiB used: 156.03 GiB (68.7%) fs: ext4 dev: /dev/nvme1n1p1 
Swap:      ID-1: swap-1 type: partition size: 976 MiB used: 0 KiB (0.0%) dev: /dev/nvme1n1p5 
Sensors:   System Temperatures: cpu: 35.5 C mobo: 16.8 C gpu: nvidia temp: 46 C 
           Fan Speeds (RPM): N/A gpu: nvidia fan: 0% 
Info:      Processes: 312 Uptime: 20m Memory: 15.6 GiB used: 3.38 GiB (21.7%) Init: systemd runlevel: 5 Compilers: gcc: 10.2.1 
           Packages: 3096 Shell: Bash v: 5.1.4 inxi: 3.3.01 

Poking around through dmesg logs after a boot, there are two big sections that stick out to me, but I'm not exactly sure how to move forward with them. Any help would be appreciated!

This first section, where we seem to start doing ACPI things, before going to tsc/clocksource things, and then wait an entire other second before moving back to ACPI:

Code: Select all

[    0.973370] pcieport 0000:00:01.1: PME: Signaling with IRQ 27
[    0.973406] pcieport 0000:00:01.1: AER: enabled with IRQ 27
[    0.973518] pcieport 0000:00:01.2: PME: Signaling with IRQ 28
[    0.973566] pcieport 0000:00:01.2: AER: enabled with IRQ 28
[    0.973681] pcieport 0000:00:03.1: PME: Signaling with IRQ 29
[    0.973718] pcieport 0000:00:03.1: AER: enabled with IRQ 29
[    0.973867] pcieport 0000:00:07.1: PME: Signaling with IRQ 31
[    0.973902] pcieport 0000:00:07.1: AER: enabled with IRQ 31
[    0.974008] pcieport 0000:00:08.1: PME: Signaling with IRQ 32
[    0.974044] pcieport 0000:00:08.1: AER: enabled with IRQ 32
[    0.974613] shpchp: Standard Hot Plug PCI Controller Driver version: 0.4
[    0.974641] Monitor-Mwait will be used to enter C-1 state
[    0.974644] ACPI: \_SB_.PLTF.C000: Found 2 idle states
[    0.974685] ACPI: \_SB_.PLTF.C002: Found 2 idle states
[    0.974731] ACPI: \_SB_.PLTF.C004: Found 2 idle states
[    0.974765] ACPI: \_SB_.PLTF.C006: Found 2 idle states
[    0.974814] ACPI: \_SB_.PLTF.C008: Found 2 idle states
[    0.974859] ACPI: \_SB_.PLTF.C00A: Found 2 idle states
[    0.974904] ACPI: \_SB_.PLTF.C001: Found 2 idle states
[    0.974948] ACPI: \_SB_.PLTF.C003: Found 2 idle states
[    0.974996] ACPI: \_SB_.PLTF.C005: Found 2 idle states
[    0.975043] ACPI: \_SB_.PLTF.C007: Found 2 idle states
[    0.975087] ACPI: \_SB_.PLTF.C009: Found 2 idle states
[    0.975134] ACPI: \_SB_.PLTF.C00B: Found 2 idle states
[    1.977709] tsc: Refined TSC clocksource calibration: 3693.061 MHz
[    1.977717] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x6a7777116fa, max_idle_ns: 881590883556 ns
[    1.977751] clocksource: Switched to clocksource tsc
[    3.002456] ACPI: Invalid passive threshold
[    3.002562] thermal LNXTHERM:00: registered as thermal_zone0
[    3.002563] ACPI: Thermal Zone [TZ10] (17 C)
[    3.002595] ACPI: Invalid passive threshold
[    3.002620] thermal LNXTHERM:01: registered as thermal_zone1
[    3.002620] ACPI: Thermal Zone [UAD0] (17 C)
[    3.002732] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    3.002987] Linux agpgart interface v0.103
[    3.003338] AMD-Vi: AMD IOMMUv2 loaded and initialized
[    3.003876] i8042: PNP: No PS/2 controller found.
[    3.003908] mousedev: PS/2 mouse device common for all mice
[    3.003931] rtc_cmos 00:02: RTC can wake from S4
[    3.004145] rtc_cmos 00:02: registered as rtc0
[    3.004204] rtc_cmos 00:02: setting system clock to 2023-01-24T20:42:52 UTC (1674592972)
[    3.004211] rtc_cmos 00:02: alarms up to one month, y3k, 114 bytes nvram, hpet irqs
[    3.004286] ledtrig-cpu: registered to indicate activity on CPUs
[    3.004416] NET: Registered protocol family 10
and then this section, where we take almost 3 seconds doing... something? with nvme

Code: Select all

[    3.105472] ACPI: Power Button [PWRF]
[    3.106888] ACPI: bus type USB registered
[    3.106896] usbcore: registered new interface driver usbfs
[    3.106899] usbcore: registered new interface driver hub
[    3.106907] usbcore: registered new device driver usb
[    3.109884] libata version 3.00 loaded.
[    3.115939] nvme nvme1: Shutdown timeout set to 10 seconds
[    3.122130] nvme nvme1: 32/0/0 default/read/poll queues
[    3.123975]  nvme1n1: p1 p2 < p5 >
[    5.911282] nvme nvme0: 15/0/0 default/read/poll queues
[    6.111801]  nvme0n1: p1 p2 p3
[    6.127641] ahci 0000:02:00.1: version 3.0
[    6.127772] ahci 0000:02:00.1: AHCI 0001.0301 32 slots 6 ports 6 Gbps 0x3f impl SATA mode
[    6.127773] ahci 0000:02:00.1: flags: 64bit ncq sntf stag pm led clo only pmp pio slum part sxs deso sadm sds apst 
[    6.128075] scsi host0: ahci
[    6.128147] scsi host1: ahci
[    6.128203] scsi host2: ahci
[    6.128270] scsi host3: ahci
[    6.128338] scsi host4: ahci
[    6.128404] scsi host5: ahci
[    6.128432] ata1: SATA max UDMA/133 abar m131072@0xfc580000 port 0xfc580100 irq 90
[    6.128434] ata2: SATA max UDMA/133 abar m131072@0xfc580000 port 0xfc580180 irq 90
[    6.128435] ata3: SATA max UDMA/133 abar m131072@0xfc580000 port 0xfc580200 irq 90
[    6.128436] ata4: SATA max UDMA/133 abar m131072@0xfc580000 port 0xfc580280 irq 90
[    6.128438] ata5: SATA max UDMA/133 abar m131072@0xfc580000 port 0xfc580300 irq 90
[    6.128439] ata6: SATA max UDMA/133 abar m131072@0xfc580000 port 0xfc580380 irq 90
[    6.147023] r8169 0000:05:00.0 eth0: RTL8125B, 18:c0:4d:6a:1b:66, XID 641, IRQ 91
[    6.147024] r8169 0000:05:00.0 eth0: jumbo features [frames: 9194 bytes, tx checksumming: ko]
[    6.443638] ata3: SATA link down (SStatus 0 SControl 330)
[    6.443870] ata4: SATA link down (SStatus 0 SControl 330)
[    6.443892] ata1: SATA link down (SStatus 0 SControl 330)
[    6.443912] ata6: SATA link down (SStatus 0 SControl 330)
[    6.443999] ata2: SATA link down (SStatus 0 SControl 330)
[    7.169481] ata5: failed to resume link (SControl 0)
[    7.169493] ata5: SATA link down (SStatus 0 SControl 0)

User avatar
FreewheelinFrank
Global Moderator
Global Moderator
Posts: 2065
Joined: 2010-06-07 16:59
Has thanked: 38 times
Been thanked: 221 times

Re: [Software] Minimizing kernel time during boot

#2 Post by FreewheelinFrank »

Moved because not beginner question.

I think you'll be more likely to find an answer here.

User avatar
kent_dorfman766
Posts: 531
Joined: 2022-12-16 06:34
Location: socialist states of america
Has thanked: 57 times
Been thanked: 69 times

Re: [Software] Minimizing kernel time during boot

#3 Post by kent_dorfman766 »

7 seconds? I'd take that and be happy, personally. To support the vast array of available hardware kernel/driver initialization has to be very adhoc since each device has its own rules for initialization.

Unless you intend to prepare an embedded image where you audit every startup component for its necessity, I think you're playing whack-a-mole, but if it makes you happy, then go for it. LOL

But to answer your sepcific questions about the above: ACPI (advanced configuration and opwer interface) ... I think the hint is in the following line where it says "threshold"...some device isn't responding in a timely manner and the kernel is doing the sane thing by waiting? That is my WAG

Next, SATA channel initalization. Just because there are a lot of SSD devices on machines these days doesn't mean the SATA channel will ignore the sane timeouts that are required for rotational disks. Especially during enumeration when it's not sure what is on the bus yet.

CwF
Global Moderator
Global Moderator
Posts: 2625
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 190 times

Re: [Software] Minimizing kernel time during boot

#4 Post by CwF »

I'm not sure exactly how big this topic is? I have snooped around a bit to find differences and tested different inits and kernels, but overall ignore it since I space out longer than that.

You maybe have startpar.deb installed, I've wondered on that one since I don't have it in everything.

But at the 3.00 point we're hitting the network is a little behind. I see up to 0.47

Code: Select all

# dmesg | grep NET
[    0.157814] NET: Registered PF_NETLINK/PF_ROUTE protocol family
Then again some ayatems take a minute for the first post beep...

Post Reply