On Wed, Oct 2, 2019 at 9:26 AM Chris Murphy <[email protected]> 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
_______________________________________________
systemd-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to