Skip to contentSkip to conversation

mailbox: qcom-ipcc: flag IRQ NO_THREAD

PATCH Superseded Eric Chanudet 2 participants 3 messages Oct 3, 2022 – Oct 6, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mailbox: qcom-ipcc: flag IRQ NO_THREAD

PREEMPT_RT forces qcom-ipcc's handler to be threaded with interrupts enabled, which triggers a warning in __handle_irq_event_percpu():

    irq 173 handler irq_default_primary_handler+0x0/0x10 enabled interrupts
    WARNING: CPU: 0 PID: 77 at kernel/irq/handle.c:161 __handle_irq_event_percpu+0x4c4/0x4d0

Mark it IRQF_NO_THREAD to avoid running the handler in a threaded context with threadirqs or PREEMPT_RT enabled.

---
 drivers/mailbox/qcom-ipcc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mailbox/qcom-ipcc.c +2 -1
index 31d58b7d55fe..7e27acf6c0cc 100644
@@ -308,7 +308,8 @@ static int qcom_ipcc_probe(struct platform_device *pdev)
 		goto err_mbox;
 
 	ret = devm_request_irq(&pdev->dev, ipcc->irq, qcom_ipcc_irq_fn,
-			       IRQF_TRIGGER_HIGH | IRQF_NO_SUSPEND, name, ipcc);
+			       IRQF_TRIGGER_HIGH | IRQF_NO_SUSPEND |
+			       IRQF_NO_THREAD, name, ipcc);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Failed to register the irq: %d\n", ret);
 		goto err_req_irq;
Signature · 1 line
2.37.3
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Eric Chanudet

PREEMPT_RT forces qcom-ipcc's handler to be threaded with interrupts enabled, which triggers a warning in __handle_irq_event_percpu():

    irq 173 handler irq_default_primary_handler+0x0/0x10 enabled interrupts
    WARNING: CPU: 0 PID: 77 at kernel/irq/handle.c:161 __handle_irq_event_percpu+0x4c4/0x4d0

Mark it IRQF_NO_THREAD to avoid running the handler in a threaded context with threadirqs or PREEMPT_RT enabled.

The important bit of information is that this is a IRQ-multiplexer and such it must not be threaded. Otherwise its child-interrupts would be invoked from the thread handler which is not desired.
This is noticed by PREEMPT_RT but also on a non-PREEMPT_RT kernel where `threadirqs' has been used.

Side note: Using request_irq() has the side effect that this interrupt pops-up in /proc/interrupts and the "child-interrupt", too. So you account two interrupts while "one" on the HW side occurred. Maybe irq_set_chained_handler_and_data() would be better use. Either way, this addresses the problem,

Quoted 1 line

Sebastian

#2 lore raw
Quoted 6 lines · Sebastian Andrzej Siewior
Quoted 5 lines · Eric Chanudet

PREEMPT_RT forces qcom-ipcc's handler to be threaded with interrupts enabled, which triggers a warning in __handle_irq_event_percpu():

    irq 173 handler irq_default_primary_handler+0x0/0x10 enabled interrupts
    WARNING: CPU: 0 PID: 77 at kernel/irq/handle.c:161 __handle_irq_event_percpu+0x4c4/0x4d0
Quoted 8 lines
Quoted 2 lines

Mark it IRQF_NO_THREAD to avoid running the handler in a threaded context with threadirqs or PREEMPT_RT enabled.

The important bit of information is that this is a IRQ-multiplexer and such it must not be threaded. Otherwise its child-interrupts would be invoked from the thread handler which is not desired.
This is noticed by PREEMPT_RT but also on a non-PREEMPT_RT kernel where `threadirqs' has been used.

Thank you, I will send a v2 shortly updating the description with the above.

Quoted 4 lines

Side note: Using request_irq() has the side effect that this interrupt pops-up in /proc/interrupts and the "child-interrupt", too. So you account two interrupts while "one" on the HW side occurred. Maybe irq_set_chained_handler_and_data() would be better use.

I see.

Quoted 1 line

Either way, this addresses the problem,

Signature · 1 line
Eric Chanudet