VCPU number in the Settings

Hi,

could someone please explain to me what the VCPU option in the advanced settings of a Qube basically means or coud point me to the right link in the documentation (I cannot find it).
Right now it is set to “2” in all qubes.
Under which circumstances does it make sense to change it?
My CPU has more than two physical cores.

Thank you very much in advance for your reply!

It’s the number of virtual CPUs (aka cores) available to a certain qube.

Two seems to be a very good default.

I have experimented with some “sys-” qubes just having one VCPU, which
mostly works fine with proxy VMs although I have the impression my
webcam (sys-usb) works more reliably with 2 VCPU (moving the data from
USB to qrexec). But this is just observation/guessing.

A reason to add more VCPU would be if you are running a program that
makes extensive use of concurrency (e.g. a compiler or render).

My configuration using i7-10750H
1 vcpu on all sys-*
2 vcpu on all app

Everything is good, never seen full workload.

And what is the maximum I can use?
Is the max VCPU core the max physical cores?
Does it help for Videochatting to max it out?

Never test it, but i suggest it’s depends on your max vcpu

It’s different, you can say vcpu as thread / logical core. Example :
Processor Number i7-10750H

  • # of Cores 6 = Pyshical Core
  • # of Threads 12 = Logical Core / vCPU

Ideally yes, but check with top command and look at your ram / cpu, if its full load then you’ve to increase it.

1 Like

Found something interesting:

This one is pretty interesting for Qubes-Users who are ready to tweak a little:
https://wiki.xenproject.org/wiki/Tuning_Xen_for_Performance

Setting VCPU number to 12 on a 6-physical-core machine does bring up better results (than 6, and significantly than 2) in browser benchmark. It’s weird,because Qubes disables SMT by default.

There’s a real confusion going on in this thread.
Qubes does disable SMT by default - you can check with sudo cat /proc/cpuinfo
in dom0 and see that you have the number of cores there.

But you can allocate more than the number of cores to a qube - try it.
You can allocate more than the number of cores across qubes in total.
For example, I currently have one qube running with 80 vcpus.
Does this improve performance? Not at all: it just makes the hypervisor
work harder.
If you over allocate vcpus, then Xen will simulate the missing cores by
suspending some vcpus, or just ignore the extra count.
If you over allocate the cores, then you are more likely to waste CPU
resources.

Generally, I would suggest starting with the minimum, and then step up
by single increments until you find the level that’s needed for best
performance in that qube.
Almost all my qubes are running with 1 vcpu, and I don’t notice the
difference.

3 Likes

5 posts were split to a new topic: Why does Qubes Disable Hyperthreading?

Really interesting stuff. Does running VM’s have to be restarted between vcpu changes?

I believe so

I have 4 logical core cpu no virtual cores, i set 10 vcpus. Qubes qube lscpu shows it got vcpus.
Ok, remade to have 44 vpcus. Each l1 l2 l3 cache adds up. All works.
Test good. Setting back to 2.

Qube dom0
```

lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 39 bits physical, 48 bits virtual
CPU(s): 44
On-line CPU(s) list: 0-43
Thread(s) per core: 1
Core(s) per socket: 14
Socket(s): 3
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 94
Model name: Intel(R) Core™ i5-6440HQ CPU @ 2.60GHz
Stepping: 3
CPU MHz: 2592.118
BogoMIPS: 5184.23
Hypervisor vendor: Xen
Virtualization type: full
L1d cache: 1.4 MiB
L1i cache: 1.4 MiB
L2 cache: 11 MiB
L3 cache: 264 MiB
NUMA node0 CPU(s): 0-43
Vulnerability Itlb multihit: KVM: Mitigation: VMX unsupported
Vulnerability L1tf: Mitigation; PTE Inversion
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT Host state u
nknown
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled v
ia prctl and seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user
pointer sanitization
Vulnerability Spectre v2: Mitigation; Full generic retpoline, IBPB condit
ional, IBRS_FW, RSB filling
Vulnerability Srbds: Unknown: Dependent on hypervisor status
Vulnerability Tsx async abort: Not affected
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtr
r pge mca cmov pat pse36 clflush acpi mmx fxsr
sse sse2 ss ht syscall nx pdpe1gb rdtscp lm con
stant_tsc rep_good nopl cpuid tsc_known_freq pn
i pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x
2apic movbe popcnt tsc_deadline_timer aes xsave
avx f16c rdrand hypervisor lahf_lm abm 3dnowpr
efetch cpuid_fault invpcid_single pti ssbd ibrs
ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep
bmi2 erms invpcid rdseed adx smap clflushopt xs
aveopt xsavec xgetbv1 xsaves md_clear flush_l1d

|
lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 39 bits physical, 48 bits virtual
CPU(s): 44
On-line CPU(s) list: 0-43
Thread(s) per core: 1
Core(s) per socket: 14
Socket(s): 3
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 94
Model name: Intel(R) Core™ i5-6440HQ CPU @ 2.60GHz
Stepping: 3
CPU MHz: 2592.118
BogoMIPS: 5184.23
Hypervisor vendor: Xen
Virtualization type: full
L1d cache: 1.4 MiB
L1i cache: 1.4 MiB
L2 cache: 11 MiB
L3 cache: 264 MiB
NUMA node0 CPU(s): 0-43
Vulnerability Itlb multihit: KVM: Mitigation: VMX unsupported
Vulnerability L1tf: Mitigation; PTE Inversion
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT Host state u
nknown
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled v
ia prctl and seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user
pointer sanitization
Vulnerability Spectre v2: Mitigation; Full generic retpoline, IBPB condit
ional, IBRS_FW, RSB filling
Vulnerability Srbds: Unknown: Dependent on hypervisor status
Vulnerability Tsx async abort: Not affected
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtr
r pge mca cmov pat pse36 clflush acpi mmx fxsr
sse sse2 ss ht syscall nx pdpe1gb rdtscp lm con
stant_tsc rep_good nopl cpuid tsc_known_freq pn
i pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x
2apic movbe popcnt tsc_deadline_timer aes xsave
avx f16c rdrand hypervisor lahf_lm abm 3dnowpr
efetch cpuid_fault invpcid_single pti ssbd ibrs
ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep
bmi2 erms invpcid rdseed adx smap clflushopt xs
aveopt xsavec xgetbv1 xsaves md_clear flush_l1d

Not clear what point you intend to make?