-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Hi, I do not use your scripts but we are seeing users in the Looking Glass discord that are who are having latency related issues due to how your script assigns CPUs to the VM.
The issue is that you are not replicating the host topology into the guest, if done properly the guest can know that the extra vCPU is sharing a core and even the L1/2/3 cache arrangement.
Here is how a guest sees a properly configured VM on a SMT host (Using Coreinfo).

Doing this the guest scheduler can make wise decisions on where to run each thread. Obviously you need to pin each CPU properly to the threads of each core to make this work well. If done correctly your cache mapping will also align with the physical hardware... see below:
Here is my host topology (AMD EPYC 7343):

My guest is pinned to CPU cores 8-15, which means
vCPU 0 & 1 = CPU 8 & 24
vCPU 2 & 3 = CPU 9 & 25
vCPU 4 & 5 = CPU 10 & 26
vCPU 6 & 7 = CPU 11 & 27
vCPU 8 & 9 = CPU 12 & 28
vCPU 10 & 11 = CPU 13 & 29
vCPU 12 & 13 = CPU 14 & 30
vCPU 14 & 15 = CPU 15 & 31
When done correctly you can see that my pinning aligns with the cache map, and allows the guest to make proper use of SMT.

Note AMD processors require the qemu CPU flag topoext so they can use SMT.
Note2: To get the cache to align you also have to set the QEMU cpu flags l3-cache=on,host-cache-info=on