xen/sched: make vcpu_wake() and vcpu_sleep() core scheduling aware
authorJuergen Gross <jgross@suse.com>
Wed, 2 Oct 2019 14:43:30 +0000 (16:43 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 4 Oct 2019 10:58:09 +0000 (12:58 +0200)
commitba7ff2c7bb01e9162f5b0eb1f521fc2cfeb75e72
tree923b7c2dc8145aca681dd06e08432ebb7ba9683e
parentbe9dde875792517be55e986f8a65ccdfb5c67dfe
xen/sched: make vcpu_wake() and vcpu_sleep() core scheduling aware

vcpu_wake() and vcpu_sleep() need to be made core scheduling aware:
they might need to switch a single vcpu of an already scheduled unit
between running and not running.

Especially when vcpu_sleep() for a vcpu is being called by a vcpu of
the same scheduling unit special care must be taken in order to avoid
a deadlock: the vcpu to be put asleep must be forced through a
context switch without doing so for the calling vcpu. For this
purpose add a vcpu flag handled in sched_slave() and in
sched_wait_rendezvous_in() allowing a vcpu of the currently running
unit to switch state at a higher priority than a normal schedule
event.

Use the same mechanism when waking up a vcpu of a currently active
unit.

While at it make vcpu_sleep_nosync_locked() static as it is used in
schedule.c only.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
Acked-by: Julien Grall <julien.grall@arm.com>
xen/common/schedule.c
xen/include/xen/sched-if.h
xen/include/xen/sched.h