- May 26, 2020
DPC Latency has always been a problem for VFIO VMs and most people never really solve it. This guide will break down what I do to get DPC latency down super low even for 2 Gaming VMs running at the same time. Here is DPC Latency on my VM.
So how do we even test DPC latency? You'll want to download and install this Windows utility in your VM located here
First make sure you have follow my KVM Optimizations Guide here. You'll especially want to make sure you used the MSI_Utility from this thread here.
Changing Scheduler on VM Startup:
Now need to change our CPU scheduler. This by far has had the most impact on my VM Latency. We will be using the fifo scheduler. If you don't use libvirt but just a QEMU script, prefix your line with:
chrt -f 1 qemu-system-x86_64
[ech0@ech0-arch ~]$ nano /etc/libvirt/hooks/qemu ... #!/bin/bash if [ "$1" == "DOMAIN NAME" ] && [ "$2" == "started" ]; then if pid=$(pidof qemu-system-x86_64); then chrt -f -p 1 $pid echo $(date) changing scheduling for pid $pid >> /var/log/libvirthook.log fi fi #debug echo $(date) libvirt hook $1 $2 $3 $4 >> /var/log/libvirthook.log
Now restart libvirt with
systemctl restart libvrtdand then start your VM.
Now install LatencyMon from above if you haven't. Run it as Admin and then click start in the top left corner. Open a couple of YouTube videos. Try to pick a video that is 7+ minutes. I like to do a video of a game and then a chill song for background noise. Let the LatencyMon run for about 5 minutes. Your latency should be under 100 most of the time with maybe the occasional spike.