You are not logged in.

#1 2017-05-06 11:21:57

Boring_nick
Member
Registered: 2017-05-06
Posts: 20

KVM/QEMU Detects cpu wrongly

my cpu is a10-7850k. It supports iommu and amd-v.
I have installed windows 10 as guest using virt-manager and configured integrated grahics passthrough and it worked.
But cpu performance is bad. If i enable "copy host cpu info" it shows amd opteron (cpu with very different architecture) and curently i run using host-passthrough cpu model.
But for some reason it also shows up only one core (i have enable four) and 16mb of l3 cache (i don't have l3 cache at all). And even on desktop cpu load stays at ~30 % and very often goes up to 100%.
Any ideas why this is happening?
I don't know much about virtualization, but i know that kvm and hyper-v(on windows) is much more integrated into system than virtualbox and vmware and that offers more control and better performance.

Offline

#2 2017-05-08 13:48:45

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,615

Re: KVM/QEMU Detects cpu wrongly

please post the xml-file created by the virt-manager for your vm .
(if you don't know how to get it, check "man virsh" )


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2017-05-08 14:25:37

Boring_nick
Member
Registered: 2017-05-06
Posts: 20

Re: KVM/QEMU Detects cpu wrongly

Lone_Wolf wrote:

please post the xml-file created by the virt-manager for your vm .
(if you don't know how to get it, check "man virsh" )

here you go:

<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
  virsh edit win10
or other application using the libvirt API.
-->

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>win10</name>
  <uuid>2a07cf50-bae6-4b20-84b0-61ecb4888bcd</uuid>
  <memory unit='KiB'>5120000</memory>
  <currentMemory unit='KiB'>5120000</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.9'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/ovmf/x64/ovmf_code_x64.bin</loader>
    <nvram>/var/lib/libvirt/qemu/nvram/win10_VARS.fd</nvram>
    <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='host-passthrough' check='full'>
    <topology sockets='1' cores='4' 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/sbin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='vdi'/>
      <source file='/home/ilya/VirtualBox VMs/Windows 10/Windows 10.vdi'/>
      <target dev='sda' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
    </controller>
    <controller type='scsi' index='0' model='virtio-scsi'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>
    <interface type='direct'>
      <mac address='52:54:00:87:93:1b'/>
      <source dev='enp2s0' mode='bridge'/>
      <model type='rtl8139'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes'>
      <listen type='address'/>
    </graphics>
    <sound model='ac97'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='cirrus' vram='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x062a'/>
        <product id='0x3633'/>
      </source>
      <address type='usb' bus='0' port='4'/>
    </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='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:commandline>
    <qemu:env name='QEMU_AUDIO_DRV' value='pa'/>
    <qemu:env name='QEMU_PA_SERVER' value='/run/user/1000/pulse/native'/>
  </qemu:commandline>
</domain>

Last edited by Boring_nick (2017-05-08 15:40:18)

Offline

#4 2017-05-08 15:37:39

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: KVM/QEMU Detects cpu wrongly

@Boring_nick

Please edit your post and use code tags when posting code. See: https://wiki.archlinux.org/index.php/Co … s_and_code

Edit: correct url.

Last edited by R00KIE (2017-05-08 15:38:20)


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#5 2017-05-08 15:40:40

Boring_nick
Member
Registered: 2017-05-06
Posts: 20

Re: KVM/QEMU Detects cpu wrongly

R00KIE wrote:

@Boring_nick

Please edit your post and use code tags when posting code. See: https://wiki.archlinux.org/index.php/Co … s_and_code

Edit: correct url.

edited

Offline

#6 2017-05-09 06:14:18

Haroon
Member
From: Germany
Registered: 2017-02-14
Posts: 24

Re: KVM/QEMU Detects cpu wrongly

Try this.

..
<cpu mode='host-passthrough' match='exact'>
..

And you could try to pin the CPU to your VM.

More Information on https://wiki.archlinux.org/index.php/PC … nce_tuning

Offline

#7 2017-05-09 08:39:03

Boring_nick
Member
Registered: 2017-05-06
Posts: 20

Re: KVM/QEMU Detects cpu wrongly

Haroon wrote:

Try this.

..
<cpu mode='host-passthrough' match='exact'>
..

And you could try to pin the CPU to your VM.

More Information on https://wiki.archlinux.org/index.php/PC … nce_tuning

I already fixed issue with core count, but performance is still very bad. I also set l3 cache mode to disable, but vm still shows 16mb of l3
And I already set match=exact

Last edited by Boring_nick (2017-05-09 08:39:49)

Offline

#8 2017-05-09 08:56:01

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: KVM/QEMU Detects cpu wrongly

I can only hint at a few things, you should check that kvm is actually being used otherwise things will get slow, also double check that the amount of ram you have allocated for the virtual machine makes sense, I see around 5G allocated so you should have more physical ram than that.

The last one I can remember now is that if I recall correctly windows 10 has always been a bit slower than previous versions when running on a virtual machine, but I have tried this only with my previous laptop which has an older cpu so I don't know if this still holds true with more modern cpus.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#9 2017-05-09 09:11:37

Boring_nick
Member
Registered: 2017-05-06
Posts: 20

Re: KVM/QEMU Detects cpu wrongly

R00KIE wrote:

I can only hint at a few things, you should check that kvm is actually being used otherwise things will get slow, also double check that the amount of ram you have allocated for the virtual machine makes sense, I see around 5G allocated so you should have more physical ram than that.

The last one I can remember now is that if I recall correctly windows 10 has always been a bit slower than previous versions when running on a virtual machine, but I have tried this only with my previous laptop which has an older cpu so I don't know if this still holds true with more modern cpus.

My host have 7 gigs of ram (actually 8, but one is dedicated to vram). My de is xfce and I dont' have any programs running in Linux so it isn't a problem
My cpu is pretty new and I don't think that switching to previous version of windows will change much.

Last edited by Boring_nick (2017-05-09 09:25:52)

Offline

#10 2017-05-10 14:10:28

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,615

Re: KVM/QEMU Detects cpu wrongly

Your processor appears to use kaveri cores and AMD did have plans (they were cancelled) to release opterons with that core .

what does lscpu on linux show ?

Another possibility is that the problem may be in libvirt, can you try starting qemu directly from cli ?
(you may have to check the vfio blog to figure out the needed options).


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#11 2017-05-10 14:15:46

Boring_nick
Member
Registered: 2017-05-06
Posts: 20

Re: KVM/QEMU Detects cpu wrongly

Lone_Wolf wrote:

Your processor appears to use kaveri cores and AMD did have plans (they were cancelled) to release opterons with that core .

what does lscpu on linux show ?

Another possibility is that the problem may be in libvirt, can you try starting qemu directly from cli ?
(you may have to check the vfio blog to figure out the needed options).

After tweaking a bit it started working with good performance, but in some cases vm is still slowed down probably because of  virtualized 16mb l3 cache, while my host cpu don't have it. I tried settings model to "host-model" and set manually <cache level='3' mode='disable'/> but vm is still detects it and yeah, it looks like the problem. I tried running league of legends in it and cpu is bottleneck (changing graphical settings don't change anything), but it's load never goes higher than 80% on any core.

Offline

Board footer

Powered by FluxBB