[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/2] xen: export do_yield as vcpu_yield



On 07/23/2014 01:05 PM, Stefano Stabellini wrote:
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
CC: george.dunlap@xxxxxxxxxxxxx
CC: JBeulich@xxxxxxxx
---
  xen/common/schedule.c   |   10 +++++-----
  xen/include/xen/sched.h |    1 +
  2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index e9eb0bc..6631dc8 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -795,9 +795,8 @@ static long do_poll(struct sched_poll *sched_poll)
  }
/* Voluntarily yield the processor for this allocation. */
-static long do_yield(void)
+void vcpu_yield(struct vcpu *v)

What are you actually trying to do here? Why do you add a vcpu struct, when all the callers (including the one you add in 2/2) just pass current?

  {
-    struct vcpu * v=current;
      spinlock_t *lock = vcpu_schedule_lock_irq(v);
SCHED_OP(VCPU2OP(v), yield, v);
@@ -805,7 +804,6 @@ static long do_yield(void)
TRACE_2D(TRC_SCHED_YIELD, current->domain->domain_id, current->vcpu_id);
      raise_softirq(SCHEDULE_SOFTIRQ);

This is broken: it's still tracing current instead of v, and you're raising the schedule softirq on the current cpu rather than on the cpu on which v is running. If v!=current, you have to go through force reschedule for safety.

Just rename the function and make it non-static, leaving the arguments and return value alone.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.