]> xenbits.xensource.com Git - xen.git/commit
xen: Have schedulers revise initial placement
authorGeorge Dunlap <george.dunlap@citrix.com>
Fri, 15 Jul 2016 16:20:36 +0000 (17:20 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Tue, 26 Jul 2016 09:42:49 +0000 (10:42 +0100)
commit9f358ddd69463fa8fb65cf67beb5f6f0d3350e32
treed8946c448aef31ada07d2fd5dc89d12233e19c05
parent4f9ab4330ece38382dc01a8df84b208af515d66a
xen: Have schedulers revise initial placement

The generic domain creation logic in
xen/common/domctl.c:default_vcpu0_location() attempts to try to do
initial placement load-balancing by placing vcpu 0 on the least-busy
non-primary hyperthread available.  Unfortunately, the logic can end
up picking a pcpu that's not in the online mask.  When this is passed
to a scheduler such which assumes that the initial assignment is
valid, it causes a null pointer dereference looking up the runqueue.

Furthermore, this initial placement doesn't take into account hard or
soft affinity, or any scheduler-specific knowledge (such as historic
runqueue load, as in credit2).

To solve this, when inserting a vcpu, always call the per-scheduler
"pick" function to revise the initial placement.  This will
automatically take all knowledge the scheduler has into account.

csched2_cpu_pick ASSERTs that the vcpu's pcpu scheduler lock has been
taken.  Grab and release the lock to minimize time spend with irqs
disabled.

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Meng Xu <mengxu@cis.upenn.edu>
Reviwed-by: Dario Faggioli <dario.faggioli@citrix.com>
xen/common/sched_credit.c
xen/common/sched_credit2.c
xen/common/sched_rt.c