Xen allows a domain's virtual CPU(s) to be associated with one or more
host CPUs. This can be used to allocate real resources among one or
more guests, or to make optimal use of processor resources when
utilizing dual-core, hyperthreading, or other advanced CPU technologies.
Xen enumerates physical CPUs in a `depth first' fashion. For a system
with both hyperthreading and multiple cores, this would be all the
hyperthreads on a given core, then all the cores on a given socket,
and then all sockets. I.e. if you had a two socket, dual core,
hyperthreaded Xeon the CPU order would be:
socket0 |
socket1 |
core0 |
core1 |
core0 |
core1 |
ht0 |
ht1 |
ht0 |
ht1 |
ht0 |
ht1 |
ht0 |
ht1 |
#0 |
#1 |
#2 |
#3 |
#4 |
#5 |
#6 |
#7 |
Having multiple vcpus belonging to the same domain mapped to the same
physical CPU is very likely to lead to poor performance. It's better to
use `vcpus-set' to hot-unplug one of the vcpus and ensure the others are
pinned on different CPUs.
If you are running IO intensive tasks, its typically better to dedicate
either a hyperthread or whole core to running domain 0, and hence pin
other domains so that they can't use CPU 0. If your workload is mostly
compute intensive, you may want to pin vcpus such that all physical CPU
threads are available for guest domains.