Pin CPU core(s) to specific Xen domU (guest)

It is often needed for a virtual machine to use specific cores of those available. On a multi-core system, one or more cores can be assigned for each virtual machine to improve performance. By default a virtual machine will use any available core. Assuming that there is a machine with 4 cores and a virtual machine needs to use two of them, the following entries in the guest’s configuration file will present the virtual machine with two virtual CPUs and will map them between the 3rd and the 4th physical cores.

cpus = "2,3"
vcpus = 2

A longer range, let’s say on a 8core machine, can be specified as “2-8″ for example.
Which CPU is used for each VCPU can be seen with the xm vcpu-list command: