From 40b769493ef587495b958ae4ba171534f4f627cb Mon Sep 17 00:00:00 2001 From: Xiang Chen Date: Tue, 15 Nov 2022 23:03:45 +0800 Subject: [PATCH 092/108] scsi: hisi_sas: Undo RPM resume for failed notify phy event for v3 HW mainline inclusion from mainline-v5.19-rc1 commit 9b5387fe5af38116b452259d87cd66594b6277c1 category: feature bugzilla: https://gitee.com/src-openeuler/kernel/issues/I8F803 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9b5387fe5af38116b452259d87cd66594b6277c1 ---------------------------------------------------------------------- If we fail to notify the phy up event then undo the RPM resume, as the phy up notify event handling pairs with that RPM resume. Link: https://lore.kernel.org/r/1651839939-101188-1-git-send-email-john.garry@huawei.com Reported-by: Yihang Li Tested-by: Yihang Li Signed-off-by: Xiang Chen Signed-off-by: John Garry Signed-off-by: Martin K. Petersen Signed-off-by: xiabing Reviewed-by: Xiang Chen Reviewed-by: Jason Yan Signed-off-by: Zheng Zengkai Signed-off-by: YunYi Yang --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index d56bca524f79..e1c327dedb97 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1717,9 +1717,15 @@ static irqreturn_t phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba) phy->port_id = port_id; - /* Call pm_runtime_put_sync() with pairs in hisi_sas_phyup_pm_work() */ + /* + * Call pm_runtime_get_noresume() which pairs with + * hisi_sas_phyup_pm_work() -> pm_runtime_put_sync(). + * For failure call pm_runtime_put() as we are in a hardirq context. + */ pm_runtime_get_noresume(dev); - hisi_sas_notify_phy_event(phy, HISI_PHYE_PHY_UP_PM); + res = hisi_sas_notify_phy_event(phy, HISI_PHYE_PHY_UP_PM); + if (!res) + pm_runtime_put(dev); res = IRQ_HANDLED; -- 2.27.0