AMD Ryzen low latency QEMU

Finally got the process latency under 1000. Using q35 and reinstalled Windows again.

Currently not isolating the CPUs or using pinning, you can change the scheduler, which makes it better.

/etc/libvirt/hooks/qemu:

#!/bin/bash

if [ "$1" == "win10" ] && [ "$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

Change win10 to the name of your VM.

Also, compiled the kernel with the Fedora config, somebody said the config Fedora uses is better, you can find it here. CONFIG_CRYPTO_DEV_SP_PSP is disabled on that kernel, otherwise no KVM, if using a newer bios on your motherboard.

/etc/libvirt/qemu/win10.xml: [xml]

win10 4f1b8ccb-91c9-44a9-8a8a-1c847ce8f886 16777216 16777216 8 hvm /usr/share/ovmf/ovmf_code_x64.bin /var/lib/libvirt/qemu/nvram/win10_VARS.fd destroy restart destroy /usr/sbin/qemu-system-x86_64
[/xml] Didn't install the latest AMD driver for my video card, that could be what is making the latency high. It's using the one Windows installs from 2017. Only problem is, some games might not work right with an old driver. Then I guess I'll have to buy a NVIDIA card, and hope it works better.

MSI is enabled for everything too. The latency was lower before doing that then before though. Still under 1000, without MSI on everything. Only played Fortnite, seemed smoother, don’t use the auto settings though.

DDU doesn’t work, because Windows reinstalls the driver. Even if you disable the auto driver install.

Installing the latest driver doesn’t really work, you’ll get a black screen. The settings program for it, doesn’t work, probably because it didn’t install the new version.

Battlefield 1 runs better, mostly just one icon, the ping. A 92ms ping is apparently high. Some other icon popped up a couple of times, don’t know what it means. Isolating the CPUs might reduce the latency more.

Don’t need a FreeSync monitor now. That means I can buy Linux a bigger NVMe SSD.

Update Kernel 4.18.10 has the SEV patch, so you shouldn’t need CONFIG_CRYPTO_DEV_SP_PSP disabled. Compiling it now, with that enabled. It can be found here. And it works with that enabled, just like 4.19 with the patch applied.

It’ll say something like “sev command 0x4 timed out, disabling PSP” in dmesg.