From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: [PATCH 1/2] xen: export do_yield as vcpu_yield Date: Wed, 23 Jul 2014 13:58:35 +0100 Message-ID: <53CFB17B.1040201@eu.citrix.com> References: <1406117103-10584-1-git-send-email-stefano.stabellini@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X9w8p-0000HC-89 for xen-devel@lists.xenproject.org; Wed, 23 Jul 2014 12:59:31 +0000 In-Reply-To: <1406117103-10584-1-git-send-email-stefano.stabellini@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini , xen-devel@lists.xenproject.org Cc: JBeulich@suse.com, julien.grall@linaro.org, Ian.Campbell@citrix.com, anup.patel@linaro.org, pranavkumar@linaro.org List-Id: xen-devel@lists.xenproject.org On 07/23/2014 01:05 PM, Stefano Stabellini wrote: > Signed-off-by: Stefano Stabellini > CC: george.dunlap@eu.citrix.com > CC: JBeulich@suse.com > --- > 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