diff options
author | Jan Beulich <jbeulich@suse.com> | 2013-10-14 08:57:56 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2013-10-14 08:57:56 +0200 |
commit | eedd60391610629b4e8a2e8278b857ff884f750d (patch) | |
tree | 2074ed67f4e6eadf0c5ace2f94442411be7fdc67 /xen/common/sched_sedf.c | |
parent | 48830988a28b7fb1eed225354e25572aa955749a (diff) | |
download | xen-eedd60391610629b4e8a2e8278b857ff884f750d.tar.gz xen-eedd60391610629b4e8a2e8278b857ff884f750d.tar.bz2 xen-eedd60391610629b4e8a2e8278b857ff884f750d.zip |
scheduler: adjust internal locking interface
Make the locking functions return the lock pointers, so they can be
passed to the unlocking functions (which in turn can check that the
lock is still actually providing the intended protection, i.e. the
parameters determining which lock is the right one didn't change).
Further use proper spin lock primitives rather than open coded
local_irq_...() constructs, so that interrupts can be re-enabled as
appropriate while spinning.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/sched_sedf.c')
-rw-r--r-- | xen/common/sched_sedf.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/xen/common/sched_sedf.c b/xen/common/sched_sedf.c index d1812b6c48..7c24171e9e 100644 --- a/xen/common/sched_sedf.c +++ b/xen/common/sched_sedf.c @@ -1350,14 +1350,16 @@ static int sedf_adjust_weights(struct cpupool *c, int nr_cpus, int *sumw, s_time if ( EDOM_INFO(p)->weight ) { /* Interrupts already off */ - vcpu_schedule_lock(p); + spinlock_t *lock = vcpu_schedule_lock(p); + EDOM_INFO(p)->period_orig = EDOM_INFO(p)->period = WEIGHT_PERIOD; EDOM_INFO(p)->slice_orig = EDOM_INFO(p)->slice = (EDOM_INFO(p)->weight * (WEIGHT_PERIOD - WEIGHT_SAFETY - sumt[cpu])) / sumw[cpu]; - vcpu_schedule_unlock(p); + + vcpu_schedule_unlock(lock, p); } } } @@ -1418,21 +1420,24 @@ static int sedf_adjust(const struct scheduler *ops, struct domain *p, struct xen { /* (Here and everywhere in the following) IRQs are already off, * hence vcpu_spin_lock() is the one. */ - vcpu_schedule_lock(v); + spinlock_t *lock = vcpu_schedule_lock(v); + EDOM_INFO(v)->extraweight = op->u.sedf.weight; EDOM_INFO(v)->weight = 0; EDOM_INFO(v)->slice = 0; EDOM_INFO(v)->period = WEIGHT_PERIOD; - vcpu_schedule_unlock(v); + vcpu_schedule_unlock(lock, v); } } else { /* Weight-driven domains with real-time execution */ - for_each_vcpu ( p, v ) { - vcpu_schedule_lock(v); + for_each_vcpu ( p, v ) + { + spinlock_t *lock = vcpu_schedule_lock(v); + EDOM_INFO(v)->weight = op->u.sedf.weight; - vcpu_schedule_unlock(v); + vcpu_schedule_unlock(lock, v); } } } @@ -1454,14 +1459,15 @@ static int sedf_adjust(const struct scheduler *ops, struct domain *p, struct xen /* Time-driven domains */ for_each_vcpu ( p, v ) { - vcpu_schedule_lock(v); + spinlock_t *lock = vcpu_schedule_lock(v); + EDOM_INFO(v)->weight = 0; EDOM_INFO(v)->extraweight = 0; EDOM_INFO(v)->period_orig = EDOM_INFO(v)->period = op->u.sedf.period; EDOM_INFO(v)->slice_orig = EDOM_INFO(v)->slice = op->u.sedf.slice; - vcpu_schedule_unlock(v); + vcpu_schedule_unlock(lock, v); } } @@ -1471,13 +1477,14 @@ static int sedf_adjust(const struct scheduler *ops, struct domain *p, struct xen for_each_vcpu ( p, v ) { - vcpu_schedule_lock(v); + spinlock_t *lock = vcpu_schedule_lock(v); + EDOM_INFO(v)->status = (EDOM_INFO(v)->status & ~EXTRA_AWARE) | (op->u.sedf.extratime & EXTRA_AWARE); EDOM_INFO(v)->latency = op->u.sedf.latency; extraq_check(v); - vcpu_schedule_unlock(v); + vcpu_schedule_unlock(lock, v); } } else if ( op->cmd == XEN_DOMCTL_SCHEDOP_getinfo ) |