All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mailbox: qcom-ipcc: flag IRQ NO_THREAD
@ 2022-10-03 17:08 Eric Chanudet
  2022-10-04  9:41 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Chanudet @ 2022-10-03 17:08 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Manivannan Sadhasivam, Jassi Brar,
	Sebastian Andrzej Siewior
  Cc: linux-arm-msm, linux-rt-users, linux-kernel, 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.

Signed-off-by: Eric Chanudet <echanude@redhat.com>
---
 drivers/mailbox/qcom-ipcc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c
index 31d58b7d55fe..7e27acf6c0cc 100644
--- a/drivers/mailbox/qcom-ipcc.c
+++ b/drivers/mailbox/qcom-ipcc.c
@@ -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;
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mailbox: qcom-ipcc: flag IRQ NO_THREAD
  2022-10-03 17:08 [PATCH] mailbox: qcom-ipcc: flag IRQ NO_THREAD Eric Chanudet
@ 2022-10-04  9:41 ` Sebastian Andrzej Siewior
  2022-10-06 19:09   ` Eric Chanudet
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-10-04  9:41 UTC (permalink / raw)
  To: Eric Chanudet
  Cc: Andy Gross, Bjorn Andersson, Manivannan Sadhasivam, Jassi Brar,
	linux-arm-msm, linux-rt-users, linux-kernel

On 2022-10-03 13:08:49 [-0400], Eric Chanudet wrote:
> 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,

Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

> Signed-off-by: Eric Chanudet <echanude@redhat.com>

Sebastian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mailbox: qcom-ipcc: flag IRQ NO_THREAD
  2022-10-04  9:41 ` Sebastian Andrzej Siewior
@ 2022-10-06 19:09   ` Eric Chanudet
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Chanudet @ 2022-10-06 19:09 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Andy Gross, Bjorn Andersson, Manivannan Sadhasivam, Jassi Brar,
	linux-arm-msm, linux-rt-users, linux-kernel

On Tue, Oct 04, 2022 at 11:41:50AM +0200, Sebastian Andrzej Siewior wrote:
> On 2022-10-03 13:08:49 [-0400], Eric Chanudet wrote:
> > 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.

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

> 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.

> Either way, this addresses the problem,

-- 
Eric Chanudet


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-06 19:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-03 17:08 [PATCH] mailbox: qcom-ipcc: flag IRQ NO_THREAD Eric Chanudet
2022-10-04  9:41 ` Sebastian Andrzej Siewior
2022-10-06 19:09   ` Eric Chanudet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.