Message ID | 20230424080400.8955-1-alice.chao@mediatek.com |
---|---|
State | Superseded |
Headers | show |
Series | [v3,1/1] scsi: ufs: core: Fix &hwq->cq_lock deadlock issue | expand |
Alice, > When ufshcd_err_handler() is executed, CQ event interrupt can enter > waiting for the same lock. It could happened in upstream code path > ufshcd_handle_mcq_cq_events() and also in ufs_mtk_mcq_intr(). This > warning message will be generated when &hwq->cq_lock is used in IRQ > context with IRQ enabled. Use ufshcd_mcq_poll_cqe_lock() with > spin_lock_irqsave instead of spin_lock to resolve the deadlock issue. Applied to 6.4/scsi-staging, thanks!
diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c index 31df052fbc41..202ff71e1b58 100644 --- a/drivers/ufs/core/ufs-mcq.c +++ b/drivers/ufs/core/ufs-mcq.c @@ -299,11 +299,11 @@ EXPORT_SYMBOL_GPL(ufshcd_mcq_poll_cqe_nolock); unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba, struct ufs_hw_queue *hwq) { - unsigned long completed_reqs; + unsigned long completed_reqs, flags; - spin_lock(&hwq->cq_lock); + spin_lock_irqsave(&hwq->cq_lock, flags); completed_reqs = ufshcd_mcq_poll_cqe_nolock(hba, hwq); - spin_unlock(&hwq->cq_lock); + spin_unlock_irqrestore(&hwq->cq_lock, flags); return completed_reqs; }