[vfio-users] Huge performance decrease in VM

Janusz januszmk6 at gmail.com
Fri Jan 6 12:36:35 UTC 2017


use reply to all.
don't use all cores, use only half of them, try isolcpus, you can try
http://ck-hack.blogspot.com/
when you decrease number of cores change host-passthrough to host-model,
disable hypervisor.
My setup isn't perfect, but I have gpu performance close to native:
https://paste.pound-python.org/show/eGf746XJsdtYrA1GEVIl/ but I have i7
6700k so I had to turn off some of hyperv because native were better.


On 01/06/2017 01:29 PM, Marius Steffen wrote:
> Of course, sorry, I forgot to attach it:
>
> <domain type='kvm'
> xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
>   <name>game_win_v2</name>
>   <uuid>5c7150f7-7f7c-4265-acd5-6bed59a10192</uuid>
>   <memory unit='KiB'>10485760</memory>
>   <currentMemory unit='KiB'>10485760</currentMemory>
>   <vcpu placement='static'>8</vcpu>
>   <cputune>
>     <vcpupin vcpu='0' cpuset='0'/>
>     <vcpupin vcpu='1' cpuset='1'/>
>     <vcpupin vcpu='2' cpuset='2'/>
>     <vcpupin vcpu='3' cpuset='3'/>
>     <vcpupin vcpu='4' cpuset='4'/>
>     <vcpupin vcpu='5' cpuset='5'/>
>     <vcpupin vcpu='6' cpuset='6'/>
>     <vcpupin vcpu='7' cpuset='7'/>
>   </cputune>
>   <os>
>     <type arch='x86_64' machine='pc-i440fx-2.6'>hvm</type>
>     <loader readonly='yes'
> type='pflash'>/usr/local/share/ovmf-git/x64/OVMF_CODE.fd</loader>
> <nvram>/var/lib/libvirt/qemu/nvram/game_win_v2_VARS.fd</nvram>
>   </os>
>   <features>
>     <acpi/>
>     <apic/>
>     <hyperv>
>       <relaxed state='on'/>
>       <vapic state='on'/>
>       <spinlocks state='on' retries='8191'/>
>       <vendor_id state='on' value='Apfelbaum'/>
> </hyperv>
> <kvm>
>       <hidden state='on'/>
> </kvm>
>     <vmport state='off'/>
> </features>
>   <cpu mode='host-passthrough'>
>     <topology sockets='1' cores='4' threads='2'/>
> </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>restart</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='raw' cache='none' io='native'/>
>       <source file='/home/marius/.virt_ssd_speicher/virt_fast.img'/>
>       <target dev='sda' bus='scsi'/>
>       <boot order='2'/>
>       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
>     </disk>
>     <disk type='file' device='disk'>
>       <driver name='qemu' type='raw' cache='none' io='native'/>
>       <source file='/media/virt/VM Speicher/win_game_v2.img'/>
>       <target dev='sdb' bus='scsi'/>
>       <address type='drive' controller='0' bus='0' target='0' unit='1'/>
>     </disk>
>     <controller type='scsi' index='0' model='virtio-scsi'>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x03'
> function='0x0'/>
>     </controller>
>     <controller type='virtio-serial' index='0'>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x06'
> function='0x0'/>
>     </controller>
>     <controller type='pci' index='0' model='pci-root'/>
>     <controller type='usb' index='0' model='ich9-ehci1'>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x04'
> function='0x7'/>
>     </controller>
>     <controller type='usb' index='0' model='ich9-uhci1'>
>       <master startport='0'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x04'
> function='0x0' multifunction='on'/>
>     </controller>
>     <controller type='usb' index='0' model='ich9-uhci2'>
>       <master startport='2'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x04'
> function='0x1'/>
>     </controller>
>     <controller type='usb' index='0' model='ich9-uhci3'>
>       <master startport='4'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x04'
> function='0x2'/>
>     </controller>
>     <interface type='network'>
>       <mac address='52:54:00:97:db:d2'/>
>       <source network='inet'/>
>       <model type='rtl8139'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x02'
> function='0x0'/>
>     </interface>
>     <interface type='network'>
>       <mac address='52:54:00:bb:d0:e5'/>
>       <source network='host_only'/>
>       <model type='rtl8139'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x09'
> function='0x0'/>
>     </interface>
>     <input type='mouse' bus='ps2'/>
>     <input type='keyboard' bus='ps2'/>
>     <sound model='ac97'>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x07'
> function='0x0'/>
>     </sound>
>     <hostdev mode='subsystem' type='pci' managed='yes'>
>       <source>
>         <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
>       </source>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x0a'
> function='0x0'/>
>     </hostdev>
>     <memballoon model='virtio'>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x05'
> function='0x0'/>
>     </memballoon>
>   </devices>
>   <qemu:commandline>
>     <qemu:env name='QEMU_ALSA_DAC_BUFFER_SIZE' value='512'/>
>     <qemu:env name='QEMU_ALSA_DAC_PERIOD_SIZE' value='170'/>
>     <qemu:env name='QEMU_AUDIO_DRV' value='alsa'/>
>     <qemu:env name='QEMU_AUDIO_DAC_FIXED_FREQ' value='44100'/>
>     <qemu:env name='QEMU_AUDIO_ADC_FIXED_FREQ' value='44100'/>
>   </qemu:commandline>
> </domain>
>
>
> Marius
>
>
> Am 06.01.2017 um 13:24 schrieb Janusz:
>> share your vm xml/qemu command, so we can see what you are doing wrong.
>>
>> On 01/06/2017 01:00 PM, Marius Steffen wrote:
>>> Hi,
>>> I'm running my VM on Arch for quite some time now, with varying success
>>> on this hardware:
>>>
>>> - NVIDIA GTX 1070
>>> - 16 GB RAM (10 GB passed through to VM, tested with/without hugepages)
>>> - i7 3770 (4 Cores, 4 Hyperthreads, various combinations tested)
>>> - virtualized OS is Windows 10 Home x64
>>>
>>> Arch is using my iGPU (unvirtualized), usally running KDE Plasma 5, but
>>> I also tried without running any X-Session.
>>>
>>> As I recently noticed when upgrading my GPU from a GTX 680 to my
>>> current
>>> GTX 1070, there's an extremely huge performance impact compared to
>>> running on native Windows.
>>> When playing Just Cause 3, this was especially noteable: I've often got
>>> only 40-50 FPS, compared to 75-120+ FPS in Windows 10, and my GPU being
>>> used just about 20% or so in the VM.
>>>
>>> Is there anything I can do to a) find the cause of this bad performance
>>> b) make my VM perform better?
>>>
>>> Greetings,
>>>
>>> Marius
>>>
>>>
>>> _______________________________________________
>>> vfio-users mailing list
>>> vfio-users at redhat.com
>>> https://www.redhat.com/mailman/listinfo/vfio-users
>>
>




More information about the vfio-users mailing list