xen/sched: setup dom0 vCPUs affinity only once
authorDario Faggioli <dfaggioli@suse.com>
Thu, 11 Aug 2022 09:46:22 +0000 (11:46 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 11 Aug 2022 09:46:22 +0000 (11:46 +0200)
commitc79e4d209be3ed2a6b8e97c35944786ed2a66b94
tree14ed41403abfbff624b2f77d1ee0453f62b3d0a8
parent4735553ec1d8b63aa08772ced1fac96131427f94
xen/sched: setup dom0 vCPUs affinity only once

Right now, affinity for dom0 vCPUs is setup in two steps. This is a
problem as, at least in Credit2, unit_insert() sees and uses the
"intermediate" affinity, and place the vCPUs on CPUs where they cannot
be run. And this in turn results in boot hangs, if the "dom0_nodes"
parameter is used.

Fix this by setting up the affinity properly once and for all, in
sched_init_vcpu() called by create_vcpu().

Note that, unless a soft-affinity is explicitly specified for dom0 (by
using the relaxed mode of "dom0_nodes") we set it to the default, which
is all CPUs, instead of computing it basing on hard affinity (if any).
This is because hard and soft affinity should be considered as
independent user controlled properties. In fact, if we dor derive dom0's
soft-affinity from its boot-time hard-affinity, such computed value will
continue to be used even if later the user changes the hard-affinity.
And this could result in the vCPUs behaving differently than what the
user wanted and expects.

Fixes: dafd936dddbd ("Make credit2 the default scheduler")
Reported-by: Olaf Hering <ohering@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/sched/core.c