Slow performance issues of OpenBSD or FreeBSD KVM guest on Linux

I run a couple of OpenBSD and FreeBSD guest/virtual machines under KVM. My server has 32GB ram and 4C/8T Intel Xeon CPU. Everything was working fine until recent CentOS Linux 7 kernel update. After a fresh reboot of my CentOS 7 Linux box OpenBSD and FreeBSD machine become very slow and after 24 hours stop responding to the network request. How can I solve significant performance problems with BSD family of oses running on CentOS 7 KVM?

Kernel-based Virtual Machine (KVM), is a hypervisor built into the Linux kernel. CentOS Linux version 7 can turn into a hypervisor with the help of KVM installation. One can run multiple virtual machines/guest VM running unmodified GNU/Linux, *BSD family of operating system such as OpenBSD, NetBSD, FreeBSD,MS-Windows, or more.

Fixing the slow performance issues of OpenBSD or FreeBSD KVM guest

It looks like after CentOS Linux kernel updates (reboot) OpenBSD and FreeBSD based virtual machines becomes very slow. You can run a simple command such as date or sleep to verify this dealy issue on a BSD based system running under KVM:
time date
time sleep 1
time sleep 5

The “sleep 1” command takes up to 5-10 seconds to complete it. Naturally, it is annoying, and after a day or two, my OpenBSD based system complete stopped responding.

Solution for kvm_intel

You need to disable kvm_intel.preemption_time when loading kvm model on Intel based cpu. You need to create a file named kvm.conf in /etc/modprobe.d. Use a text editor such as vim or vi or nano to create a file:
# vim /etc/modprobe.d/kvm.conf
Append the following
options kvm_intel preemption_timer=N
Save and close the file in vim/vi. Next you need to reboot the CentOS Linux 7.x server using the reboot command or shutdown command:
# reboot
# shutdown -r 0


Use the cat command as follows:
$ cat /sys/module/kvm_intel/parameters/preemption_timer
Login to OpenBSD/FreeBSD based VM using the ssh command or virsh command:
$ ssh vivek@openbsd-kvm-vm-ip
# virsh console openbsd63-vm1
Run commands inside the VM with time:
$ time sleep 1
$ time sleep 5
$ time date
$ ping -c 2

Now everything should work fine and your VM will stay up and running for days or until your reboot the box/vm for kernel update or hardware update.


Timing issue with QEMU/KVM and OpenBSD has been reported and I hope fix will be released.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 0 comments... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum