You are not logged in.

#1 2017-03-27 09:31:46

makz27
Member
Registered: 2017-03-06
Posts: 4

QEMU GPU Passthrough - Optimisation

Hello,

This weekend, i replaced my dual boot for a virtual machine with gpu passthrough for gaming on Windows 10, actually i use a GTX670 on the VM and it work pretty great.

But i have some problems.

First, if i use virt-manager, the virtual machine boot but no image on my screen (if gpu passthrough).
So actually i launch my VM by cmd line.

QEMU_PA_SAMPLES=128 QEMU_AUDIO_DRV=pa
qemu-system-x86_64 -enable-kvm -m 8192 -cpu host,kvm=off,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time,hv_vendor_id=whatever\
 -smp cores=4,threads=2\
 -device vfio-pci,host=02:00.0,x-vga=on\
 -device vfio-pci,host=02:00.1\
 -vga none\
 -soundhw hda\
 -drive file=/dev/sdb,id=diska,format=raw\
 -drive file=/dev/sdd,id=diskb,format=raw\
 -cdrom /dev/sr0\
 -usb -usbdevice host:1b1c:1b13\
 -usbdevice host:1b1c:1b12\
 -usbdevice host:1b1c:1c08\
 -usbdevice host:046d:0a1f\
 -usbdevice host:28de:1142

My second problem is the cracking sound.

As you see i use -soundhw hda to enable the sound, in game or playing music / watching streaming ect ... i have random cracking sound.

Adding QEMU_PA_SAMPLES=128 QEMU_AUDIO_DRV=pa don't help.

And another question, what are the possibilities to improve the performances of the virtual machine ?
Kernel 1000hz ? cpu piining ? NUMA ?

I use virtual machines on a daily basis but i never had to do fine tuning on a gaming virtual machine so i don't have a good level on this kind of settings.

Btw, the actual virtual machine don't use UEFI bios, is worth to switch on OVMF bios ?

The host machine is a i7-6900K / 64Gb DDR4.
This actual setup is more a proof of concept, if this work great, i'll switch my graphic cards and use the GTX1080 for the virtual machine.

Thank you.

Offline

#2 2017-03-27 13:31:13

seiichiro0185
Member
From: Leipzig/Germany
Registered: 2009-04-09
Posts: 226
Website

Re: QEMU GPU Passthrough - Optimisation

I had a similar issue with broken sound output with a USB-soundcard passed through to a Windows VM in a similar setup (Proxmox VE Host with a KVM/QEMU-based Windows 7 VM with passed through Nvidia-GPU). I solved it by setting the samplerate to 48000 Hz in Windows for the affected soundcard. It may be worth to try different settings for the samplerate in Windows to find the working one, usually it was either 44100 or 48000 for me.

I didn't do any particular tuning for my VM except for storage (but I use ZFS Volumes not raw disks as you do, I did set the cache to writeback for maximum performance), and I reach near native speed for the relevant benchmarks (CPU/RAM/GPU). I did try CPU pinning but since it didn't have any measurable effect I don't use it in my "production" setup.

Unfortunately I have no idea about your virt-manager problem, since I don't use it.

Last edited by seiichiro0185 (2017-03-27 13:32:48)


My System: Dell XPS 13 | i7-7560U | 16GB RAM | 512GB SSD | FHD Screen | Arch Linux
My Workstation/Server: Supermicro X11SSZ-F | Xeon E3-1245 v6 | 64GB RAM | 1TB SSD Raid 1 + 6TB HDD ZFS Raid Z1 | Proxmox VE
My Stuff at Github: github
My Homepage: Seiichiros HP

Offline

#3 2017-03-27 20:12:10

makz27
Member
Registered: 2017-03-06
Posts: 4

Re: QEMU GPU Passthrough - Optimisation

Okay i reinstalled my VM in virt-manager in uefi.

My graphic card is listed in windows, but in error state "code 43", i had that earlier on my basic install but after adding some options to my -cpu as described in the wiki.

-cpu host,kvm=off,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time,hv_vendor_id=whatever

it worked great.

P.S When i say i had that issue earlier, i had an image on my screen, just it was like a windows without driver, no acceleration, no high resolutions, here i'm just stuck with a screen in power saving mode and i need to use the spice console to see something.

Here's the qemu command line started by virt-manager

/usr/sbin/qemu-system-x86_64 -name guest=Windows_10,debug-threads=on -S\
 -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-24-Windows_10/master-key.aes\
 -machine pc-i440fx-2.8,accel=kvm,usb=off,vmport=off,dump-guest-core=off\
 -cpu host,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff,hv_vendor_id=whatever,kvm=off\
 -drive file=/usr/share/ovmf/x64/ovmf_x64.bin,if=pflash,format=raw,unit=0,readonly=on\
 -drive file=/var/lib/libvirt/qemu/nvram/Windows_10_VARS.fd,if=pflash,format=raw,unit=1\
 -m 16386 -realtime mlock=off -smp 8,sockets=8,cores=1,threads=1 -uuid fc05f50e-8a97-4c51-a8c5-627824d8075c\
 -display none -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-24-Windows_10/monitor.sock,server,nowait\
 -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime -no-shutdown -global PIIX4_PM.disable_s3=1\
 -global PIIX4_PM.disable_s4=1 -boot strict=on\
 -device nec-usb-xhci,id=usb,bus=pci.0,addr=0x5\
 -drive file=/home/makz/virtio-win-0.1.134.iso,format=raw,if=none,id=drive-ide0-0-0,readonly=on\
 -device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0\
 -drive file=/dev/sdb,format=raw,if=none,id=drive-virtio-disk0,cache=writeback\
 -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x8,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1\
 -drive file=/dev/sdd,format=raw,if=none,id=drive-virtio-disk1,cache=writeback\
 -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x9,drive=drive-virtio-disk1,id=virtio-disk1\
 -netdev tap,fd=25,id=hostnet0,vhost=on,vhostfd=27\
 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:88:db:2f,bus=pci.0,addr=0x3\
 -device intel-hda,id=sound0,bus=pci.0,addr=0x4\
 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0\
 -device vfio-pci,host=02:00.0,id=hostdev0,bus=pci.0,addr=0xa,rombar=0\
 -device vfio-pci,host=02:00.1,id=hostdev1,bus=pci.0,addr=0xb,rombar=0\
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7\
 -msg timestamp=on

Is someone have an idea ?

Edit : i use ovmf-git

Last edited by makz27 (2017-03-27 20:39:19)

Offline

Board footer

Powered by FluxBB