diff -r c840095b9359 xen/common/schedule.c --- a/xen/common/schedule.c Mon Jul 26 03:55:45 2010 -0700 +++ b/xen/common/schedule.c Mon Aug 16 18:33:07 2010 -0700 @@ -627,6 +627,30 @@ ret_t do_sched_op(int cmd, XEN_GUEST_HAN break; } + case SCHEDOP_yield_to: + { + struct sched_yield_to yld_s; + struct vcpu *vp; + struct domain *dp = current->domain; + + ret = -EFAULT; + if ( copy_from_guest(&yld_s, arg, 1) ) + break; + + ret = -EINVAL; + if (is_idle_vcpu(current) || yld_s.vcpu_id > dp->max_vcpus) + break; + + vp = dp->vcpu[yld_s.vcpu_id]; + if (!vp->is_running) { + vcpu_kick(dp->vcpu[yld_s.vcpu_id]); + ret = do_yield(); + } else + ret = 0; + + break; + } + case SCHEDOP_block: { ret = do_block(); diff -r c840095b9359 xen/include/public/sched.h --- a/xen/include/public/sched.h Mon Jul 26 03:55:45 2010 -0700 +++ b/xen/include/public/sched.h Mon Aug 16 18:33:07 2010 -0700 @@ -108,6 +108,17 @@ DEFINE_XEN_GUEST_HANDLE(sched_remote_shu #define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */ #define SHUTDOWN_crash 3 /* Tell controller we've crashed. */ + +/* + * * Voluntarily yield the CPU to another given vcpu + * * @arg == vcpu info. + * */ +#define SCHEDOP_yield_to 5 +struct sched_yield_to { + unsigned int version; + unsigned int vcpu_id; +}; + #endif /* __XEN_PUBLIC_SCHED_H__ */ /*