Low CPU performance in KVM with GTA 5 and 3DMark [Solved]

Hello, guys I have come for some assistance it looks like I'm having poor CPU performance in my KVM setup causing it to hold back my GPU performance.

Here some of the bench i did to try and pin point the what cause low performance in my VM here 3DMark score.

Here my cpu usage of linux after the benchmark finnish the last bit is a combine test then it idle and showed result.

Here GTA 5 in windows.

Here my host cpu usage when GTA 5 was running the usage going down cause i close the game.

Any suggestions on to how to solve this problem would be appreciated.

How much Host ram do you have?

Are you using hugepages?

do you have any of the kvm hide or similar settings in your xml?

Have you tried any other games?

What version of Linux (kernel) and what Distro?

maybe because the cpu is only a 4 core without HT?

1 Like

That's very possible. Let's look into it.

@pl9090 have you tried allocating only 3 of the 4 cores to the VM? Try that and report back. It's possible that the CPU is having trouble allocating time for the overhead of KVM and other processes running on the host, and that's causing a hiccup in the system.

Alright i will give that a try tonight and come back with the result i have try other games like Killing floor 2 and Doom 2016 (Vulcan) both of them run extremely well. My Distro is Debian Stretch 8 not sure on the specific kernel version will check but i think it 4.8 the host has a total of 16GB with 8 for the VM. I did tried to use KVM hide in the .xml but did not work as seen in my screenshot and dont know what hugepages is so i dont think i use it.

Sounds like your issue then is that GTA V is trying to take all of your CPU time, but the windows scheduler isn't aware of the underlying host system, so it tries to overuse the processor. This is only really noticeable in time-sensitive operations like Games.

KVM hide is not needed on AMD GPU systems. Don't use kvm hide. It reduces the system performance a bit.

As far as hugepages go, memory is separated into pages. normally, pages are 4k in size. hugepages are 2048k in size, so for things like VM's you're better off backing your VM with hugepages because, without going into details of how memory works, it will improve your VM's performance because there's less overhead when it's doing ram operations.

Ok so i did so many change to that VM .xml files that I'm going to create a new VM and test that there i also take the opportunity to install windows 10.

Alright i redid the test and so far still not close to 95% performent of a naitive install i kinda got a work around and i manage to lower the cpu overhead by stressing the gpu. So i can kinda play it at 40fps i have remove the kvm hide i had for my vm im still using windows 8.1 for the vm. Any other suggestions on improving cpu performance on my VM i try this http://docs.openstack.org/developer/devstack/guides/devstack-with-nested-kvm.html not sure if it did anything.

Guessing your guest and host OSes are fighting for CPU time on your cores, since there is only 4 off them it results in a large degredation on your guest OS.

1 Like

try pinning the cpu threads if you havent already, only use 2-3 threads for the vm, turn off irq balance on the host (all interrupts will be on cpu0), remove as many of the virtual devices on the vm as you can (like swap those sata devices to virtio and get rid of the sata controller)

honestly the biggest improvement would be a cpu with more cores, hyperthreading is mehh in vms. secondly the host needs some of the resources to handle the qemu parent process/interrupts/kernel, so 2-3 threads is probably all you're gonna be able to do. you can try looking into isolcpu (this keeps the linux scheduler from using some threads of a cpu).

I actually had an issue with my mouse polling being at 1000hz, evidently qemu doesnt like that. caused terrible microstutters in games.

1 Like

I wish I had better news for you, but as with the others who spoke, above, the only way I can think is to reduce the number of cores you have passed through, or get a cpu with more cores/threads.

Alright i will mark it as solved since i installed a sound card im no longer getting studders but still low performance but that due to CPU only being a 4 Core.