Cores CPUs Threads

krystofr

Member
Dec 30, 2016
20
1
23
churchweb.uk
I'm in a muddle with setting the number of cores, CPUs and Threads

I use proxmox on a machine with 1x Intel Xeon D-1520 processor. This is a 4 core but 8 threads. I have only 1 VM running.

Proxmox 5.1 summary for the node reports 8 CPUs
However when setting the options for the processor in a VM it asks for sockets and cores. I only have a physical CPU so I set it to 1 socket, but should I select 4 cores, as per the intel spec, or should I select 8 cores as in the threads, or CPU's reported on the node?

Thank you in advance,
 
KVM/qemu always presents a simulation of a hardware configuration to the VM. It can make the hardware appear in almost any configuration you want. If you want to have 4 virtual CPUs available to the VM you can tell it that it has 1 socket with 4 cores, two sockets with 2 cores each or 4 sockets with 1 core each. When running, KVM will attempt to schedule actual CPUs that make sense for the configuration, but that is not always guaranteed.

Whether or not it matters depends a lot on what you are running in the VM and how much it "knows" about and/or depends upon the CPU/NUMA archtecture.
 
So also remember that with 4 core 8 threads in any operating system it presents as an 8 core server. Found this out when I bought an intel NUC and couldn't figure out why it reported 8 cpus instead of 4. 4 core with 4 threads would be 4 core, 4 core with 8 threads 8 core...I don't understand it totally but it's in the way they do the math.
 
I'm in the same boat. Thanks for clearing this up.
So if I have an 8 core 16 thread CPU and wanted to allocate 100% of it to a VM, I would give the VM 16 Cores? (Since it considers threads and cores the same thing)
 
I'm in the same boat. Thanks for clearing this up.
So if I have an 8 core 16 thread CPU and wanted to allocate 100% of it to a VM, I would give the VM 16 Cores? (Since it considers threads and cores the same thing)

Sorry it took me so long to answer, I didn't get an alert that you responded to me. Yes you would in effect be giving the VM 16 cores. Let me know if you need anything else.

Michael
 
Hi. I was seeking for this question for a long time.
You can manually set cpu topology, but it consumes resources heavily.
as an example for 1x Intel Xeon D-1520 use
Code:
args: -cpu 'host,-hypervisor,+kvm_pv_unhalt,+kvm_pv_eoi,hv_spinlocks=0x1fff,hv_vapic,hv_time,hv_reset,hv_vpindex,hv_runtime,hv_relaxed,kvm=off,hv_vendor_id=intel,+vmx,+ht', -smp 4,cores=2,threads=2,sockets=1,maxcpus=4

for my E5-2630v4 the result is:
Code:
user@vpn1:~$ lscpu
Архитектура:x86_64
CPU op-mode(s):        32-bit, 64-bit
Порядок байтов:Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Потоков на ядро:2
Ядер на сокет:2
Сокет(ы):        1
NUMA node(s):          1
Vendor ID:             GenuineIntel
Семейство CPU:6
Модель:          79
Model name:            Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
Stepping:              1
CPU МГц:            2200.036
BogoMIPS:              4400.07
Виртуализация:VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              4096K
L3 cache:              16384K
NUMA node0 CPU(s):     0-3
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb kaiser tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat

as you can see VM have ht, vmx, gpu, lm and so on...

but i cannot explain why the cache is 16384, but CPU have 25Mb cache...
 
It does not say that you have a 16384Mb cache, it says you have a 16384 kilobyte cache, if you divide by 1000 to convert to megabytes, that equals 16.384 megabytes for your L3 cache, added together, they will be 25Mb.
 
I mean that E5-2630v4 have 25Mb cache but reported only 16Mb.

Also:
"args: -cpu "
replaces all cpu flags. So consider to use "host" then view
"qm config VMID --verbose" and use all cpu flags from there and only then add -hypervisor, +ht (or +svm for AMD)

But on AMD processors -smp threads not working
 
KVM/qemu always presents a simulation of a hardware configuration to the VM. It can make the hardware appear in almost any configuration you want. If you want to have 4 virtual CPUs available to the VM you can tell it that it has 1 socket with 4 cores, two sockets with 2 cores each or 4 sockets with 1 core each. When running, KVM will attempt to schedule actual CPUs that make sense for the configuration, but that is not always guaranteed.

Whether or not it matters depends a lot on what you are running in the VM and how much it "knows" about and/or depends upon the CPU/NUMA archtecture.
so if set 1 VM with 1 socket and 4 core , so total of 4 Vcu , the Host will handle the load of that Socket on his 2 socket Cpu right ?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!