[systemd-devel] systemd-analyze shows long firmware time with sd-boot

Mantas Mikulėnas grawity at gmail.com
Wed Oct 2 06:56:51 UTC 2019


On Wed, Oct 2, 2019 at 9:26 AM Chris Murphy <lists at colorremedies.com> wrote:

> Hi,
>
> systemd-243-2.gitfab6f01.fc31.x86_64
>
> systemd-analyze reports very high firmware times, seemingly related to
> uptime since last cold boot. That is, if I poweroff then boot, the
> time for firmware seems reasonable; whereas reboots appear to show
> cumulative time for only the firmware value.
>
> This is in a qemu-kvm VM, using edk2-ovmf-20190501stable-4.fc31.noarch
>
>
systemd-analyze calculates the time delta based on the LoaderTimeInitUSec
EFI variable, which is stored by systemd-boot during initialization.

systemd-boot reads the time by calling 'rdtsc' and dividing it by estimated
ticks/ms. It assumes that the TSC starts at 0, so "firmware time" is just
(current_tsc - 0). (The code is at:
https://github.com/systemd/systemd/blob/master/src/boot/efi/util.c#L15-L60)

Based on this mailing list thread, it looks like qemu-kvm did not reset the
TSC on soft reboot in the past, and I'm not sure if the patches to make it
do so were actually applied or not:
https://qemu-devel.nongnu.narkive.com/jbnsv2H8/patch-kvm-clear-guest-tsc-on-reset

-- 
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20191002/2e55ff57/attachment.html>


More information about the systemd-devel mailing list