[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1409132108520.23397@nanos>
Date: Sat, 13 Sep 2014 21:12:16 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Laurent Pinchart <laurent.pinchart@...asonboard.com>
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
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.
Thanks,
tglx
--
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