Hello,
I'm experiencing timing issues when running OpenBSD 6.2 (and 6.1) as
guests on QEMU/KVM. Is there anything that you can recommend?
Here's the scenario.
Host CPU: 2 x Intel E5-2630 v3 2.4 Ghz
Host OS: Fedora 27
Virtualization software: QEMU + KVM (2.10.0-1.fc27)
Guest Machine: default (pc-i440fx-2.10)
Guest OS: OpenBSD 6.2 (and 6.1).
Basically, OpenBSD processes degrade over time to the point where
they're completely unresponsive. This simple date printout script is a
good example. It should print out the date once per second, but after
roughly ~20 mins on this hardware configuration, it takes 2 seconds to
print each line, then 4 seconds to print each line, and so on. After
running for about 24 hours, the delay is about 1 minute between line
printouts.
while sleep 1; do date; done
I've discussed this with the OpenBSD team on this thread:
https://marc.info/?t=151430936500001&r=1&w=2
In a nutshell:
* OpenBSD dev claims QEMU/KVM local APIC emulation is broken.
* OpenBSD dev states that OpenBSD uses local APIC to interrupt every
10ms in "repeated mode".
* OpenBSD dev claims that other systems (Linux, FreeBSD) likely do not
use the local APIC in "repeated mode".
I'm not familiar enough with low-level development to verify or confirm
these claims.
I've tried tweaking some different settings on the guest and host, such
as disabling the HPET timer and x2apic, neither of which has proven
effective.
Adding "kvm-intel.preemption_timer=0" on the host kernel commandline
seems to resolve the timing issue. However, I had at least one host that
wouldn't reboot cleanly with this flag enabled.
This is only an issue on OpenBSD. Other guest operating systems (CentOS,
Ubuntu, FreeBSD) on the same machine do not exhibit this behavior.
I'm happy to provide more information, if needed.
Best regards,
Andrew