Re: [ 57/72] genirq: Unmask oneshot irqs when thread was not woken

From: Sven Joachim
Date: Tue Mar 06 2012 - 16:07:35 EST


Am 06.03.2012 um 21:26 schrieb Thomas Gleixner:

> On Tue, 6 Mar 2012, Sven Joachim wrote:
>> Am 06.03.2012 um 20:31 schrieb Thomas Gleixner:
>>
>> > Stephan, Sven: Can you please provide the output of /proc/interrupts ?
>>
>> Here is mine, from a freshly booted 3.3-rc6 kernel.
>>
>> Cheers,
>> Sven
>>
>> CPU0
>> 0: 25050 XT-PIC-XT-PIC timer
>> 1: 101 XT-PIC-XT-PIC i8042
>> 2: 0 XT-PIC-XT-PIC cascade
>> 3: 1 XT-PIC-XT-PIC
>> 4: 1 XT-PIC-XT-PIC
>> 5: 0 XT-PIC-XT-PIC ehci_hcd:usb1, uhci_hcd:usb2
>> 6: 1 XT-PIC-XT-PIC i915, uhci_hcd:usb5, yenta
>> 7: 1 XT-PIC-XT-PIC
>> 8: 0 XT-PIC-XT-PIC rtc0
>> 9: 634 XT-PIC-XT-PIC acpi
>> 10: 341 XT-PIC-XT-PIC uhci_hcd:usb4, snd_hda_intel, b43
>
> Ah, XT-PIC uses handle_level_irq(). /me bangs head against desk.
>
> Does the patch below fix the problem for you ?

Yep, it does. Thanks!

> ----------------->
> Subject: genirq: Clear action->thread_mask if IRQ_ONESHOT is not set
>
> commit ac5637611(genirq: Unmask oneshot irqs when thread was not
> woken) fails to unmask when a !IRQ_ONESHOT threaded handler is handled
> by handle_level_irq. This happens because thread_mask is or'ed
> unconditionally in irq_wake_thread(), but for !IRQ_ONESHOT interrupts
> never cleared. So the check for !desc->thread_active fails and keeps
> the interrupt disabled.
>
> Keep the thread_mask zero for !IRQ_ONESHOT interrupts.
>
> Reported-by: Sven Joachim <svenjoac@xxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> ---
>
> Index: linux-2.6/kernel/irq/manage.c
> ===================================================================
> --- linux-2.6.orig/kernel/irq/manage.c
> +++ linux-2.6/kernel/irq/manage.c
> @@ -996,11 +996,13 @@ __setup_irq(unsigned int irq, struct irq
> * Setup the thread mask for this irqaction. Unlikely to have
> * 32 resp 64 irqs sharing one line, but who knows.
> */
> - if (new->flags & IRQF_ONESHOT && thread_mask == ~0UL) {
> - ret = -EBUSY;
> - goto out_mask;
> + if (new->flags & IRQF_ONESHOT) {
> + if (thread_mask == ~0UL) {
> + ret = -EBUSY;
> + goto out_mask;
> + }
> + new->thread_mask = new->flags & IRQF_ONESHOT;
> }
> - new->thread_mask = 1 << ffz(thread_mask);
>
> if (!shared) {
> init_waitqueue_head(&desc->wait_for_threads);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/