From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH] xen/arm: Make local_events_need_delivery working with idle VPCU Date: Tue, 5 May 2015 12:40:35 +0100 Message-ID: <1430826035.2660.52.camel@citrix.com> References: <1430145540-31032-1-git-send-email-julien.grall@citrix.com> <553E6489.30300@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YpbDM-0005sM-Iz for xen-devel@lists.xenproject.org; Tue, 05 May 2015 11:40:40 +0000 In-Reply-To: <553E6489.30300@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: Julien Grall Cc: Stefano Stabellini , Andrew Cooper , Riku Voipio , Tim Deegan , stefano.stabellini@citrix.com, Jan Beulich , xen-devel@lists.xenproject.org, Tamas K Lengyel List-Id: xen-devel@lists.xenproject.org On Mon, 2015-04-27 at 17:32 +0100, Julien Grall wrote: > >> diff --git a/xen/include/asm-arm/event.h b/xen/include/asm-arm/event.h > >> index 5330dfe..0149d06 100644 > >> --- a/xen/include/asm-arm/event.h > >> +++ b/xen/include/asm-arm/event.h > >> @@ -39,7 +39,12 @@ static inline int local_events_need_delivery_nomask(void) > >> > >> static inline int local_events_need_delivery(void) > >> { > >> - if ( !vcpu_event_delivery_is_enabled(current) ) > >> + struct vcpu *v = current; > >> + > >> + if ( unlikely(is_idle_vcpu(v)) ) > >> + return 0; > >> + > >> + if ( !vcpu_event_delivery_is_enabled(v) ) > >> return 0; > >> return local_events_need_delivery_nomask(); > >> } > > > > Is it actually considered correct in Xen to call hypercall_preempt_check > > and/or local_events_need_delivery on the idle vcpu? > > It seems that the x86 version of hypercall_preempt_check is able to cope > with idle VCPU. AFAICT that's just a coincidence, since an idle vcpu won't ever have a pending up call. > Although, I'm not sure if there is path where > hypercall_preempt_check can be called on an idle VCPU (cc x86 > maintainers for this purpose). > > > Shouldn't it be avoided and maybe a BUG_ON added here instead? > > This patch was the simple way to fix the bug. I have other ideas in mind > which require some rework in apply_p2m_changes. > > I'll wait to see what x86 maintainers think. I'm inclined to just go with this patch for now, unless Stefano is nacking it. One question first: What aspect of local_events_need_delivery relies on the vcpu not being an idle one? I suppose something is not initialised, but what. Ian.