From patchwork Wed Apr 8 22:21:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Brownell X-Patchwork-Id: 17281 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n38MLCXv000679 for ; Wed, 8 Apr 2009 22:21:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752466AbZDHWVL (ORCPT ); Wed, 8 Apr 2009 18:21:11 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752844AbZDHWVL (ORCPT ); Wed, 8 Apr 2009 18:21:11 -0400 Received: from smtp125.sbc.mail.sp1.yahoo.com ([69.147.65.184]:45793 "HELO smtp125.sbc.mail.sp1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752466AbZDHWVJ (ORCPT ); Wed, 8 Apr 2009 18:21:09 -0400 Received: (qmail 19000 invoked from network); 8 Apr 2009 22:21:07 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=pacbell.net; h=Received:X-YMail-OSG:X-Yahoo-Newman-Property:From:To:Subject:Date:User-Agent:Cc:References:In-Reply-To:MIME-Version:Content-Type:Message-Id; b=SgDhUm5+s9VeM9OVwxgvFnfAbzPE1StJ+kgJLiV0KHwMSGZV69pQMPFVo6l8hysihJfY2l3wLY8759pAGntmbe9VCsCXqYYmmd4euC/ovMXt+MF4lzkontjzNtNiJ97zwmkNnTtOjHol4QCssvLeae019QFgKpaull9ulBcvQhA= ; Received: from unknown (HELO albert) (david-b@69.226.223.132 with plain) by smtp125.sbc.mail.sp1.yahoo.com with SMTP; 8 Apr 2009 22:21:06 -0000 X-YMail-OSG: dv_s_uAVM1k1DBfwKiKbOZS9ZtvrEDejFF9sHgmCdgXyARtyQy4japauMPhqrYjsbcyrGiY4MUbP_lj70fIjNmJoDHB9Xy406tmYiYcXBBQ9b_L7RVqrrS_SnAwtdkyJw2.r_SvsFieTRy7IKQut9TN6nGmbgmG8z5X9UoYyoIxzrKcC9DUTsuMRAhjm6IfdiX_NnkZBANgYczXili49IU9rg7Jzffi19YzHkIsOA3NzcAaXWRxItZ.t9xZmGYz67WFjyRDxocX2.c.GPC3TcNYFR8V.52k9Glh885zLLejll5zUCryC3meohQ-- X-Yahoo-Newman-Property: ymail-3 From: David Brownell To: Hugo Vincent Subject: Re: Preempt-RT on OMAP3? Date: Wed, 8 Apr 2009 15:21:01 -0700 User-Agent: KMail/1.9.10 Cc: linux-omap@vger.kernel.org References: <5a7b8b7b0904052025g74325484h66335606bebea5a3@mail.gmail.com> <5a7b8b7b0904062119w42209eedp8645d096acb8c4dd@mail.gmail.com> <5a7b8b7b0904071822r52e910aat2454a63b0edadb69@mail.gmail.com> In-Reply-To: <5a7b8b7b0904071822r52e910aat2454a63b0edadb69@mail.gmail.com> MIME-Version: 1.0 Message-Id: <200904081521.02072.david-b@pacbell.net> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org On Tuesday 07 April 2009, Hugo Vincent wrote: > > http://hugovincent.com/files/lkml-20090407/boot3.log > > Can anyone give me any pointers on where to start for fixing the > problems shown in the above boot log? You'll have to start finding out about all the funky rules which apply to the -RT kernels, I think. As a rule, getting drivers to work in RT kernels involves some changes. Not all of those changes can work in mainline kernels. Some of the changes are driver issues; while some are changes in RT framework code. Some are bugfixes. There are a lot of reasons why not all the RT patches have made it to mainline ... > It looks like some fairly low level locking bugs (spinlock vs > raw_spinlock maybe?) in twl4030 IRQ handling and GP timer/clock event > source setup. The first lockdep warning is about some IRQ dispatch code. I happen to have the appended patches sitting around; they might affect this particular problem (or might not). I don't know if they'd even apply to the RT kernel. Alternatively, there's some odd rule about using workqueues in the current RT code. Like not being able to trigger them from all the usual contexts. If so, that seems buglike to me. - Dave From: David Brownell Subject: twl4030: use new handle_threaded_irq() flow handler Make the toplevel twl4030 irq dispatch code use the new handle_threaded_irq() flow handler. Also, minor cleanup, use the newish generic_handle_irq_desc(). Since that flow handler guarantees the IRQ handlers are called only in a normal (sleeping) thread context, remove some of the workarounds for the lockdep goofage whereby it breaks various drivers by forcing IRQF_DISABLED on. Signed-off-by: David Brownell --- drivers/mfd/twl4030-irq.c | 15 +++++---------- drivers/rtc/rtc-twl4030.c | 8 -------- drivers/usb/otg/twl4030-usb.c | 8 -------- 3 files changed, 5 insertions(+), 26 deletions(-) --- a/drivers/mfd/twl4030-irq.c +++ b/drivers/mfd/twl4030-irq.c @@ -215,7 +215,6 @@ static int twl4030_irq_thread(void *data } /* these handlers deal with the relevant SIH irq status */ - local_irq_disable(); for (module_irq = twl4030_irq_base; pih_isr; pih_isr >>= 1, module_irq++) { @@ -235,10 +234,9 @@ static int twl4030_irq_thread(void *data note_interrupt(module_irq, d, IRQ_NONE); else - d->handle_irq(module_irq, d); + generic_handle_irq_desc(module_irq, d); } } - local_irq_enable(); desc->chip->unmask(irq); } @@ -578,7 +576,7 @@ static inline int sih_read_isr(const str } /* - * Generic handler for SIH interrupts ... we "know" this is called + * Generic handler for SIH interrupts ... we know this is called * in task context, with IRQs enabled. */ static void handle_twl4030_sih(unsigned irq, struct irq_desc *desc) @@ -588,10 +586,7 @@ static void handle_twl4030_sih(unsigned int isr; /* reading ISR acks the IRQs, using clear-on-read mode */ - local_irq_enable(); isr = sih_read_isr(sih); - local_irq_disable(); - if (isr < 0) { pr_err("twl4030: %s SIH, read ISR error %d\n", sih->name, isr); @@ -658,7 +653,7 @@ int twl4030_sih_setup(int module) irq = irq_base + i; set_irq_chip_and_handler(irq, &twl4030_sih_irq_chip, - handle_edge_irq); + handle_threaded_irq); set_irq_chip_data(irq, agent); activate_irq(irq); } @@ -666,7 +661,7 @@ int twl4030_sih_setup(int module) status = irq_base; twl4030_irq_next += i; - /* replace generic PIH handler (handle_simple_irq) */ + /* replace generic PIH handler (handle_threaded_irq) */ irq = sih_mod + twl4030_irq_base; set_irq_data(irq, agent); set_irq_chained_handler(irq, handle_twl4030_sih); @@ -719,7 +714,7 @@ int twl_init_irq(int irq_num, unsigned i for (i = irq_base; i < irq_end; i++) { set_irq_chip_and_handler(i, &twl4030_irq_chip, - handle_simple_irq); + handle_threaded_irq); activate_irq(i); } twl4030_irq_next = i; --- a/drivers/rtc/rtc-twl4030.c +++ b/drivers/rtc/rtc-twl4030.c @@ -325,14 +325,6 @@ static irqreturn_t twl4030_rtc_interrupt int res; u8 rd_reg; -#ifdef CONFIG_LOCKDEP - /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which - * we don't want and can't tolerate. Although it might be - * friendlier not to borrow this thread context... - */ - local_irq_enable(); -#endif - res = twl4030_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); if (res) goto out; --- a/drivers/usb/otg/twl4030-usb.c +++ b/drivers/usb/otg/twl4030-usb.c @@ -576,14 +576,6 @@ static irqreturn_t twl4030_usb_irq(int i struct twl4030_usb *twl = _twl; int status; -#ifdef CONFIG_LOCKDEP - /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which - * we don't want and can't tolerate. Although it might be - * friendlier not to borrow this thread context... - */ - local_irq_enable(); -#endif - status = twl4030_usb_linkstat(twl); if (status != USB_LINK_UNKNOWN) {