]> xenbits.xensource.com Git - libvirt.git/commit
conf, qemu: consider available CPUs in vcpupin/emulatorpin output
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Fri, 26 Jun 2020 22:10:44 +0000 (19:10 -0300)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 8 Jul 2020 17:39:44 +0000 (19:39 +0200)
commit2020c6af8a8e4bb04acb629d089142be984484c8
tree7a25519537cb5bc2d016cf7992bf8ef850152d7c
parent42036650c6c9f115738c95fd6f0f47a27c066a17
conf, qemu: consider available CPUs in vcpupin/emulatorpin output

The output of vcpupin and emulatorpin for a domain with vcpu
placement='static' is based on a default bitmap that contains
all possible CPUs in the host, regardless of the CPUs being offline
or not. E.g. for a Linux host with this CPU setup (from lscpu):

On-line CPU(s) list:   0,8,16,24,32,40,(...),184
Off-line CPU(s) list: 1-7,9-15,17-23,25-31,(...),185-191

And a domain with this configuration:

  <vcpu placement='static'>1</vcpu>

'virsh vcpupin' will return the following:

$ sudo ./run tools/virsh vcpupin vcpupin_test
 VCPU   CPU Affinity
----------------------
 0      0-191

This is benign by its own, but can make the user believe that all
CPUs from the 0-191 range are eligible for pinning. Which can lead
to situations like this:

$ sudo ./run tools/virsh vcpupin vcpupin_test 0 1
error: Invalid value '1' for 'cpuset.cpus': Invalid argument

This is exarcebated by the fact that 'virsh vcpuinfo' considers only
available host CPUs in the 'CPU Affinity' field:

$ sudo ./run tools/virsh vcpuinfo vcpupin_test
(...)
CPU Affinity:   y-------y-------y-------(...)

This patch changes the default bitmap of vcpupin and emulatorpin, in
the case of domains with static vcpu placement, to all available CPUs
instead of all possible CPUs. Aside from making it consistent with
the behavior of 'vcpuinfo', users will now have one less incentive to
try to pin a vcpu in an offline CPU.

https://bugzilla.redhat.com/show_bug.cgi?id=1434276

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/domain_conf.c
src/qemu/qemu_driver.c