aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/schedule.c
diff options
context:
space:
mode:
authorDario Faggioli <dario.faggioli@citrix.com>2012-01-04 16:12:44 +0000
committerDario Faggioli <dario.faggioli@citrix.com>2012-01-04 16:12:44 +0000
commita33389c34e9dd9e4877dd96c5b189fc9d6230ff7 (patch)
tree63d9bf351eb96ecfc42e975b702b8da3009dd4bd /xen/common/schedule.c
parent4da8a5edbd7800568eb4af5adc118e174e876694 (diff)
downloadxen-a33389c34e9dd9e4877dd96c5b189fc9d6230ff7.tar.gz
xen-a33389c34e9dd9e4877dd96c5b189fc9d6230ff7.tar.bz2
xen-a33389c34e9dd9e4877dd96c5b189fc9d6230ff7.zip
Rework locking for sched_adjust.
The main idea is to move (as much as possible) locking logic from generic code to the various pluggable schedulers. While at it, the following is also accomplished: - pausing all the non-current VCPUs of a domain while changing its scheduling parameters is not effective in avoiding races and it is prone to deadlock, so that is removed. - sedf needs a global lock for preventing races while adjusting domains' scheduling parameters (as it is for credit and credit2), so that is added. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Committed-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/schedule.c')
-rw-r--r--xen/common/schedule.c34
1 files changed, 2 insertions, 32 deletions
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 0455619ac2..3a91220823 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -1005,7 +1005,6 @@ int sched_id(void)
/* Adjust scheduling parameter for a given domain. */
long sched_adjust(struct domain *d, struct xen_domctl_scheduler_op *op)
{
- struct vcpu *v;
long ret;
if ( (op->sched_id != DOM2OP(d)->sched_id) ||
@@ -1013,40 +1012,11 @@ long sched_adjust(struct domain *d, struct xen_domctl_scheduler_op *op)
(op->cmd != XEN_DOMCTL_SCHEDOP_getinfo)) )
return -EINVAL;
- /*
- * Most VCPUs we can simply pause. If we are adjusting this VCPU then
- * we acquire the local schedule_lock to guard against concurrent updates.
- *
- * We only acquire the local schedule lock after we have paused all other
- * VCPUs in this domain. There are two reasons for this:
- * 1- We don't want to hold up interrupts as pausing a VCPU can
- * trigger a tlb shootdown.
- * 2- Pausing other VCPUs involves briefly locking the schedule
- * lock of the CPU they are running on. This CPU could be the
- * same as ours.
- */
-
- for_each_vcpu ( d, v )
- {
- if ( v != current )
- vcpu_pause(v);
- }
-
- if ( d == current->domain )
- vcpu_schedule_lock_irq(current);
-
+ /* NB: the pluggable scheduler code needs to take care
+ * of locking by itself. */
if ( (ret = SCHED_OP(DOM2OP(d), adjust, d, op)) == 0 )
TRACE_1D(TRC_SCHED_ADJDOM, d->domain_id);
- if ( d == current->domain )
- vcpu_schedule_unlock_irq(current);
-
- for_each_vcpu ( d, v )
- {
- if ( v != current )
- vcpu_unpause(v);
- }
-
return ret;
}