Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mkopec opened this issue Mar 26, 2024 · 3 comments
Open

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

mkopec opened this issue Mar 26, 2024 · 3 comments
Labels
bug Something isn't working pcengines_apu2

Comments

@mkopec
Copy link
Member

mkopec commented Mar 26, 2024

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

  • Boot into any distro based on systemd
  • Run systemd-analyze

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 mkopec added bug Something isn't working pcengines_apu2 labels Mar 26, 2024
@mkopec
Copy link
Member Author

mkopec commented Mar 26, 2024

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

@mkopec
Copy link
Member Author

mkopec commented Mar 26, 2024

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
Copy link
Contributor

miczyg1 commented Mar 28, 2024

@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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pcengines_apu2
Projects
None yet
Development

No branches or pull requests

2 participants