Message ID | 163716858508.1721911.15051495873516709923.stgit@djiang5-desk3.ch.intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | fa51b16d05583c7aebbc06330afb50276243d198 |
Headers | show |
Series | [v3] dmaengine: idxd: fix calling wq quiesce inside spinlock | expand |
On 17-11-21, 10:03, Dave Jiang wrote: > Dan reports that smatch has found idxd_wq_quiesce() is being called inside > the idxd->dev_lock. idxd_wq_quiesce() calls wait_for_completion() and > therefore it can sleep. Move the call outside of the spinlock as it does > not need device lock. Applied, thanks
diff --git a/drivers/dma/idxd/irq.c b/drivers/dma/idxd/irq.c index 17f2f8a31b63..cf2c8bc4f147 100644 --- a/drivers/dma/idxd/irq.c +++ b/drivers/dma/idxd/irq.c @@ -137,10 +137,10 @@ static int process_misc_interrupts(struct idxd_device *idxd, u32 cause) INIT_WORK(&idxd->work, idxd_device_reinit); queue_work(idxd->wq, &idxd->work); } else { - spin_lock(&idxd->dev_lock); idxd->state = IDXD_DEV_HALTED; idxd_wqs_quiesce(idxd); idxd_wqs_unmap_portal(idxd); + spin_lock(&idxd->dev_lock); idxd_device_clear_state(idxd); dev_err(&idxd->pdev->dev, "idxd halted, need %s.\n",
Dan reports that smatch has found idxd_wq_quiesce() is being called inside the idxd->dev_lock. idxd_wq_quiesce() calls wait_for_completion() and therefore it can sleep. Move the call outside of the spinlock as it does not need device lock. Fixes: 5b0c68c473a1 ("dmaengine: idxd: support reporting of halt interrupt") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> --- v3: Rebase against 5.16-rc dmaengine/fixes v2: Rebase against 5.15-rc dmaengine/fixes drivers/dma/idxd/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)