From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755638AbdELIk7 (ORCPT ); Fri, 12 May 2017 04:40:59 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:52385 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756588AbdELIk4 (ORCPT ); Fri, 12 May 2017 04:40:56 -0400 Date: Fri, 12 May 2017 10:40:53 +0200 (CEST) From: Thomas Gleixner To: Gregory Fong cc: "linux-kernel@vger.kernel.org" , linux@armlinux.org.uk, Florian Fainelli Subject: Re: handle_bad_irq and locking In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 11 May 2017, Gregory Fong wrote: > Hi Thomas, > > I noticed that when you changed arm irq handling to use the generic > implementation back in 2006 that you changed do_bad_IRQ() to the > following: > > +#define do_bad_IRQ(irq,desc,regs) \ > +do { \ > + spin_lock(&desc->lock); \ > + handle_bad_irq(irq, desc, regs); \ > + spin_unlock(&desc->lock); \ > +} while(0) > > and it's mostly stayed the same since then. As such, there are a few > examples of this being open-coded in the kernel in various irqchip > handlers such as that of drivers/irqchip/irq-brcmstb-l2.c, and even > more cases where the lock isn't being grabbed before calling > handle_bad_irq(). > > Since handle_bad_irq() is sort of a flow handler like > handle_edge_irq() etc., do you think it would make sense to do the > same as those and have it do the locking on its own? A quick look > through existing users of handle_bad_irq() at [1] suggests that either > the locking isn't necessary or it's almost always done wrong. Right. So the proper solution to this is to create a generic function handle_bad_irq_desc() have proper locking in it and move all users (including do_bad_IRQ()) over to it. Thanks, tglx