On Tue, 2018-04-10 at 16:25 +0100, George Dunlap wrote: > On 04/10/2018 12:29 PM, Dario Faggioli wrote: > > > One thing we might consider doing is implementing the migrate() > callback > for the Credit scheduler, and just have it make a bunch of sanity > checks > (v->processor lock held, new_cpu lock held, vcpu not on any runqueue, > &c). > So, it turns out that I have to run. :-/
I hacked the attached patch rather quickly, but only compile tested it... And I'm pretty tired, so I can't guarantee all the BUG_ON()s are correct, nor that they are the proper ones to (potentially) catch the issue. So, Olaf, if you're fancy giving this a tray anyway, well, go ahead. If it does not work, though, get rid of it... and I'll craft a better one tomorrow. :-( Regards, Dario -- <<This happens because I choose it to happen!>> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Software Engineer @ SUSE https://www.suse.com/
commit 52bd39c760ce6664186bc9d67bcc6a8eed11f792 Author: Dario Faggioli <dfaggi...@suse.com> Date: Tue Apr 10 18:59:28 2018 +0200 xen: credit: implement SCHED_OP(migrate) with just sanity checking in it, to catch a race. Signed-off-by: Dario Faggioli <dfaggi...@suse.com> diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 9bc638c09c..5dcf530c24 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -867,6 +867,16 @@ _csched_cpu_pick(const struct scheduler *ops, struct vcpu *vc, bool_t commit) return cpu; } +static void +csched_vcpu_migrate(const struct scheduler *ops, struct vcpu *vc, + unsigned int new_cpu) +{ + BUG_ON(vc->is_running); + BUG_ON(test_bit(_VPF_migrating, &vc->pause_flags)); + BUG_ON(__vcpu_on_runq(CSCHED_VCPU(vc))); + BUG_ON(CSCHED_VCPU(vc) == CSCHED_VCPU(curr_on_cpu(vc->processor))); +} + static int csched_cpu_pick(const struct scheduler *ops, struct vcpu *vc) { @@ -2278,6 +2288,7 @@ static const struct scheduler sched_credit_def = { .adjust_global = csched_sys_cntl, .pick_cpu = csched_cpu_pick, + .migrate = csched_vcpu_migrate, .do_schedule = csched_schedule, .dump_cpu_state = csched_dump_pcpu,
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel