- May 26, 2020
Here are some optization things you can do to improve the performance of your KVM Guest. This section focuses on Host-side optimizations but you can follow the Windows Guests section below this post to improve Guest OS.
Optimizing the Host:
When following my VFIO guide make sure you set your isolcpus parameter in the Grub Kernel line to the CPU cores you want to dedicate to the VM.
Grub Line Options:
isocpus=2-7 nohz_full=2-7 rcu_nocbs=2-7 iommu=pt transparent_hugepage=never pcie_acs_override=downstream,multifunction
Install cpupower on Host. You can also install the cpupower-gui package as well.
# pacman -S cpupower $ cpupower frequency-info $ cpupower frequency-set -f [I]clock_freq $ cpupower frequency-set -g perfomance
default_hugepagesz=1G hugepagesz=1G hugepages=20"
For systemd distros edit the file below:
[ech0@ech0-arch ~]$ nano /etc/systemd/system.conf ... [Manager] CPUAffinity=1 ... [Exec] CPUAffinity=0-1
Kernel Preemptible Kernel: Low Latency Desktop:
This must be done at kernel compile time. Basically this sacrifices a very small amount of throughput (overall performance) for the lowest latency possible.
If low jitter is really important to you may want to use both 1000hz and PREEMPT. In most cases though this is not necessary.
Using a Zen-VFIO kernel:
This is basically the above but already on the AUR. You will just need to compile yourself or use one of the precompiled kernels (link below). Do NOT use an AUR helper to compile this! Compile using makepkg.
mkdir /tmp/compile && cd /tmp/compile pacman -Syyu git git clone https://aur.archlinux.org/linux-zen-vfio.git cd linux-zen-vfio && makepkg -sci
Add option in /etc/makepkg.conf with
If you are not on Arch or you don't want to compile yourself you can grab a precompiled build here
Make sure ‘tsc’ is set as clock source. You can check this via: