Skip to contentSkip to conversation

accel/ivpu: Drop IRQF_ONESHOT to allow IPC IRQ threading on PREEMPT_RT

PATCH In review Karol Wachowski 2 participants 2 messages Jun 17

Subsystems (2)
lore
Share & tools
lore

Karol Wachowski

author maintainer
#0 lore raw

PATCH 1/1 accel/ivpu: Drop IRQF_ONESHOT to allow IPC IRQ threading on PREEMPT_RT

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 <[email protected]>
Cc Karol Wachowski <[email protected]>
---
 drivers/accel/ivpu/ivpu_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_drv.c +1 -1
index 6b34c52b1fba..95120957f42a 100644
@@ -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);
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Karol Wachowski

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 <[email protected]>
Cc Karol Wachowski <[email protected]>
---
  drivers/accel/ivpu/ivpu_drv.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_drv.c +0 -0
index 6b34c52b1fba..95120957f42a 100644

drivers/accel/ivpu/ivpu_drv.c static int ivpu_irq_init(struct ivpu_device *vdev) · line 629

Quoted 8 lines
drivers/accel/ivpu/ivpu_drv.c +1 -1
@@ -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);