This document tries to give an overview how recent versions of OpenBSD run best as VM on an hypervisor. It is centered on Linux/KVM/qemu, but some of it is also valid for other hypervisors.

If you notice errors or have information/advice that is missing here, send it to me at sf@sfritsch.de.

Short summary

The problem of i386

OpenBSD/i386 uses some interrupt controller feature (the "TPR") excessively that is difficult to emulate without special hardware support. Intel introduced this hardware support (called "flexpriority") in back 2008 or so, but AMD unfortunately never did. Therefore it is a really bad idea to run OpenBSD/i386 as VM on AMD hosts or on very old Intel hosts. The performance will be at least 10 times slower than normal. A kind of workaround is possible for single VCPU VMs by switching "mpbios" off in OpenBSD, but that may expose other problems.

The general advice is: Use OpenBSD/amd64 in VMs, not OpenBSD/i386. In particular if your machine lacks the flexpriority feature (see /proc/cpuinfo). Even with the flexpriority feature, i386 is not as fast as amd64. The difference will become even larger with OpenBSD 5.7, because it will get some optimizations under amd64 that are not there under i386, yet. And OpenBSD/amd64 has better NX and ASLR support, anyway.

Update: AMD's "Carrizo" introduce the AVIC feature which may solve the problem, too. Support in KVM is still missing as of Linux 4.5.

Disk drivers

Network drivers

General advice for virtio drivers

Unfortunately the OpenBSD virtio drivers had some ugly bugs up to and including 5.6. In particular this could cause network hangs that would go away after a "ifconfig down" and "ifconfig up". To fix this, apply the virtio errata patches for OpenBSD 5.5/5.6. If you use an older OpenBSD version, upgrade.