You are not logged in.

#1 2022-06-16 04:13:07

JoshKrahn
Member
Registered: 2022-06-16
Posts: 1

Random low fps in games in vm.

Ive been using kvm to game (apex legends) in windows for a while and i get random lag spikes where my fps goes from 165(capped) to like 30-40. The spikes used to be a quick 1 second freeze every once in a while now it doesnt freeze but my fps drops for about a min maybe shorter than goes back up. Im pretty sure this is due to interrupts but im not sure how to find out why and fix it. I ran

 cat /proc/interrupts 

Output:

            CPU0       CPU1       CPU2       CPU3       CPU4       CPU5       CPU6       CPU7       CPU8       CPU9       CPU10      CPU11      
   0:         16          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC    2-edge      timer
   8:          0          0          0          0          0          0          0          0          0          1          0          0  IR-IO-APIC    8-edge      rtc0
   9:          0          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC    9-fasteoi   acpi
  14:          0          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC   14-fasteoi   INT3451:00
  16:          0          0         25          0          0          0          0          0          0          0          0          0  IR-IO-APIC   16-fasteoi   i801_smbus
  17:          0          0          0          0          0          0          0     682818          0          0          0          0  IR-IO-APIC   17-fasteoi   snd_hda_intel:card2, vfio-intx(0000:01:00.1)
 120:          0          0          0          0          0          0          0          0          0          0          0          0  DMAR-MSI    0-edge      dmar0
 121:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 16384-edge      PCIe PME
 122:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 442368-edge      PCIe PME, pciehp
 123:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 458752-edge      PCIe PME, aerdrv
 124:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 466944-edge      PCIe PME, aerdrv
 125:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 475136-edge      PCIe PME, aerdrv
 126:          0          0          0          0          0          0          0          0       8239          0          0          0  IR-PCI-MSI 376832-edge      ahci[0000:00:17.0]
 127:          0          0          0          0          0          0          0          0          0          0    7280218          0  IR-PCI-MSI 327680-edge      xhci_hcd
 128:          0          0          0          0          0          0          0          0          0          0          0         28  IR-PCI-MSI 2621440-edge      nvme0q0
 129:      20387          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 2621441-edge      nvme0q1
 130:          0      18631          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 2621442-edge      nvme0q2
 131:          0          0      19721          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 2621443-edge      nvme0q3
 132:          0          0          0      25835          0          0          0          0          0          0          0          0  IR-PCI-MSI 2621444-edge      nvme0q4
 133:          0          0          0          0      26252          0          0          0          0          0          0          0  IR-PCI-MSI 2621445-edge      nvme0q5
 134:          0          0          0          0          0      26698          0          0          0          0          0          0  IR-PCI-MSI 2621446-edge      nvme0q6
 135:          0          0          0          0          0          0      23858          0          0          0          0          0  IR-PCI-MSI 2621447-edge      nvme0q7
 136:          0          0          0          0          0          0          0      25857          0          0          0          0  IR-PCI-MSI 2621448-edge      nvme0q8
 137:          0          0          0          0          0          0          0          0      24585          0          0          0  IR-PCI-MSI 2621449-edge      nvme0q9
 138:          0          0          0          0          0          0          0          0          0      36317          0          0  IR-PCI-MSI 2621450-edge      nvme0q10
 139:          0          0          0          0          0          0          0          0          0          0      29369          0  IR-PCI-MSI 2621451-edge      nvme0q11
 140:          0          0          0          0          0          0          0          0          0          0          0      29641  IR-PCI-MSI 2621452-edge      nvme0q12
 141:          0         51          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 360448-edge      mei_me
 142:          0          0          0     541159          0          0          0          0          0          0          0          0  IR-PCI-MSI 520192-edge      eno1
 143:          0          0          0          0        626          0          0          0          0          0          0          0  IR-PCI-MSI 514048-edge      snd_hda_intel:card1
 144:          0          0          0          0          0       1727          0          0          0          0          0          0  IR-PCI-MSI 1572864-edge      iwlwifi:default_queue
 145:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 1572865-edge      iwlwifi:queue_1
 146:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 1572866-edge      iwlwifi:queue_2
 147:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 1572867-edge      iwlwifi:queue_3
 148:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 1572868-edge      iwlwifi:queue_4
 149:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 1572869-edge      iwlwifi:queue_5
 150:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 1572870-edge      iwlwifi:queue_6
 151:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 1572871-edge      iwlwifi:queue_7
 152:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 1572872-edge      iwlwifi:queue_8
 153:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 1572873-edge      iwlwifi:queue_9
 154:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 1572874-edge      iwlwifi:queue_10
 155:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 1572875-edge      iwlwifi:queue_11
 156:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI 1572876-edge      iwlwifi:queue_12
 157:          0          0          0          0          0          0          5          0          0          0          0          0  IR-PCI-MSI 1572877-edge      iwlwifi:exception
 158:          0          0          0          0          0          0          0          0    1127659          0          0          0  IR-PCI-MSI 2097152-edge      nvidia
 159:          0          0          0          0          0          0          0          0          0   10169287          0          0  IR-PCI-MSI 524288-edge      vfio-msi[0](0000:01:00.0)
 NMI:        748        747        748        278        281        281        294        282        260        215        274        278   Non-maskable interrupts
 LOC:   12345123   12622957   12656376    6418747    6123914    5866436    5598550    4959343    5609312    8576668    6652239    6293767   Local timer interrupts
 SPU:          0          0          0          0          0          0          0          0          0          0          0          0   Spurious interrupts
 PMI:        748        747        748        278        281        281        294        282        260        215        274        278   Performance monitoring interrupts
 IWI:          0          0          1          0          0          1          0          0          0          0          2          0   IRQ work interrupts
 RTR:          0          0          0          0          0          0          0          0          0          0          0          0   APIC ICR read retries
 RES:     860530     971493     877940   21701412   22094389   22123348   21107720   20988306   19531763   18635020   21739356   21865858   Rescheduling interrupts
 CAL:     185079     163635     210099   95829183  112409879  120855506  125742656  140266568  133071094  123183826  120020930  103089560   Function call interrupts
 TLB:     115835     114538     167867   86188058  105011222  114018642  118723031  133011839  126347756  117153107  113933407   97654459   TLB shootdowns
 TRM:          0          0          0          0          0          0          0          0          0          0          0          0   Thermal event interrupts
 THR:          0          0          0          0          0          0          0          0          0          0          0          0   Threshold APIC interrupts
 DFR:          0          0          0          0          0          0          0          0          0          0          0          0   Deferred Error APIC interrupts
 MCE:          0          0          0          0          0          0          0          0          0          0          0          0   Machine check exceptions
 MCP:         22         23         23         23         23         23         23         23         23         23         23         23   Machine check polls
 ERR:          0
 MIS:          0
 PIN:       1479       1393       1424     733337     824591     847848     919085     920026     788878     624740     813537     810741   Posted-interrupt notification event
 NPI:          0          0          0          0          0          0          0          0          0          0          0          0   Nested posted-interrupt event
 PIW:          0          0          0          0          0          0          0          0          0          0          0          0   Posted-interrupt wakeup event

I was running windows 1902 i think and i had the updates paused and of course the temporary pause ran out before i fully disabled win update. I did check /proc/interrupts before it updated. This was because of the random short freezes. i got pretty much the same output. This is normal(reg fps, apex running) output on ksystemguard  click the image for a bigger version
image.png

I have a Intel Core i5 10600kf 16gb ram and a 3060(guest) and 960(host). Im passing though 8 threads to vm and 4 im keeping for the host. i gave my vm 12 gb of ram. My current xml is the following.

<domain type="kvm">
  <name>WindowsVM6</name>
  <uuid>1672427e-e74a-aa1e-891a-e480418aae41</uuid>
  <metadata>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://microsoft.com/win/10"/>
    </libosinfo:libosinfo>
  </metadata>
  <memory unit="KiB">9437184</memory>
  <currentMemory unit="KiB">9437184</currentMemory>
  <vcpu placement="static">8</vcpu>
  <os>
    <type arch="x86_64" machine="pc-q35-6.2">hvm</type>
    <loader readonly="yes" secure="yes" type="pflash">/usr/share/edk2-ovmf/x64/OVMF_CODE.secboot.fd</loader>
    <nvram>/var/lib/libvirt/qemu/nvram/WindowsVM_VARS.fd</nvram>
    <boot dev="hd"/>
    <bootmenu enable="yes"/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv mode="custom">
      <relaxed state="on"/>
      <vapic state="on"/>
      <spinlocks state="on" retries="8191"/>
    </hyperv>
    <vmport state="off"/>
    <smm state="on"/>
  </features>
  <cpu mode="host-passthrough" check="none" migratable="on">
    <topology sockets="1" dies="1" cores="8" threads="1"/>
  </cpu>
  <clock offset="localtime">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    <timer name="hpet" present="no"/>
    <timer name="hypervclock" present="yes"/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled="no"/>
    <suspend-to-disk enabled="no"/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type="file" device="disk">
      <driver name="qemu" type="raw"/>
      <source file="/var/lib/libvirt/images/vol.img"/>
      <target dev="vda" bus="virtio"/>
      <address type="pci" domain="0x0000" bus="0x08" slot="0x00" function="0x0"/>
    </disk>
    <disk type="file" device="disk">
      <driver name="qemu" type="raw"/>
      <source file="/home/rick/Drives/VMDisk/dataDrive.img"/>
      <backingStore/>
      <target dev="sdc" bus="sata"/>
      <serial>msdoifn398hs9dihnf983</serial>
      <address type="drive" controller="0" bus="0" target="0" unit="2"/>
    </disk>
    <controller type="usb" index="0" model="qemu-xhci" ports="15">
      <address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
    </controller>
    <controller type="sata" index="0">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x1f" function="0x2"/>
    </controller>
    <controller type="pci" index="0" model="pcie-root"/>
    <controller type="pci" index="1" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="1" port="0x10"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/>
    </controller>
    <controller type="pci" index="2" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="2" port="0x11"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x1"/>
    </controller>
    <controller type="pci" index="3" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="3" port="0x12"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x2"/>
    </controller>
    <controller type="pci" index="4" model="pcie-to-pci-bridge">
      <model name="pcie-pci-bridge"/>
      <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
    </controller>
    <controller type="pci" index="5" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="5" port="0x13"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x3"/>
    </controller>
    <controller type="pci" index="6" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="6" port="0x14"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x4"/>
    </controller>
    <controller type="pci" index="7" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="7" port="0x15"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x5"/>
    </controller>
    <controller type="pci" index="8" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="8" port="0x16"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x6"/>
    </controller>
    <controller type="pci" index="9" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="9" port="0x17"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x7"/>
    </controller>
    <controller type="scsi" index="0" model="lsilogic">
      <address type="pci" domain="0x0000" bus="0x04" slot="0x01" function="0x0"/>
    </controller>
    <controller type="virtio-serial" index="0">
      <address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/>
    </controller>
    <interface type="network">
      <mac address="52:54:12:e9:1a:93"/>
      <source network="default"/>
      <model type="e1000e"/>
      <link state="up"/>
      <address type="pci" domain="0x0000" bus="0x02" slot="0x00" function="0x0"/>
    </interface>
    <channel type="spicevmc">
      <target type="virtio" name="com.redhat.spice.0"/>
      <address type="virtio-serial" controller="0" bus="0" port="1"/>
    </channel>
    <input type="mouse" bus="ps2"/>
    <input type="keyboard" bus="ps2"/>
    <input type="evdev">
      <source dev="/dev/input/by-id/usb-Razer_Razer_Cynosa_Chroma-event-kbd" grab="all" repeat="on"/>
    </input>
    <graphics type="spice" autoport="yes">
      <listen type="address"/>
      <image compression="off"/>
    </graphics>
    <sound model="ich9">
      <codec type="micro"/>
      <audio id="1"/>
      <address type="pci" domain="0x0000" bus="0x04" slot="0x02" function="0x0"/>
    </sound>
    <audio id="1" type="pulseaudio" serverName="/run/user/1000/pulse/native"/>
    <video>
      <model type="none"/>
    </video>
    <hostdev mode="subsystem" type="pci" managed="yes">
      <source>
        <address domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
      </source>
      <address type="pci" domain="0x0000" bus="0x06" slot="0x00" function="0x0"/>
    </hostdev>
    <hostdev mode="subsystem" type="pci" managed="yes">
      <source>
        <address domain="0x0000" bus="0x01" slot="0x00" function="0x1"/>
      </source>
      <address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
    </hostdev>
    <hostdev mode="subsystem" type="usb" managed="yes">
      <source>
        <vendor id="0x046d"/>
        <product id="0xc08b"/>
      </source>
      <address type="usb" bus="0" port="1"/>
    </hostdev>
    <redirdev bus="usb" type="spicevmc">
      <address type="usb" bus="0" port="2"/>
    </redirdev>
    <redirdev bus="usb" type="spicevmc">
      <address type="usb" bus="0" port="3"/>
    </redirdev>
    <memballoon model="none"/>
  </devices>
</domain>

Ive been playing for an hour to try and get a screen shot of the high interrupts but of course now that i want it to happen its not. usually happens once or twice a game. Finally got the screenshot.
image.png

Last edited by JoshKrahn (2022-06-16 04:58:28)

Offline

Board footer

Powered by FluxBB