dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: idxd: fix calling wq quiesce inside spinlock
@ 2021-08-24 17:07 Dave Jiang
  2021-08-26 16:34 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Jiang @ 2021-08-24 17:07 UTC (permalink / raw)
  To: vkoul; +Cc: Dan Carpenter, dmaengine

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.

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>
---
 drivers/dma/idxd/irq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/idxd/irq.c b/drivers/dma/idxd/irq.c
index 4e3a7198c0ca..70705f0bd92c 100644
--- a/drivers/dma/idxd/irq.c
+++ b/drivers/dma/idxd/irq.c
@@ -189,8 +189,8 @@ 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_bh(&idxd->dev_lock);
 			idxd_wqs_quiesce(idxd);
+			spin_lock_bh(&idxd->dev_lock);
 			idxd_wqs_unmap_portal(idxd);
 			idxd_device_wqs_clear_state(idxd);
 			dev_err(&idxd->pdev->dev,



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

* Re: [PATCH] dmaengine: idxd: fix calling wq quiesce inside spinlock
  2021-08-24 17:07 [PATCH] dmaengine: idxd: fix calling wq quiesce inside spinlock Dave Jiang
@ 2021-08-26 16:34 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2021-08-26 16:34 UTC (permalink / raw)
  To: Dave Jiang; +Cc: Dan Carpenter, dmaengine

On 24-08-21, 10:07, 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.

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2021-08-26 16:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 17:07 [PATCH] dmaengine: idxd: fix calling wq quiesce inside spinlock Dave Jiang
2021-08-26 16:34 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).