Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp987466ybh; Wed, 22 Jul 2020 19:35:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDpI96mxaTKLgLM5BByYDVJccejSDweudTL0fIrLWk+pQ6xbBU9QcA5o/wg2YY3l28lg7g X-Received: by 2002:a17:906:7c8:: with SMTP id m8mr2273739ejc.527.1595471706737; Wed, 22 Jul 2020 19:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595471706; cv=none; d=google.com; s=arc-20160816; b=iyc81Jlf+F8ddQ1Iji/bDjhPg1OoAhK49O9KJR66Nd/1i9DYh2FcK1O1M69IjHFoWS 3RPRAWU21Qun+Ivf8TYSyDn8ikj+qL21Zbzl8DfyN1wMdsSBTutq2OlkKJA3V7f2MwY+ BRmorgUzwJpBrWjjGstAN9WXF7ZVc+Eu6DeUt4z/Z65tL+4GuCHEoiof5Be2P5iHZ38U 0uu6dCe3l8zF76bSdNFNH9pRKYwKVw//qaLQm/wT/BKDzjxzhWt4TtrXG/LdwLOFaO9+ 9sw+haj3olWtt0g7jh+Xv7/L1FSLtNt5gcEQYvmX1+fVhSNAjegG9gItTUhv52JKY/zI ZCEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr; bh=DU67OMwSXmlZuHKYDggHvVVnsFajs5h4u9ovnTDH8a0=; b=J4W2KVkOg2oFJBgbCH/v+jPmyZ5/PZ7c260n7+2qOVfK8ocQapoGFbItLDEQInoYe6 w9cr8mPN4lntg+p3CWU67Y/oPzkI7/SVxKuZVTJ2FyvCJzHO3nNBhk1ttPKWokF037Et FIMTxD3IvQjAIltQCVEc+jB8wTuULOVv36vLN052HgXMBbaQqGC5Erd8WxBvGCZ63gkA PAAIsE3mb7+ynFJ9rDFEumL4oayt93ZkK0sWabSM/07mWqkdKplKAuB778NuGP0R7sh0 XtT+qCI2MZJl5vbjrir7Gj0udLia9ZPkhfxQVpHXsjpPyuYtwuRkmtIwe8CnNPjIfO4C uGSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o21si1033234ejg.550.2020.07.22.19.34.44; Wed, 22 Jul 2020 19:35:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387514AbgGWCeY (ORCPT + 99 others); Wed, 22 Jul 2020 22:34:24 -0400 Received: from labrats.qualcomm.com ([199.106.110.90]:37589 "EHLO labrats.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387483AbgGWCeY (ORCPT ); Wed, 22 Jul 2020 22:34:24 -0400 IronPort-SDR: +CwSSzEVROfjEbwSccSiEnoU/6BReWG4pBdQdpKI4kzYJjDhT7wosgAwN4RpWStNTncQC2t1Gm WVza9yxg+sw8B0TNgJmfbb7j9iQSlqF6k7bnazOFHwlRTjHmoS4gtJVBE9+wZhMGwKtcQmueR9 Qkv68hFPHykTVt7cgqwULajs+OyJpFVebWoSi9QDxziz2Ptev621nYXtfWZ4/CAcMZ80Or0urt bcExaKu0CDOdq8Aahn1dwlSFgxAFaLq2CrXY0nHxfePb7PBxvbg4YrfTqJtQ+utXueGNtkn2mg h1Q= X-IronPort-AV: E=Sophos;i="5.75,385,1589266800"; d="scan'208";a="29047795" Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by labrats.qualcomm.com with ESMTP; 22 Jul 2020 19:34:23 -0700 Received: from pacamara-linux.qualcomm.com ([192.168.140.135]) by ironmsg-SD-alpha.qualcomm.com with ESMTP; 22 Jul 2020 19:34:21 -0700 Received: by pacamara-linux.qualcomm.com (Postfix, from userid 359480) id 3482A22A4D; Wed, 22 Jul 2020 19:34:20 -0700 (PDT) From: Can Guo To: asutoshd@codeaurora.org, nguyenb@codeaurora.org, hongwus@codeaurora.org, rnayak@codeaurora.org, sh425.lee@samsung.com, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, cang@codeaurora.org Cc: Andy Gross , Bjorn Andersson , Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , linux-arm-msm@vger.kernel.org (open list:ARM/QUALCOMM SUPPORT), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v5 3/9] ufs: ufs-qcom: Fix race conditions caused by func ufs_qcom_testbus_config Date: Wed, 22 Jul 2020 19:34:02 -0700 Message-Id: <1595471649-25675-4-git-send-email-cang@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595471649-25675-1-git-send-email-cang@codeaurora.org> References: <1595471649-25675-1-git-send-email-cang@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If ufs_qcom_dump_dbg_regs() calls ufs_qcom_testbus_config() from ufshcd_suspend/resume and/or clk gate/ungate context, pm_runtime_get_sync() and ufshcd_hold() will cause racing problems. Fix this by removing the unnecessary calls of pm_runtime_get_sync() and ufshcd_hold(). Signed-off-by: Can Guo --- drivers/scsi/ufs/ufs-qcom.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 2e6ddb5..7da27ee 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1604,9 +1604,6 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host) */ } mask <<= offset; - - pm_runtime_get_sync(host->hba->dev); - ufshcd_hold(host->hba, false); ufshcd_rmwl(host->hba, TEST_BUS_SEL, (u32)host->testbus.select_major << 19, REG_UFS_CFG1); @@ -1619,8 +1616,6 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host) * committed before returning. */ mb(); - ufshcd_release(host->hba); - pm_runtime_put_sync(host->hba->dev); return 0; } -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.