Dasharo / dasharo-issues

The Dasharo issue tracker
https://dasharo.com/
25 stars 0 forks source link

Firmware boot time reported by `systemd-analyze` is too high #761

Open mkopec opened 7 months ago

mkopec commented 7 months ago

Device

PC Engines apu4

Dasharo version

Dasharo (coreboot+UEFI) v0.9.0

Affected component(s) or functionality

UEFI FPDT tables?

Brief summary

Firmware boot time reported by systemd is way too high

How reproducible

100%

How to reproduce

Expected behavior

Actual boot time is reported

Actual behavior

Systemd thinks firmware took 17 minutes:

Startup finished in 17min 27.177s (firmware) + 16.823s (loader) + 31.836s (kernel) + 2min 58.154s (userspace) = 21min 13.993s
graphical.target reached after 2min 55.584s in userspace

while it actually took a couple of seconds from power-on to get into GRUB.

Screenshots

No response

Additional context

No response

Solutions you've tried

No response

mkopec commented 7 months ago

@miczyg1 any ideas? I know you were working on timer issues in UEFIPayload in recent MSI releases

mkopec commented 7 months ago

I get much saner values if I do a full power cycle:

Startup finished in 14.207s (firmware) + 16.057s (loader) + 31.428s (kernel) + 2min 58.366s (userspace) = 4min 60ms
graphical.target reached after 2min 55.699s in userspace

then when I power off and power back on via power button:

Startup finished in 4min 39.135s (firmware) + 16.038s (loader) + 31.960s (kernel) + 2min 59.888s (userspace) = 8min 27.023s
graphical.target reached after 2min 57.223s in userspace

So it looks like the initial timestamp stays the same across resets, but the counter keeps incrementing?

FPDT: Boot Performance - ResetEnd                = 2115812
FPDT: Boot Performance - OsLoaderLoadImageStart  = 279070543043
FPDT: Boot Performance - OsLoaderStartImageStart = 279135211598
FPDT: Boot Performance - ExitBootServicesEntry   = 295163870827
miczyg1 commented 7 months ago

@mkopec this will not work. The EDK2 code assumes that TSC frequency can be obtained from CPUID EAX=0x15 (https://github.com/Dasharo/edk2/blob/dasharo/UefiCpuPkg/Library/CpuTimerLib/CpuTimerLib.c#L55), which is not supported by AMD GX-412TC (max CPUID leaf is 0xd).

A solution would be to take it from CPUID 0x15 if max leaf is greater or equal 0x15. Otherwise try to take the TSC frequency from coreboot timestamp table (https://github.com/Dasharo/edk2/blob/dasharo/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c#L961)