kvm/libvirt with AMD Ryzen and performance issues

If none of the more specific forums is the right place to ask

kvm/libvirt with AMD Ryzen and performance issues

Postby BigPicture » 2020-09-28 13:25

Hi all,

I have big trouble with kvm/libvirt Windows 10 guest on my new machine (AMD Ryzen 7 3700X, GeForce GT 710, Samsung EVO 970 Plus).
The problem may be related to the overall VM performance and/or to the graphics, but I'm not sure. The graphics is set to spice/qxl and I already installed qxldod drivers and some others from the ISO found on fedora website. The system is working so far, but there are lags, like programs taking longer to start, or (cached) websites needing 5 times as long as the host to render in Firefox. Internet speed is always fine from within the guest. In the TaskManager I can see high CPU usage for simple tasks like moving explorer windows around. That alone is annoying enough, but the worse thing is that my online banking stopped working recently. I use an optic TAN procedure with a flickering code, like demonstrated on this website (sorry for the language):
https://6xq.net/flickercodes/
Below the headline "Javascript-Flickercode" you can click at the "Start" button to simulate an optical TAN procedure. On my host this works really fast, but on my guest this animation is very slow and looks like 4 from 5 frames are being dropped. Of course I read that I can't expect bare metal performance, but since the procedure even works fine on my host via AnyDesk remotely, I doubt that this behavior is normal for virtualized environments! But I have no Idea how to fix this.

So what can I do to find the culprit and get things working? For example, I was surprised that my CPU configuration in virt-manager shows an EPYC-IBPB CPU since I have a Ryzen.
I added some information about my system. If you need more, please let me know...

Thank you very much and best regards...
BigPicture

Code: Select all
Debian 10.6
Linux server 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1+deb10u1 (2020-04-27) x86_64 GNU/Linux


Code: Select all
root@server:~# lsmod | grep kvm
kvm_amd               106496  16
kvm                   749568  1 kvm_amd
irqbypass              16384  7 kvm
ccp                    98304  1 kvm_amd


Code: Select all
root@server:~# kvm --version
QEMU emulator version 3.1.0 (Debian 1:3.1+dfsg-8+deb10u8)
Copyright (c) 2003-2018 Fabrice Bellard and the QEMU Project developers


Code: Select all
<domain type='kvm' id='4'>
  <name>Windows</name>
  <uuid>15c245a1-6356-3e12-876c-87a30c55f136</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'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <vcpu placement='static' current='8'>16</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-3.1'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
    </hyperv>
    <vmport state='off'/>
  </features>
  <cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>EPYC-IBPB</model>
    <vendor>AMD</vendor>
    <feature policy='require' name='x2apic'/>
    <feature policy='require' name='tsc-deadline'/>
    <feature policy='require' name='hypervisor'/>
    <feature policy='require' name='tsc_adjust'/>
    <feature policy='require' name='clwb'/>
    <feature policy='require' name='umip'/>
    <feature policy='require' name='ssbd'/>
    <feature policy='require' name='cmp_legacy'/>
    <feature policy='require' name='perfctr_core'/>
    <feature policy='require' name='amd-ssbd'/>
    <feature policy='disable' name='monitor'/>
    <feature policy='disable' name='svm'/>
    <feature policy='require' name='topoext'/>
  </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='qcow2'/>
      <source file='/var/lib/libvirt/images/Windows.qcow2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
    <disk type='block' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/sr0'/>
      <backingStore/>
      <target dev='sdb' bus='sata'/>
      <readonly/>
      <alias name='sata0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='usb' index='0' model='qemu-xhci' ports='15'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x10'/>
      <alias name='pci.1'/>
      <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'/>
      <alias name='pci.2'/>
      <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'/>
      <alias name='pci.3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <alias name='pci.4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <interface type='bridge'>
      <mac address='78:45:c4:4b:1e:c2'/>
      <source bridge='bridge0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/0'/>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/0'>
      <source path='/dev/pts/0'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'>
      <alias name='input1'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input2'/>
    </input>
    <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
      <image compression='off'/>
    </graphics>
    <sound model='ich9'>
      <alias name='sound0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1b' function='0x0'/>
    </sound>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <redirdev bus='usb' type='spicevmc'>
      <alias name='redir0'/>
      <address type='usb' bus='0' port='2'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <alias name='redir1'/>
      <address type='usb' bus='0' port='3'/>
    </redirdev>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='apparmor' relabel='yes'>
    <label>libvirt-15c245a1-6356-3e12-876c-87a30c55f136</label>
    <imagelabel>libvirt-15c245a1-6356-3e12-876c-87a30c55f136</imagelabel>
  </seclabel>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+64055:+64055</label>
    <imagelabel>+64055:+64055</imagelabel>
  </seclabel>
</domain>
BigPicture
 
Posts: 3
Joined: 2020-09-28 12:02

Re: kvm/libvirt with AMD Ryzen and performance issues

Postby CwF » 2020-09-28 14:03

BigPicture wrote:<vcpu placement='static' current='8'>16</vcpu>

Why, because you can? The thread scheduler(s) are not friends. 2 REAL cores for the VM would likely run smoother. The rendering within the guest browser is done by the host cpu.
CwF
 
Posts: 808
Joined: 2018-06-20 15:16

Re: kvm/libvirt with AMD Ryzen and performance issues

Postby BigPicture » 2020-09-28 14:54

CwF wrote:
BigPicture wrote:<vcpu placement='static' current='8'>16</vcpu>

Why, because you can?


No, out of desperation I tried different settings from 2 VCPUs up to 8.
BigPicture
 
Posts: 3
Joined: 2020-09-28 12:02

Re: kvm/libvirt with AMD Ryzen and performance issues

Postby Head_on_a_Stick » 2020-09-28 15:26

Is hardware virtualisation enabled in your firmware ("BIOS") settings?
Code: Select all
grep --color=auto 'svm\|0xc0f' /proc/cpuinfo

I don't use libvirt so I can't really comment on the configuration file but perhaps try
Code: Select all
<cpu mode='host'></cpu>

But I think that's the default setting.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12764
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: kvm/libvirt with AMD Ryzen and performance issues

Postby BigPicture » 2020-09-28 19:06

Head_on_a_Stick wrote:Is hardware virtualisation enabled in your firmware ("BIOS") settings?

I think so - the grep command highlighted for each thread "svm" and "svm_lock".

Head_on_a_Stick wrote:I don't use libvirt so I can't really comment on the configuration file but perhaps try
Code: Select all
<cpu mode='host'></cpu>

But I think that's the default setting.


My default setting is...
Code: Select all
  <cpu mode='host-model' check='partial'>
    <model fallback='allow'/>
  </cpu>

Is "host" something special?

The whole kvm/qemu/libvirt staff seems to be rather old on Debian and I guess there is no easy and risk-free way to test a newer version?
I read that the qxldod drivers are so called display only drivers and have no significant hardware acceleration, so maybe a newer version will not help anyway...but maybe it's not only the graphics: staring at the dotted circle login animation is rather disappointing with my hardware configuration.

Thanks you and best regards...
BigPicture
BigPicture
 
Posts: 3
Joined: 2020-09-28 12:02

Re: kvm/libvirt with AMD Ryzen and performance issues

Postby stevepusser » 2020-09-29 05:57

Your AMD graphics are working well on Debian, correct? (Install inxi and show the output of "inxi -Gxx" in a terminal)
MX Linux packager and developer
User avatar
stevepusser
 
Posts: 12131
Joined: 2009-10-06 05:53

Re: kvm/libvirt with AMD Ryzen and performance issues

Postby Head_on_a_Stick » 2020-09-29 19:13

BigPicture wrote:The whole kvm/qemu/libvirt staff seems to be rather old on Debian

I've had Win10 VMs running very well indeed under buster (but don't tell anyone) so I don't think that's the problem.

Perhaps try KVM without libvirt to narrow down the source of the problem: viewtopic.php?f=16&t=144775

stevepusser wrote:Your AMD graphics are working well on Debian, correct?

The OP has an NVIDIA card. The heathen :mrgreen:
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12764
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to General Questions

Who is online

Users browsing this forum: No registered users and 16 guests

fashionable