From: Ian Campbell Subject: Re: [PATCH 7/9] arm: vgic: fix race between evtchn upcall and evtchnop_send Date: Thu, 11 Apr 2013 09:59:32 +0100 Message-ID: <1365670772.8036.20.camel@zakaz.uk.xensource.com> References: <1362559920.8941.98.camel@hastur.hellion.org.uk> <1362560076-25897-7-git-send-email-ijc@hellion.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: 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 Cc: "Tim (Xen.org)" , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Tue, 2013-03-19 at 16:18 +0000, Stefano Stabellini wrote: > On Wed, 6 Mar 2013, Ian Campbell wrote: > > From: Ian Campbell > > > > On ARM the evtchn upcall is done by using a local PPI interrupt. However the > > guest will clear the evtchn_upcall_pending bit before it EOIs that PPI (which > > happens late). This means vgic_vcpu_inject_irq (called via > > vcpu_mark_events_pending) sees the PPI as in flight and ends up not reinjecting > > it, if this happens after the guest has finished its event channel processing > > loop but before the EOI then we have lost the upcall. > > > > We therefore also need to call gic_restore_pending_irqs on the exit to guest > > path in order to pickup any newly inject IRQ and propagate it into a free LR. > > You forgot to mention that on exit to guest, before calling > gic_restore_pending_irqs, we check whether we need to reinject the PPI. I inserted before "We therefore..." To fix this we need to check if an evtchn upcall is pending when returning the guest and if so reinject the PPI. > Aside from this, the patch is fine. And then I took this as an Acked-by and applied. Thanks