From: Ian Campbell Subject: Re: [PATCH v3 18/18] xen/arm: IRQ: Handle multiple action per IRQ Date: Wed, 16 Apr 2014 17:17:28 +0100 Message-ID: <1397665048.24638.237.camel@kazak.uk.xensource.com> References: <1396968247-8768-1-git-send-email-julien.grall@linaro.org> <1396968247-8768-19-git-send-email-julien.grall@linaro.org> <1397663693.24638.226.camel@kazak.uk.xensource.com> <534EAA6C.9070601@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WaSWk-00083A-2C for xen-devel@lists.xenproject.org; Wed, 16 Apr 2014 16:17:34 +0000 In-Reply-To: <534EAA6C.9070601@linaro.org> 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: xen-devel@lists.xenproject.org, Keir Fraser , tim@xen.org, Jan Beulich , stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org On Wed, 2014-04-16 at 17:06 +0100, Julien Grall wrote: > On 04/16/2014 04:54 PM, Ian Campbell wrote: > > On Tue, 2014-04-08 at 15:44 +0100, Julien Grall wrote: > >> desc->status &= ~IRQ_PENDING; > >> spin_unlock_irq(&desc->lock); > >> - action->handler(irq, action->dev_id, regs); > >> + list_for_each_entry_safe(action, next, &desc->action, next) > >> + action->handler(irq, action->dev_id, regs); > > > > You aren't removing entries from within the loop so I don't think you > > need the _safe variant. > > As we release the desc->lock here, it might be possible to have the list > changed under the CPU feet by release_irq. > > With the double-linked list, how do we make sure that it won't happen? Normally by using a lock. I don't know if even list_for_each_entry_safe is safe against concurrent changes to the list from other threads, I think it only refers to safe to changing the list within the loop in this thread. > > I actually think a goto found would actually be clearer here than the > > flag. > > I'm not a big fan of goto. > > Anyway, I will use it here if you think it's clearer. It has it's places, I think this is one of them. Ian.