On kernels with PREEMPT_RT enabled, a "BUG: scheduling while atomic"
kernel oops occurs inside dw100_irq_handler -> vb2_buffer_done. This is
because vb2_buffer_done takes a spinlock which is not allowed within
interrupt context on PREEMPT_RT.
Fix that by dropping the IRQF_ONESHOT flag. There was only a hard
interrupt handler specified anyways, so IRQF_ONESHOT didn't have any
effect on non PREEMPT_RT systems. On PREEMPT_RT systems the interrupt
handler is automatically changed to threaded and the IRQF_ONESHOT flag
get's set internally.
There is one caveat though: During development regular "dw100
32e30000.dwe: Interrupt error: 0x1" errors occurred due to
DW100_INTERRUPT_STATUS_INT_ERR_TIME_OUT being set. This only happened on
non PREEMPT_RT setups when the interrupt handler was manually forced to
be threaded. On PREEMPT_RT systems (where the interrupt handler is now
implicitly threaded) this error was never seen.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
Changes in v2:
- Dropped the IRQF_ONESHOT instead of making the interrupt handler
threaded to fix the issue.
- I didn't keep the r-by tag from Nicolas as the solution is now a
different one.
---
drivers/media/platform/nxp/dw100/dw100.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/nxp/dw100/dw100.c b/drivers/media/platform/nxp/dw100/dw100.c
index d2b1c62b52db47ea1d2242caaf334fff30c6f366..4c8be66f87519b36b2273ecf3f34eab03c5e6738 100644
--- a/drivers/media/platform/nxp/dw100/dw100.c
+++ b/drivers/media/platform/nxp/dw100/dw100.c
@@ -1593,7 +1593,7 @@ static int dw100_probe(struct platform_device *pdev)
pm_runtime_put_sync(&pdev->dev);
- ret = devm_request_irq(&pdev->dev, irq, dw100_irq_handler, IRQF_ONESHOT,
+ ret = devm_request_irq(&pdev->dev, irq, dw100_irq_handler, 0,
dev_name(&pdev->dev), dw_dev);
if (ret < 0) {
dev_err(&pdev->dev, "Failed to request irq: %d\n", ret);
--
2.51.0