]> xenbits.xensource.com Git - people/hx242/xen.git/commit
xen: credit2: never consider CPUs outside of our cpupool.
authorDario Faggioli <dario.faggioli@citrix.com>
Tue, 17 Jan 2017 17:26:46 +0000 (18:26 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Tue, 24 Jan 2017 17:02:07 +0000 (17:02 +0000)
commite7191920261d20e52ca4c06a03589a1155981b04
tree57d35d584d30f12791d60d15fa3eed280463403a
parent548db8742872399936a2090cbcdfd5e1b34fcbcc
xen: credit2: never consider CPUs outside of our cpupool.

In fact, relying on the mask of what pCPUs belong to
which Credit2 runqueue is not enough. If we only do that,
when Credit2 is the boot scheduler, we may ASSERT() or
panic when moving a pCPU from Pool-0 to another cpupool.

This is because pCPUs outside of any pool are considered
part of cpupool0. This puts us at risk of crash when those
same pCPUs are added to another pool and something
different than the idle domain is found to be running
on them.

Note that, even if we prevent the above to happen (which
is the purpose of this patch), this is still pretty bad,
in fact, when we remove a pCPU from Pool-0:
- in Credit1, as we do *not* update prv->ncpus and
  prv->credit, which means we're considering the wrong
  total credits when doing accounting;
- in Credit2, the pCPU remains part of one runqueue,
  and is hence at least considered during load balancing,
  even if no vCPU should really run there.

In Credit1, this "only" causes skewed accounting and
no crashes because there is a lot of `cpumask_and`ing
going on with the cpumask of the domains' cpupool
(which, BTW, comes at a price).

A quick and not to involved (and easily backportable)
solution for Credit2, is to do exactly the same.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com
Acked-by: George Dunlap <george.dunlap@citrix.com>
xen/common/sched_credit2.c