[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3285590.DFfac97QLO@avalon>
Date: Mon, 15 Sep 2014 02:41:45 +0300
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-kernel@...r.kernel.org, rtc-linux@...glegroups.com,
"Rafael J. Wysocki" <rjw@...ysocki.net>
Subject: Re: [PATCH/RFC] rtc: rtc-twl: Fixed nested IRQ handling in resume from suspend
Hi Thomas,
On Saturday 13 September 2014 21:12:16 Thomas Gleixner wrote:
> On Sat, 13 Sep 2014, Laurent Pinchart wrote:
> > The TWL RTC interrupt is a double-nested threaded interrupt, handled
> > through the TWL SIH (Secondary Interrupt Handler) and PIH (Primary
> > Interrupt Handler).
> >
> > When the system is woken up from suspend by a TWL RTC alarm interrupt,
> > the TWL PIH and SIH are enabled first (due to the normal IRQ enabling
> > sequence for the PIH and to the IRQF_EARLY_RESUME flag for the SIH)
> > before the TWL RTC interrupt gets enabled. This results on the interrupt
> > being processed by the TWL primary interrupt handler, forwarded to the
> > nested SIH, and then marked as pending for the RTC by handle_nested_irq
> > called from the SIH.
> >
> > The RTC interrupt then eventually gets reenabled the kernel, which will
> > try to call its top half interrupt handler. As the interrupt is a nested
> > threaded IRQ, its primary handler has been set to the
> > irq_nested_primary_handler function, which is never supposed to be
> > called and generates a WARN_ON, without waking the IRQ thread up.
> >
> > Fix this by setting the IRQF_EARLY_RESUME for the TWL RTC interrupt to
> > ensure it gets enabled before the parent handlers try to process it.
> >
> > This is likely a bit of a hack, I have a feeling that a more generic
> > solution that would fix the problem for all nested threaded IRQs enabled
> > as a wake up source by enable_irq_wake would be better.
>
> Indeed. It's a hack. This is not the first abuse of IRQF_EARLY_RESUME
> which is used to "fix" ordering issues with nested thread handlers.
>
> I haven't come around yet to analyze the issue and come up with a proper
> core side mechanism to handle that case. I put it on the "look at it while
> trapped in a tin can" list.
Should this patch be applied in the meantime, or do you think you will be
trapped in a tin can in the not too distant future ?
--
Regards,
Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists