Optimizing QEMU, second guessing what i thought was a simple concept

So im doing a GPU passthrough and blah blah now i’m trying to setup QEMU with some properly optimized settings. I was working on a way to consolidate everything into a script to keep it one location when i came across this github fork of qemu with actual CPU pinning via cores and not threads. In the documentation it has a script that parses $ lscpu --extended and gives an output of how you should assign your affinities.

Now i’ve had an FX8350 for years ive been told it’s 4 physical cores with 2 ‘virtual’ cores per, so 2*4=8 threads. Now to be fair the documentation states it’s for intel hyperthreading. Should i follow the documention and only give 6 threads out via the affinty settings, or should i just asign 1to 0, 2 to 1, 3 to 2 for all ‘8 cores’? I’ve had this CPU for like 6 years now i’m not to familiar with how intel-HT works, but heres an example of what im talking about.

CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE
0 0 0 0 0:0:0:0 yes
1 0 0 0 1:0:0:0 yes
2 0 0 1 2:1:1:0 yes
3 0 0 1 3:1:1:0 yes
4 0 0 2 4:2:2:0 yes
5 0 0 2 5:2:2:0 yes
6 0 0 3 6:3:3:0 yes
7 0 0 3 7:3:3:0 yes

And this would parse into…

-smp 6,cores=3,threads=2 -vcpu vcpunum=0,affinity=2 -vcpu vcpunum=1,affinity=3 -vcpu vcpunum=2,affinity=4 -vcpu vcpunum=3,affinity=5 -vcpu vcpunum=4,affinity=6 -vcpu vcpunum=5,affinity=7

It turns out his script had made an error in parsing and not accounting for the fact that 0 is a starting point. I think i made that same mistake in my judgement because of that.

If I recall the FX series is 8 cores integer wise but two integer cores share a single FPU each.

I think you may have to experiment based on what software you are running inside your vm and how heavy it is in integer vs floating point.

1 Like