All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] accel/ivpu: Drop IRQF_ONESHOT to allow IPC IRQ threading on PREEMPT_RT
@ 2026-06-17  9:20 Karol Wachowski
  2026-06-17  9:30 ` Andrzej Kacprowski
  0 siblings, 1 reply; 2+ messages in thread
From: Karol Wachowski @ 2026-06-17  9:20 UTC (permalink / raw)
  To: dri-devel; +Cc: Karol Wachowski, Andrzej Kacprowski

The IPC RX hardirq handler matches consumers under a spinlock and
allocates rx_msg buffers. On PREEMPT_RT these spinlocks become sleeping
locks and the allocation may sleep, neither of which is allowed in true
hardirq context, resulting in "sleeping function called from invalid
context" splats.

IRQF_ONESHOT makes genirq keep the primary handler in hardirq even when
forced threading is enabled, so on PREEMPT_RT the handler cannot be
threaded. Drop the flag so the primary handler is threaded on PREEMPT_RT
and the IPC RX path runs in a context where sleeping is allowed. On the
MSI interrupt chip (IRQCHIP_ONESHOT_SAFE) the flag was stripped anyway,
so non-RT behaviour is unchanged.

Fixes: 85c9cc2d25f8 ("accel/ivpu: Use threaded IRQ for IPC callback processing")
Cc: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
Cc: Karol Wachowski <karol.wachowski@linux.intel.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
---
 drivers/accel/ivpu/ivpu_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c
index 6b34c52b1fba..95120957f42a 100644
--- a/drivers/accel/ivpu/ivpu_drv.c
+++ b/drivers/accel/ivpu/ivpu_drv.c
@@ -623,7 +623,7 @@ static int ivpu_irq_init(struct ivpu_device *vdev)
 	vdev->irq = pci_irq_vector(pdev, 0);
 
 	ret = devm_request_threaded_irq(vdev->drm.dev, vdev->irq, ivpu_hw_irq_handler,
-					ivpu_ipc_irq_thread_handler, IRQF_NO_AUTOEN | IRQF_ONESHOT,
+					ivpu_ipc_irq_thread_handler, IRQF_NO_AUTOEN,
 					DRIVER_NAME, vdev);
 	if (ret)
 		ivpu_err(vdev, "Failed to request an IRQ %d\n", ret);
-- 
2.43.0


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

* Re: [PATCH] accel/ivpu: Drop IRQF_ONESHOT to allow IPC IRQ threading on PREEMPT_RT
  2026-06-17  9:20 [PATCH] accel/ivpu: Drop IRQF_ONESHOT to allow IPC IRQ threading on PREEMPT_RT Karol Wachowski
@ 2026-06-17  9:30 ` Andrzej Kacprowski
  0 siblings, 0 replies; 2+ messages in thread
From: Andrzej Kacprowski @ 2026-06-17  9:30 UTC (permalink / raw)
  To: Karol Wachowski, dri-devel

On 17-Jun-26 11:20 AM, Karol Wachowski wrote:
> The IPC RX hardirq handler matches consumers under a spinlock and
> allocates rx_msg buffers. On PREEMPT_RT these spinlocks become sleeping
> locks and the allocation may sleep, neither of which is allowed in true
> hardirq context, resulting in "sleeping function called from invalid
> context" splats.
> 
> IRQF_ONESHOT makes genirq keep the primary handler in hardirq even when
> forced threading is enabled, so on PREEMPT_RT the handler cannot be
> threaded. Drop the flag so the primary handler is threaded on PREEMPT_RT
> and the IPC RX path runs in a context where sleeping is allowed. On the
> MSI interrupt chip (IRQCHIP_ONESHOT_SAFE) the flag was stripped anyway,
> so non-RT behaviour is unchanged.
> 
> Fixes: 85c9cc2d25f8 ("accel/ivpu: Use threaded IRQ for IPC callback processing")
> Cc: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
> Cc: Karol Wachowski <karol.wachowski@linux.intel.com>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
> ---
>   drivers/accel/ivpu/ivpu_drv.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c
> index 6b34c52b1fba..95120957f42a 100644
> --- a/drivers/accel/ivpu/ivpu_drv.c
> +++ b/drivers/accel/ivpu/ivpu_drv.c
> @@ -623,7 +623,7 @@ static int ivpu_irq_init(struct ivpu_device *vdev)
>   	vdev->irq = pci_irq_vector(pdev, 0);
>   
>   	ret = devm_request_threaded_irq(vdev->drm.dev, vdev->irq, ivpu_hw_irq_handler,
> -					ivpu_ipc_irq_thread_handler, IRQF_NO_AUTOEN | IRQF_ONESHOT,
> +					ivpu_ipc_irq_thread_handler, IRQF_NO_AUTOEN,
>   					DRIVER_NAME, vdev);
>   	if (ret)
>   		ivpu_err(vdev, "Failed to request an IRQ %d\n", ret);

Reviewed-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>

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

end of thread, other threads:[~2026-06-17  9:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-17  9:20 [PATCH] accel/ivpu: Drop IRQF_ONESHOT to allow IPC IRQ threading on PREEMPT_RT Karol Wachowski
2026-06-17  9:30 ` Andrzej Kacprowski

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.