From ff38d3faa7d0e1734237e81c2fea95e18c510dcd Mon Sep 17 00:00:00 2001 From: George Dunlap Date: Wed, 27 Apr 2011 13:36:15 +0100 Subject: credit2: add a callback to migrate to a new cpu In credit2, there needs to be a strong correlation between v->processor and the runqueue to which a vcpu is assigned; much of the code relies on this invariant. Allow credit2 to manage the actual migration itself. This fixes the most recent credit2 bug reported on the list (Xen BUG at sched_credit2.c:1606) in Xen 4.1, as well as the bug at sched_credit2.c:811 in -unstable (which catches the same condition earlier). Signed-off-by: George Dunlap --- xen/common/schedule.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'xen/common/schedule.c') diff --git a/xen/common/schedule.c b/xen/common/schedule.c index dde615ee66..aa8bdd5969 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -489,7 +489,11 @@ static void vcpu_migrate(struct vcpu *v) * Switch to new CPU, then unlock new and old CPU. This is safe because * the lock pointer cant' change while the current lock is held. */ - v->processor = new_cpu; + if ( VCPU2OP(v)->migrate ) + SCHED_OP(VCPU2OP(v), migrate, v, new_cpu); + else + v->processor = new_cpu; + if ( old_lock != new_lock ) spin_unlock(new_lock); -- cgit v1.2.3