diff mbox series

[v4,5/5] scsi: ufs: Do not free irq in suspend

Message ID 1573624824-671-6-git-send-email-cang@codeaurora.org (mailing list archive)
State Superseded
Headers show
Series UFS driver general fixes bundle 1 | expand

Commit Message

Can Guo Nov. 13, 2019, 6 a.m. UTC
If PM QoS is enabled and we set request type to PM_QOS_REQ_AFFINE_IRQ then
freeing up the irq makes the free_irq() print out warning with call stack.
We don't really need to free up irq during suspend, disabling it during
suspend and reenabling it during resume should be good enough.

Signed-off-by: Can Guo <cang@codeaurora.org>
---
 drivers/scsi/ufs/ufshcd.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

Comments

Avri Altman Nov. 20, 2019, 3:36 p.m. UTC | #1
> 
> If PM QoS is enabled and we set request type to PM_QOS_REQ_AFFINE_IRQ
> then freeing up the irq makes the free_irq() print out warning with call stack.
> We don't really need to free up irq during suspend, disabling it during suspend
> and reenabling it during resume should be good enough.
> 
> Signed-off-by: Can Guo <cang@codeaurora.org>
Your approach seems reasonable,
However I failed to locate in the kernel PM_QOS_REQ_AFFINE_IRQ,
Just in codeaurora.

Is the WARN_ON in free_irq still applies?

Thanks,
Avri
Can Guo Nov. 25, 2019, 7:43 a.m. UTC | #2
On 2019-11-20 23:36, Avri Altman wrote:
>> 
>> If PM QoS is enabled and we set request type to PM_QOS_REQ_AFFINE_IRQ
>> then freeing up the irq makes the free_irq() print out warning with 
>> call stack.
>> We don't really need to free up irq during suspend, disabling it 
>> during suspend
>> and reenabling it during resume should be good enough.
>> 
>> Signed-off-by: Can Guo <cang@codeaurora.org>
> Your approach seems reasonable,
> However I failed to locate in the kernel PM_QOS_REQ_AFFINE_IRQ,
> Just in codeaurora.
> 
> Is the WARN_ON in free_irq still applies?
> 
> Thanks,
> Avri

Hi Avri,

Thanks for pointing. It seems PM_QOS_REQ_AFFINE_IRQ is not present
on upstream yet. But this change is still applicable.
How about changing the commit message to below?

"Since ufshcd irq resource is allocated with the device resource
management aware IRQ request implementation, we don't really need
to free up irq during suspend, disabling it during suspend and
reenabling it during resume should be good enough."

Thanks,
Can Guo
Avri Altman Nov. 25, 2019, 7:45 a.m. UTC | #3
> 
> On 2019-11-20 23:36, Avri Altman wrote:
> >>
> >> If PM QoS is enabled and we set request type to PM_QOS_REQ_AFFINE_IRQ
> >> then freeing up the irq makes the free_irq() print out warning with
> >> call stack.
> >> We don't really need to free up irq during suspend, disabling it
> >> during suspend and reenabling it during resume should be good enough.
> >>
> >> Signed-off-by: Can Guo <cang@codeaurora.org>
> > Your approach seems reasonable,
> > However I failed to locate in the kernel PM_QOS_REQ_AFFINE_IRQ, Just
> > in codeaurora.
> >
> > Is the WARN_ON in free_irq still applies?
> >
> > Thanks,
> > Avri
> 
> Hi Avri,
> 
> Thanks for pointing. It seems PM_QOS_REQ_AFFINE_IRQ is not present on
> upstream yet. But this change is still applicable.
> How about changing the commit message to below?
> 
> "Since ufshcd irq resource is allocated with the device resource management
> aware IRQ request implementation, we don't really need to free up irq during
> suspend, disabling it during suspend and reenabling it during resume should be
> good enough."

Looks good to me.
Thanks,
Avri

> 
> Thanks,
> Can Guo
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 086d359..c449b68 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -266,26 +266,18 @@  static inline bool ufshcd_valid_tag(struct ufs_hba *hba, int tag)
 	return tag >= 0 && tag < hba->nutrs;
 }
 
-static inline int ufshcd_enable_irq(struct ufs_hba *hba)
+static inline void ufshcd_enable_irq(struct ufs_hba *hba)
 {
-	int ret = 0;
-
 	if (!hba->is_irq_enabled) {
-		ret = request_irq(hba->irq, ufshcd_intr, IRQF_SHARED, UFSHCD,
-				hba);
-		if (ret)
-			dev_err(hba->dev, "%s: request_irq failed, ret=%d\n",
-				__func__, ret);
+		enable_irq(hba->irq);
 		hba->is_irq_enabled = true;
 	}
-
-	return ret;
 }
 
 static inline void ufshcd_disable_irq(struct ufs_hba *hba)
 {
 	if (hba->is_irq_enabled) {
-		free_irq(hba->irq, hba);
+		disable_irq(hba->irq);
 		hba->is_irq_enabled = false;
 	}
 }
@@ -7930,9 +7922,7 @@  static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 		goto out;
 
 	/* enable the host irq as host controller would be active soon */
-	ret = ufshcd_enable_irq(hba);
-	if (ret)
-		goto disable_irq_and_vops_clks;
+	ufshcd_enable_irq(hba);
 
 	ret = ufshcd_vreg_set_hpm(hba);
 	if (ret)