Skip to contentSkip to conversation

Solving WARNING: Enabled interrupts issues

DISCUSSION Marc Marí 2 participants 2 messages Nov 8, 2014 – Feb 17, 2015

lore
Share & tools
lore

Marc Marí

author
#0 lore raw

Hello everyone

I'm working in the porting of a platform-specific linux kernel to RT. I think I'm in the right way, but I'm looking on the best approach to solve issues with IRQS in drivers.

At this moment I have this warning:

[    5.079524] WARNING: at kernel/irq/handle.c:146
handle_irq_event_percpu+0x2d8/0x2fc()
[    5.087378] irq 305 handler
irq_default_primary_handler+0x0/0x1c enabled interrupts
[    5.095008]
[<c010dc4c>] (unwind_backtrace+0x0/0x144) from [<c0a4e8e0>]
(dump_stack+0x20/0x24)
[    5.103600] [<c0a4e8e0>]
(dump_stack+0x20/0x24) from [<c01939e8>]
(warn_slowpath_common+0x58/0x70)
[    5.112548] [<c01939e8>]
(warn_slowpath_common+0x58/0x70) from [<c0193a7c>]
(warn_slowpath_fmt+0x40/0x48)
[    5.122100] [<c0193a7c>]
(warn_slowpath_fmt+0x40/0x48) from [<c01fa66c>]
(handle_irq_event_percpu+0x2d8/0x2fc)
[    5.132077] [<c01fa66c>]
(handle_irq_event_percpu+0x2d8/0x2fc) from [<c01fa718>]
(handle_irq_event+0x88/0xb0)
[    5.141975] [<c01fa718>]
(handle_irq_event+0x88/0xb0) from [<c01fd50c>]
(handle_level_irq+0xbc/0x15c)
[    5.151144] [<c01fd50c>]
(handle_level_irq+0xbc/0x15c) from [<c01f9ce4>]
(generic_handle_irq+0x30/0x40
[    5.160553] [<c01f9ce4>]
(generic_handle_irq+0x30/0x40) from [<c0552d68>]
(qpnpint_handle_irq+0x6c/0xd8)
[    5.170012] [<c0552d68>]
(qpnpint_handle_irq+0x6c/0xd8) from [<c0551f38>]
(pmic_arb_periph_irq+0x174/0x21c)
[    5.179733] [<c0551f38>]
(pmic_arb_periph_irq+0x174/0x21c) from [<c01face0>]
(irq_forced_thread_fn+0x30/0x74)
[    5.189629] [<c01face0>]
(irq_forced_thread_fn+0x30/0x74) from [<c01fab44>]
(irq_thread+0x124/0x164)
[    5.198744] [<c01fab44>]
(irq_thread+0x124/0x164) from [<c01b4e48>] (kthread+0x98/0xa4)
[    5.206701] [<c01b4e48>] (kthread+0x98/0xa4) from [<c0107c90>]

(kernel_thread_exit+0x0/0x8)

I can see, that the driver that is causing issues is the one that contains the pmic_arb_periph_irq handler. This is the requester:
ret = devm_request_irq(&pdev->dev, pmic_arb->pic_irq,

     pmic_arb_periph_irq, IRQF_TRIGGER_HIGH, pdev->name, pmic_arb);

And the handler is a bit long, so I won't post it here. Just say that it does its own tasks without any lock, just a memory barrier (mb()), and then it calls generic_handle_irq(irq); I also know that irqs are enabled even when the handler is called (and, as far as I understand, this is due to threaded interrupts) because I printed the value of irqs_disabled();

I can solve the warning by adding the flag IRQF_NO_THREAD to the requester, or adding local_irq_save - restore in the handler. The device also has spin locks, that are not used in the IRQ context. But I would like to know what is the best approach to disable irqs (IRQF_NO_THREAD, local_irq_save for the whole handler, local_irq_save just for the generic_handle_irq call, spin_locks for the whole hander or just for the generic_handle_irq call...)

(Sorry for my ignorance. I'm learning as fast as I can, but there are points where I'm lacking examples).

Thanks in advance
Marc

#1 lore raw
Quoted 6 lines · * Marc Marí | 2014-11-08 23:56:47 [+0100]:

And the handler is a bit long, so I won't post it here. Just say that it does its own tasks without any lock, just a memory barrier (mb()), and then it calls generic_handle_irq(irq); I also know that irqs are enabled even when the handler is called (and, as far as I understand, this is due to threaded interrupts) because I printed the value of irqs_disabled();

git grep generic_handle_irq drivers/irqchip/
I looks like you try to implement a irq chip.

Quoted 2 lines

Thanks in advance
Marc

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html