My CPU is not being utilized or there are serious bottlenecks (QEMU+KVM+Virt-Manager)

When I run CPU stress test in the guest or run a very CPU intensive game, the Virt-Manager CPU graph only move slightly and shows CPU usage at 30’ish %.

In the guest CPU-z tells me that the 8600K CPU is running 3.6GHz, but the host is running 4.1GHz.

How can I optimize the CPU usage so that I can run my games smoothly, right now they are extremely laggy.

The 4.1GHz in the screenshot was during the CPU stress test, it’s dynamically changing of course. Do I need to set it fixed for the guest to “register” the full 4.1GHz? Should the guest not be dynamic as well?

1 Like

either turn off scaling in the bios or change your governor to performance.

What do you mean by scaling please?

cpu frequency scaling

I should make it fixed? What do you mean by gorvenor please?

that should work, yes.

https://wiki.archlinux.org/index.php/CPU_frequency_scaling

https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF#CPU_frequency_governor

Does not work, the CPU frequency is now fixed at 4.2GHz, but the guest VM still displays 3.6GHz in CPU-Z and the game is still extremely laggy.

I think it’s not just CPU clock, there must be something else bottlenecking it.

In some intensive server workloads, setting the CPU type as “Same as host” has performance benefits. Qemu sometimes picks a CPU type that doesn’t make use of the CPU capabilities.

Fully allocated .raw images often give better I/O performance than the default sparse .img.

Apparently Ubuntu or my MSI motherboard completely disregards the setting (I fix the CPU clock at 4.3GHz now).

lscpu gives a different clock everytime I call it indicating that it’s still not fixed…cpu3

1 Like

post your kvm config;
Likely bad settings. (both on your cpu and storage.)

Its unrelated to your frequency.

omg nano is driving me crazy…

use vi. - its better.

// if its too tiring, you can post screenshots of gui config either.


the XML would let us know a lot faster

ok after each change run cpu-z and run benchmark.

Recommend

manually setting model configuration (not using copy-host cpu config)
Since your cpu is new, you can try using older arch.

set topology manually
Start from 4 sockets as you have it there, then test 1 socket 4 cores, and so on see how the performance changes. (usually 4 sockets will give best performance, but in your case its a single cpu so it may perform better if numa is not set to 4.)

Change your I/o scheduler to deadline; you can configure it by editing grub.conf and adding ‘elevator=deadline’ kernel parameter.

i recommend setting cache to writeback
set io mode to threads (but test native)

set your memory to be locked, and nosharepages.

– more tuning - won’t bring much performance.
You can, and should play around with transparent huge pages. (first disable it, see performance difference, and if you see decrease in performance enable and set increments of 2MB to 25000 (to make it persistent you’d need to edit sysctl)
Preallocating 1-2GB may be a good choice on boot.

you can use ksmtuned with param retune.

]check your numa, (even though this is shared arch, its still better to employ its numa and made memory sticky to its numa. (vcpu pinning)

Awesome! It worked…

Changed CPU arch to Haswell, set it at 2 socket / 2 cores / 1 thread and game is running fantastic! Even better than my old rig.

Also added the line to the grub file, so not sure if it was that or just changing the CPU.

CPU-Z on the guest still sees the CPU as the 8600K @ 3.6GHz, but it’s very likely just the basic specs and not realtime.

I moved from a 4670K 3.4Ghz OC @ 4.1Ghz, Z87 chipset w. 16 gigs 2400Mhz RAM to a 8600K, 3.6Ghz OC @ 4.3Ghz (well stock OC), w. 16 gigs 3000MHz RAM, with the same GFX card a GTX760 and the game is running so much better now.

Well the M2. Samsung EVO 960 sure helps too with load times.

But the only reason I upgraded was to get on Linux and VM.

So thanks to everyone here on the forum who helped a complete newb get his new rig running smoothly - much appreciated.

I will keep fine tuning and I guess its Linux henceforth :heart_eyes:

1 Like

sounds great, have fun.