Fix OpenBSD guest CPU idle usage – KVM / Proxmox (qemu)

When running OpenBSD as guest under KVM, the qemu CPU usage can be quite high.
This seems to be partly because of the USB drivers being active in OpenBSD, what you can do is to disable loading of the USB drivers.
NOTE: This will stop USB keyboards and mouse from working, so it’s really only suitable for headless servers with ssh or vnc console access.

Make sure your KVM machine type is set to i440fx which should be the default setting in qemu, my guest was installed as an EFI system but it should work with BIOS too.
In the OpenBSD guest, create a file called /etc/bsd.re-config and add the following:


disable usb
disable ahci
disable uhci
disable xhci

Save the file and reboot the OpenBSD guest, the qemu/kvm process should have resonable CPU usage now, it’s might still be ~1% higher than other OSes though.

For reference, here are my proxmox settings for the OpenBSD guest:

balloon: 0
bios: ovmf
boot: order=virtio0;ide2;net0
cores: 4
cpu: max,flags=+aes
efidisk0: ext-local01:1180/vm-1180-disk-0.qcow2,efitype=4m,pre-enrolled-keys=1,size=528K
ide2: none,media=cdrom
memory: 4096
meta: creation-qemu=9.0.0,ctime=1721055908
name: OpenBSD
net0: virtio=BC:24:11:A7:55:35,bridge=vmbr0,firewall=1
numa: 0
ostype: other
scsihw: virtio-scsi-pci
smbios1: uuid=fe4b2233-55f9-445e-8355-6d9532228dcd
sockets: 1
tablet: 0
virtio0: ext-local01:1180/vm-1180-disk-1.qcow2,backup=1,cache=writeback,iothread=1,size=32G
vmgenid: 42f0eef1-b401-4988-ae8c-f09779ce062b