Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4737584iob; Sun, 8 May 2022 23:47:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcK9HDYXpnKeAy22ayrISaznB4D14PN2JGWipqsfthuM5QMUvzDzaL8IBiHWadA2idd9vR X-Received: by 2002:a63:fb0a:0:b0:3c1:cd4a:4f93 with SMTP id o10-20020a63fb0a000000b003c1cd4a4f93mr12024984pgh.78.1652078828233; Sun, 08 May 2022 23:47:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652078828; cv=none; d=google.com; s=arc-20160816; b=GtKCdIfxyresXeLTO8c9cgNb5i559OZhSD+FbTApHhlHatCuMUBmOEhgRqZk3BQr/V Wb996K3iYB6ZhU/x7v0T1cCthEpvgjh94LHcl7sFuaqVMJ5hysmhs53KfRMDZH1+2zkE kUPMr/Qcze3Gb4/PvjC2C1M11MI/n2JyjvxCTQQpAIGqglFebdnvzjKU+jLt1pHibUHO VGpaUibAX49wl4qECkGLnLI7nvSoD80K4gwf7zcYKlfps3smDad021sCrIILv+wZBMjj 6j4bugxS0NlnhDUwZs8pz/zVymGytEfsVomJYC6G+gMzdHGm9A7z84k72Hi4bDu+TWhR wjPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=GQ3WGcLUJR4R5IZYfhLm4gkqs9u6U0e71oScjrmCATs=; b=w2WBxQ3cP94Ux696uOacuLaQS7Bsi90nAz7WY6qtxjFwp6xnvN5EPIidHTYNhx/tyX 4v4SWL3QEpBDInAoSacD0FzMzI3riHfYLQzPfi2qGh8g/JR0wWq2+4i90FaaQSOkfYki xJHuWe72z1U34/jt8La8cVCqFX1agd8QVDKVbWYQnd1wz4ReLoUdZD4IiV8p0bNKsSy4 dttwHwJ69t6njIMbFk2Ix0ND2xGPxo0HxT+IC/Tvu+n7SxgudY4Ea66Atea3dl6Jma1x WHkWIs47wlJjXx5LFW2ed2NJutTbtdw2w7FphGQ7bq4W0XTfePNHP3W4YgGVd+FKsQLv j2hQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u13-20020a170902e5cd00b00153b2d16596si12735189plf.414.2022.05.08.23.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 23:47:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1EAF1185C94; Sun, 8 May 2022 23:43:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1392039AbiEFMfc (ORCPT + 99 others); Fri, 6 May 2022 08:35:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391982AbiEFMfT (ORCPT ); Fri, 6 May 2022 08:35:19 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C792C5DA27; Fri, 6 May 2022 05:31:36 -0700 (PDT) Received: from fraeml710-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4KvqZH43Gfz6H7kT; Fri, 6 May 2022 20:27:03 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml710-chm.china.huawei.com (10.206.15.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 6 May 2022 14:31:34 +0200 Received: from localhost.localdomain (10.69.192.58) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 6 May 2022 13:31:32 +0100 From: John Garry To: , CC: , , , Xiang Chen , John Garry Subject: [PATCH] scsi: hisi_sas: Undo RPM resume for failed notify phy event for v3 HW Date: Fri, 6 May 2022 20:25:39 +0800 Message-ID: <1651839939-101188-1-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen 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. Tested-by: Yihang Li Reported-by: Yihang Li Signed-off-by: Xiang Chen Signed-off-by: John Garry --- Please consider for 5.19, thanks! diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 79f87d7c3e68..7d819fc0395e 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1563,9 +1563,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.26.2