Help with KVM VM tuning!

There is one other option that I was not able to get working for me and that was using the Q35 chipset. I was never able to get past the GPU driver installation when I used Q35. Windows would always crash at this point. Maybe this might have netted better performance? I believe I read somewhere that using Q35 chipset with AMD hardware was an issue....not really sure.

I think about the only other options left for me to test out are the different storage type setups. I plan to test raw and LVM on my final setup and will post my results.

I didn't quite get the 95% performance that others got with their setup but I was still really impressed with the results given that it is a VM. I

Last I heard, there are no performance benefits to Q35 over 440FX, and 440 being a simpler implementation, was generally recommended. This was a while ago though.

That's good to know. I never really researched much into the difference though.

I tested out running the VM on a LVM partition which did not really yield much of a difference performance wise but then again my Ubuntu and Win10 VM installation does share the same physical HDD.

Gaming wise some games run almost like the bare metal (Doom 2016), some close to bare metal (Witcher 3) and a few just ran like absolute crap (Dragon Dogma). All the while usage on CPU, Memory, Disk and Network were relatively low. I have been using the VM for the last week and I am very pleased with the performance as is.

Kudos for all the advice provided!

1 Like

After a couple more weeks of testing off and on I noticed that older DirectX games perform horribly on my setup. For the people with AMD GPU passthrough, did you experience this?

I ran Heaven benchmark and got:

DirectX9
FPS: 54.5
Score: 1373
Min FPS :18.3
Max FPS: 128.6

DirectX11
FPS: 77.3
Score: 1948
Min FPS: 20.9
Max FPS: 139.5

Which version of Windows?

W10 doesn't like the 8350, I've found.

W10 copy downloaded from Microsoft. Hmmm, well that's unfortunate.

I would have rather used Win7 but I have tried a couple Win7 copies with KVM and had no luck getting them to boot.

1 Like

Stay with Win X, you'll be better off in the long run, I'm saying this as someone who has been running a Win 7 KVM for the last couple years on a Fedora host system, I just recently moved to Win X because of performance/compatibility issues with newer games and programs, I didn't want to do it....but I think it was the right move for me to make.

I agree with going with Win10 for the long run. I am not a fan of all that telemetry crap but it will only be used for games anyway.

I do find the performance difference between DX9 and DX11 to be very strange. I may fire up a Win8.1 VM to test if there is a difference compared to win10.

1 Like

actually i think that same thing is happening with my results, am having issues with using like old game (wow 3.3.5a) getting lower performance than in crysis3 :O maybe some random win10bug? (except maybe cpu bottleneck too :/)

Well I actually tested it with win8.1 pro afterwards and encountered the same problem. I know for sure that bare metal win8.1 pro runs perfect. I am guessing this maybe something AMD related as most of the "95% bare metal" results shown on the net are Intel/ Nvidia setups although Wendell actually had it running with an Intel CPU and a R9 390X GPU on his setup.

Honestly, I am not sure where the problem lies and I don't think it's CPU bottleneck as CPU usage on the VM and Host are relatively low when a game is running. Maybe something architecture related? Right now, I just use it as is.

could you run following tests:

cpu-z compare with another 4 core or so.
test storage performance inside your kvm.
test memory performance.

also do following:
Lock your Hz on cores; don't let them run on 1400MHz; it'll likely to hurt your performance.

use one of the following caching modes to improve hdd performance
https://www.ibm.com/support/knowledgecenter/linuxonibm/liaat/liaatbpkvmguestcache.htm

use deadline i/o scheduler.
recommend to use noatime on your vmhost.
make sure your vmhost has all features enabled on cpu that its passing through.
figure out where is your performance bottleneck.
recommend to use maximum allocation, but only using 1 socket, 4-6 cores, 1 threads. (sometimes you can gain more performance by setting them (4-6 sockets, 1 cores, 1 threads, or 1 socket, 1 core, 4 threads. or mix to obtain 4-6 use)

1 Like

I think i partially fixed issue, by setting 1sock,2core,2threads as that's how host system sees my processor (a8-5600k is an actually 4core nohyperthread) and also i've disabled turbo boost+set max multiplayer to x40 so it runs pretty smooth now. am getting bare metal performance (sometimes i think it's even bettter than when using native win10.
only thing that makes small problem is audio when watching youtube it gives a bit of stutter, but in games it works perfectly.

I had tested performance with 4-6-8 cores. I currently use all 8 cores on the guest as it gave the best performance.

Storage and memory usage on the guest is low. CPU usage can be between 40-80% usage in game for both host and guest.

I had tried different caching modes when using qcow2 then tried using a LVM partition which didn't make a difference.
I configured noatime on my partitions and deadline i/o schedular on grub after reading your post. Unfortunately it didn't make a difference in my setup. Disk I/O within the guest was very low to begin with.
*Note however that I am sharing HDDs between the guest and host, a SSD and regular HDD and I was never able to attempt it with a separate drive for the guest.

I honestly did not check and compare the enabled CPU features to the guest. Still have to check this.

I had configured the guest CPU to match the output of lscpu and virsh capabilities. One has the AMD 8350 as 4 cores, 2 threads and the other as 8 cores,1 thread. I tried it both ways but no difference.

Another thing to note is that when I tried using the onboard "auto" overclock on the CPU I gained a very slight performance increase, like 1-2fps difference. Also increasing my ram allocation from 8GB to 10GB and setting hugepages to match, I gained a very minor performance increase.

As for where the bottleneck lies, I am really not sure. The fact is that newer games, higher direct X versions run very good, close enough to bare metal. Doom, the only vulkan game I own runs like bare metal. The problem is only with older DirectX games, they run horribly.

Tried ekevaling the VM prioity nothing insane but knock it up a peg. see if that smoths the querks. Sound like video is real time and humans pick up tiny problems easy

so we have eliminated possibility of any hdd performance as bottleneck; I think its mainly your cpu and gpu now.

Check following cpu pinning
https://www.se7ensins.com/forums/threads/how-to-setup-a-gaming-virtual-machine-with-gpu-passthrough-qemu-kvm-libvirt-and-vfio.1371980/

here you can find more tweaks (remember they are optimizations for mostly linux only)
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html-single/Virtualization_Tuning_and_Optimization_Guide/index.html

I initially had CPU pinning set and also tried locking 4 cores to the VM but again it didn't really do anything for performance. The biggest performance increase came from enabling the Hyper V extensions and configuring hugepages.

I have been through most of those tweaks already however what I have not attempted and wasn't really aware of was ​ "Improve CPU performance via cpupower governor (frequency)". I will definitely take a look into that.

My scale frequency gover is always performance.
Then My host won’t get that issue??

@SirTeddy Yes but what’s about your Temps and power consumption/noise and such things?

Temps may be 55C (i7 6700k)
My host has 3 fans and CPU has 1.

the CPU’s noise will not be more than my GTX1080(4 fans,pubging)

power consumption will be more ,but wont be too much.