u/Low-Location5266

▲ 8 r/VFIO

Optimize KVM for gaming

Hello; I Fortnite on KVM with single GPU passthrough using a patched QEMU and EDK II. However I’m getting a lot of lag and only around 40–60 FPS. How could I optimize my XML configuration or anything else ?

<domain type="kvm">

&lt;name&gt;win11&lt;/name&gt;
&lt;uuid&gt;01c59c89-26d0-446f-89b6-fc38fa447e1b&lt;/uuid&gt;
  &lt;metadata&gt;

&lt;libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0"&gt;
&lt;libosinfo:os id="http://microsoft.com/win/11"/&gt;
&lt;/libosinfo:libosinfo&gt;
  &lt;/metadata&gt;

&lt;memory unit="KiB"&gt;16775168&lt;/memory&gt;
&lt;currentMemory unit="KiB"&gt;16775168&lt;/currentMemory&gt;
&lt;vcpu placement="static"&gt;4&lt;/vcpu&gt;
  &lt;cputune&gt;

&lt;vcpupin vcpu="0" cpuset="2"/&gt;

&lt;vcpupin vcpu="1" cpuset="3"/&gt;

&lt;vcpupin vcpu="2" cpuset="4"/&gt;

&lt;vcpupin vcpu="3" cpuset="5"/&gt;

&lt;emulatorpin cpuset="0-1"/&gt;

  &lt;/cputune&gt;

  &lt;sysinfo type="smbios"&gt;

&lt;bios&gt;

&lt;entry name="vendor"&gt;American Megatrends Inc.&lt;/entry&gt;
&lt;entry name="version"&gt;F31o&lt;/entry&gt;
&lt;entry name="date"&gt;12/03/2020&lt;/entry&gt;
&lt;/bios&gt;

&lt;system&gt;

&lt;entry name="manufacturer"&gt;Gigabyte Technology Co., Ltd.&lt;/entry&gt;
&lt;entry name="product"&gt;X570 AORUS ULTRA&lt;/entry&gt;
&lt;entry name="version"&gt;Rev 1.0&lt;/entry&gt;
&lt;entry name="serial"&gt;163058293563&lt;/entry&gt;
&lt;entry name="uuid"&gt;01c59c89-26d0-446f-89b6-fc38fa447e1b&lt;/entry&gt;
&lt;entry name="sku"&gt;To be filled by O.E.M.&lt;/entry&gt;
&lt;entry name="family"&gt;X570 MB&lt;/entry&gt;
&lt;/system&gt;

  &lt;/sysinfo&gt;

  &lt;os&gt;

&lt;type arch="x86\_64" machine="pc-q35-11.0"&gt;hvm&lt;/type&gt;
&lt;loader readonly="yes" secure="yes" type="pflash" format="raw"&gt;/home/kaizaki/edk2/Build/OvmfX64/DEBUG_GCC5/FV/OVMF_CODE.fd&lt;/loader&gt;
&lt;nvram template="/home/kaizaki/edk2/Build/OvmfX64/DEBUG\_GCC5/FV/OVMF\_VARS.fd" templateFormat="raw" format="raw"&gt;/var/lib/libvirt/qemu/nvram/win11_VARS.fd&lt;/nvram&gt;
&lt;boot dev="hd"/&gt;

  &lt;/os&gt;

  &lt;features&gt;

&lt;acpi/&gt;

&lt;apic/&gt;

&lt;hyperv mode="custom"&gt;

&lt;relaxed state="on"/&gt;

&lt;vapic state="on"/&gt;

&lt;spinlocks state="on" retries="8191"/&gt;

&lt;vpindex state="on"/&gt;

&lt;synic state="on"/&gt;

&lt;stimer state="on"/&gt;

&lt;frequencies state="on"/&gt;

&lt;/hyperv&gt;

&lt;kvm&gt;

&lt;hidden state="on"/&gt;

&lt;/kvm&gt;

&lt;vmport state="off"/&gt;

&lt;smm state="on"/&gt;

  &lt;/features&gt;

  &lt;cpu mode="host-passthrough" check="none" migratable="on"&gt;

&lt;topology sockets="1" dies="1" clusters="1" cores="4" threads="1"/&gt;

&lt;feature policy="disable" name="smep"/&gt;

&lt;feature policy="disable" name="hypervisor"/&gt;

&lt;feature policy="require" name="vmx"/&gt;

&lt;feature policy="require" name="invtsc"/&gt;

&lt;feature policy="require" name="aes"/&gt;

  &lt;/cpu&gt;

  &lt;clock offset="localtime"&gt;

&lt;timer name="rtc" tickpolicy="catchup"/&gt;

&lt;timer name="pit" tickpolicy="delay"/&gt;

&lt;timer name="hpet" present="no"/&gt;

&lt;timer name="hypervclock" present="yes"/&gt;

&lt;timer name="tsc" present="yes" mode="native"/&gt;

  &lt;/clock&gt;

&lt;on_poweroff&gt;destroy&lt;/on_poweroff&gt;
&lt;on_reboot&gt;restart&lt;/on_reboot&gt;
&lt;on_crash&gt;destroy&lt;/on_crash&gt;
  &lt;pm&gt;

&lt;suspend-to-mem enabled="no"/&gt;

&lt;suspend-to-disk enabled="no"/&gt;

  &lt;/pm&gt;

  &lt;devices&gt;

&lt;emulator&gt;/home/kaizaki/qemu/build/qemu-system-x86_64&lt;/emulator&gt;
&lt;disk type="file" device="disk"&gt;

&lt;driver name="qemu" type="raw"/&gt;

&lt;source file="/home/kaizaki/KVM/win11.img"/&gt;

&lt;target dev="sda" bus="sata"/&gt;

&lt;address type="drive" controller="0" bus="0" target="0" unit="0"/&gt;

&lt;/disk&gt;

&lt;disk type="file" device="cdrom"&gt;

&lt;driver name="qemu" type="raw"/&gt;

&lt;target dev="sdb" bus="sata"/&gt;

&lt;readonly/&gt;

&lt;address type="drive" controller="0" bus="0" target="0" unit="1"/&gt;

&lt;/disk&gt;

&lt;disk type="file" device="disk"&gt;

&lt;driver name="qemu" type="raw"/&gt;

&lt;source file="/mnt/bcache/Jeu/fortnite.img"/&gt;

&lt;target dev="sdc" bus="sata"/&gt;

&lt;address type="drive" controller="0" bus="0" target="0" unit="2"/&gt;

&lt;/disk&gt;

&lt;controller type="usb" index="0" model="qemu-xhci" ports="15"&gt;

&lt;address type="pci" domain="0x0000" bus="0x02" slot="0x00" function="0x0"/&gt;

&lt;/controller&gt;

&lt;controller type="pci" index="0" model="pcie-root"/&gt;

&lt;controller type="pci" index="1" model="pcie-root-port"&gt;

&lt;model name="pcie-root-port"/&gt;

&lt;target chassis="1" port="0x10"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/&gt;

&lt;/controller&gt;

&lt;controller type="pci" index="2" model="pcie-root-port"&gt;

&lt;model name="pcie-root-port"/&gt;

&lt;target chassis="2" port="0x11"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x1"/&gt;

&lt;/controller&gt;

&lt;controller type="pci" index="3" model="pcie-root-port"&gt;

&lt;model name="pcie-root-port"/&gt;

&lt;target chassis="3" port="0x12"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x2"/&gt;

&lt;/controller&gt;

&lt;controller type="pci" index="4" model="pcie-root-port"&gt;

&lt;model name="pcie-root-port"/&gt;

&lt;target chassis="4" port="0x13"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x3"/&gt;

&lt;/controller&gt;

&lt;controller type="pci" index="5" model="pcie-root-port"&gt;

&lt;model name="pcie-root-port"/&gt;

&lt;target chassis="5" port="0x14"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x4"/&gt;

&lt;/controller&gt;

&lt;controller type="pci" index="6" model="pcie-root-port"&gt;

&lt;model name="pcie-root-port"/&gt;

&lt;target chassis="6" port="0x15"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x5"/&gt;

&lt;/controller&gt;

&lt;controller type="pci" index="7" model="pcie-root-port"&gt;

&lt;model name="pcie-root-port"/&gt;

&lt;target chassis="7" port="0x16"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x6"/&gt;

&lt;/controller&gt;

&lt;controller type="pci" index="8" model="pcie-root-port"&gt;

&lt;model name="pcie-root-port"/&gt;

&lt;target chassis="8" port="0x17"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x7"/&gt;

&lt;/controller&gt;

&lt;controller type="pci" index="9" model="pcie-root-port"&gt;

&lt;model name="pcie-root-port"/&gt;

&lt;target chassis="9" port="0x18"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0" multifunction="on"/&gt;

&lt;/controller&gt;

&lt;controller type="pci" index="10" model="pcie-root-port"&gt;

&lt;model name="pcie-root-port"/&gt;

&lt;target chassis="10" port="0x19"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x1"/&gt;

&lt;/controller&gt;

&lt;controller type="pci" index="11" model="pcie-root-port"&gt;

&lt;model name="pcie-root-port"/&gt;

&lt;target chassis="11" port="0x1a"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x2"/&gt;

&lt;/controller&gt;

&lt;controller type="pci" index="12" model="pcie-root-port"&gt;

&lt;model name="pcie-root-port"/&gt;

&lt;target chassis="12" port="0x1b"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x3"/&gt;

&lt;/controller&gt;

&lt;controller type="pci" index="13" model="pcie-root-port"&gt;

&lt;model name="pcie-root-port"/&gt;

&lt;target chassis="13" port="0x1c"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x4"/&gt;

&lt;/controller&gt;

&lt;controller type="pci" index="14" model="pcie-root-port"&gt;

&lt;model name="pcie-root-port"/&gt;

&lt;target chassis="14" port="0x1d"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x5"/&gt;

&lt;/controller&gt;

&lt;controller type="sata" index="0"&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x1f" function="0x2"/&gt;

&lt;/controller&gt;

&lt;controller type="virtio-serial" index="0"&gt;

&lt;address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/&gt;

&lt;/controller&gt;

&lt;interface type="network"&gt;

&lt;mac address="52:54:00:f0:93:fd"/&gt;

&lt;source network="default"/&gt;

&lt;model type="e1000e"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/&gt;

&lt;/interface&gt;

&lt;serial type="pty"&gt;

&lt;target type="isa-serial" port="0"&gt;

&lt;model name="isa-serial"/&gt;

&lt;/target&gt;

&lt;/serial&gt;

&lt;console type="pty"&gt;

&lt;target type="serial" port="0"/&gt;

&lt;/console&gt;

&lt;input type="tablet" bus="usb"&gt;

&lt;address type="usb" bus="0" port="1"/&gt;

&lt;/input&gt;

&lt;input type="mouse" bus="ps2"/&gt;

&lt;input type="keyboard" bus="ps2"/&gt;

&lt;sound model="ich9"&gt;

&lt;address type="pci" domain="0x0000" bus="0x00" slot="0x1b" function="0x0"/&gt;

&lt;/sound&gt;

&lt;audio id="1" type="none"/&gt;

&lt;hostdev mode="subsystem" type="pci" managed="yes"&gt;

&lt;source&gt;

&lt;address domain="0x0000" bus="0x03" slot="0x00" function="0x0"/&gt;

&lt;/source&gt;

&lt;rom file="/usr/share/vgabios/rx-6600.rom"/&gt;

&lt;address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/&gt;

&lt;/hostdev&gt;

&lt;hostdev mode="subsystem" type="pci" managed="yes"&gt;

&lt;source&gt;

&lt;address domain="0x0000" bus="0x03" slot="0x00" function="0x1"/&gt;

&lt;/source&gt;

&lt;address type="pci" domain="0x0000" bus="0x06" slot="0x00" function="0x0"/&gt;

&lt;/hostdev&gt;

&lt;hostdev mode="subsystem" type="usb" managed="yes"&gt;

&lt;source startupPolicy="mandatory"&gt;

&lt;vendor id="0x1e7d"/&gt;

&lt;product id="0x2cf1"/&gt;

&lt;/source&gt;

&lt;address type="usb" bus="0" port="2"/&gt;

&lt;/hostdev&gt;

&lt;hostdev mode="subsystem" type="usb" managed="yes"&gt;

&lt;source startupPolicy="mandatory"&gt;

&lt;vendor id="0x03f0"/&gt;

&lt;product id="0x4941"/&gt;

&lt;/source&gt;

&lt;address type="usb" bus="0" port="3"/&gt;

&lt;/hostdev&gt;

&lt;hostdev mode="subsystem" type="usb" managed="yes"&gt;

&lt;source startupPolicy="mandatory"&gt;

&lt;vendor id="0x1b1c"/&gt;

&lt;product id="0x1bc7"/&gt;

&lt;/source&gt;

&lt;address type="usb" bus="0" port="4"/&gt;

&lt;/hostdev&gt;

&lt;watchdog model="itco" action="reset"/&gt;

&lt;memballoon model="virtio"&gt;

&lt;address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/&gt;

&lt;/memballoon&gt;

  &lt;/devices&gt;

&lt;/domain&gt;
reddit.com
u/Low-Location5266 — 7 days ago
▲ 3 r/VFIO

Hi, I would like to know if it is still possible to play Call of Duty: Modern Warfare 2019 and Modern Warfare III (2023) on a VM. If so, what config should be used ?

reddit.com
u/Low-Location5266 — 23 days ago