Poor CPU performance

Hello,

I am using qemu/kvm to run a windows 11 guest on linux host.
My CPU is AMD 9600X.
I tried to tweak CPU pinning (with archlinux guide) with no improvement.
My system feels slow, and I ran a passmark CPU performance test, single threaded I get 2900 with virtualization and 4500 without. I also tested nvme passthrough speed I get 4000 instead of 7000Mbs
When guest is idle, it consumes > 50% CPU on host.

I also tried “feature policy=‘require’ name=‘topoext’” as advised in the wiki for AMD CPU, and this is worse

Here is my current CPU pinning :

  <vcpu placement="static">6</vcpu>
  <iothreads>1</iothreads>
 <cputune>
    <vcpupin vcpu="0" cpuset="3"/>
    <vcpupin vcpu="1" cpuset="9"/>
    <vcpupin vcpu="2" cpuset="4"/>
    <vcpupin vcpu="3" cpuset="10"/>
    <vcpupin vcpu="4" cpuset="5"/>
    <vcpupin vcpu="5" cpuset="11"/>
    <emulatorpin cpuset="0-2,6-8"/>
    <iothreadpin iothread="1" cpuset="0-2,6-8"/>
  </cputune>
 <cpu mode="host-passthrough" check="none" migratable="on">
    <topology sockets="1" dies="1" cores="2" threads="3"/>
  </cpu>
  <clock offset="localtime">
    <timer name="hpet" present="yes"/>
    <timer name="hypervclock" present="yes"/>
  </clock>
1 Like

That seems about in line with my experience in virtualbox. Do you mean when idle, it’s taking 50% of one CPU core?

Did you have the same problem with windows 10?

Yes I had the same issue with W10
When windows is idle, I watch with “top” on host, and it goes between 50 and 100% of one core. When I run a benchmark on windows it uses 600% of my host, which makes sense because I gave it 6 vcpu.

In your configuration, I see 3 threads per 2 CPU cores. I would assume that these numbers should be inverted (3 cored with 2 threads).
One thing that might make intensive benchmarks run slower, is the fact that, AFAIK, you have 1 CCD with shared L3 cache for the whole CPU. There might be cache invalidation happening when the host does things in other cores but in the same cache. I don’t know enough about how this works, so I may be completely wrong. I still wanted to share the thought.

Yes this was a mistake. I now have 5 cores 2 threads with no improvement.
Benchmark was just a way to have a reliable measure, but I can also feel the difference in every day use. Just booting windows and launching apps is much slower in VM mode than bare metal.
When I use my VM, host does nothing most of the time.
And what also bother me is the 50% to 100% usage of one core just to run an idle VM.

Ok finally found the solution of all my issues : I have to disable windows Memory integrity.

Solves CPU usage, and performances. I now have bare metal performances in my VM.

Read a lot of posts about this issue, and did not read anybody suggesting this before, this is strange.

1 Like

50% CPU at idle sounds like the main issue. I’d check what’s using the CPU first, then try plain host-passthrough without manual topology. The NVMe slowdown could be a separate passthrough issue.