From patchwork Wed Jun 14 04:31:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiwoong Kim X-Patchwork-Id: 13279527 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ED07EB64D8 for ; Wed, 14 Jun 2023 04:41:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241048AbjFNElb (ORCPT ); Wed, 14 Jun 2023 00:41:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234154AbjFNElX (ORCPT ); Wed, 14 Jun 2023 00:41:23 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CBF81BEC for ; Tue, 13 Jun 2023 21:41:22 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230614044119epoutp03b45d1335b8be2fcf085b2b299042dbf2~obMsTyujc2829028290epoutp03b for ; Wed, 14 Jun 2023 04:41:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230614044119epoutp03b45d1335b8be2fcf085b2b299042dbf2~obMsTyujc2829028290epoutp03b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1686717679; bh=ihr6uri5JQnq5ljeBYFG+iPe4bTktOiMFmEJJkwqkcE=; h=From:To:Cc:Subject:Date:In-Reply-To:In-Reply-To:References:From; b=bFPlE49MVJ/RXm2HVHQvxWaqaWjTmvPGMN7J5N2FmhSfJ+k0zt3iiVGVAoLCovJU4 wC4vDQNjfCFIYE7h0azcHdpT4NPPT12Y/zzgwRK/DBg88X9Yims++2I3EwDcI5aG9i /i5UJG8tklvepJEsh454MU9F534glLr+WeW7sp3c= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20230614044119epcas2p2c6be1e03c7bd85be9234f36986cdbf7d~obMrsFkGU0401904019epcas2p2B; Wed, 14 Jun 2023 04:41:19 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.101]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4Qgt6Q2j51z4x9Q1; Wed, 14 Jun 2023 04:41:18 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 23.DF.11450.EE449846; Wed, 14 Jun 2023 13:41:18 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20230614044117epcas2p17e84a99b4cb1ae92a922dea59a5b77a1~obMqbRR9G3163231632epcas2p1j; Wed, 14 Jun 2023 04:41:17 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230614044117epsmtrp10e51e4efe1f5fb729a7ab9ef92007ce0~obMqYxv8o3155031550epsmtrp19; Wed, 14 Jun 2023 04:41:17 +0000 (GMT) X-AuditID: b6c32a45-1dbff70000022cba-ce-648944eee364 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 06.77.28392.DE449846; Wed, 14 Jun 2023 13:41:17 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [10.229.95.128]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230614044117epsmtip1b9f314395fc3a48df4d04cdcf1ac7d4e~obMqJ4X3P0141301413epsmtip1X; Wed, 14 Jun 2023 04:41:17 +0000 (GMT) From: Kiwoong Kim To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, jejb@linux.ibm.com, martin.petersen@oracle.com, beanhuo@micron.com, adrian.hunter@intel.com, sc.suh@samsung.com, hy50.seo@samsung.com, sh425.lee@samsung.com, kwangwon.min@samsung.com, junwoo80.lee@samsung.com, wkon.kim@samsung.com Cc: Kiwoong Kim Subject: [PATCH v3 1/2] ufs: make __ufshcd_send_uic_cmd not wrapped by host_lock Date: Wed, 14 Jun 2023 13:31:55 +0900 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAJsWRmVeSWpSXmKPExsWy7bCmue47l84Ug5/TBCxOPlnDZvFg3jY2 i5c/r7JZHHzYyWIx7cNPZovVix+wWCy6sY3JYtffZiaLrTd2sljc3HKUxeLyrjlsFt3Xd7BZ LD/+j8mi6+4NRoul/96yWGy+9I3FQcDj8hVvj8V7XjJ5TFh0gNHj+/oONo+PT2+xePRtWcXo 8XmTnEf7gW6mAI6obJuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUX nwBdt8wcoA+UFMoSc0qBQgGJxcVK+nY2RfmlJakKGfnFJbZKqQUpOQXmBXrFibnFpXnpenmp JVaGBgZGpkCFCdkZn+/NYCn4zFcx98oZ1gbGQzxdjJwcEgImEtN3XmXrYuTiEBLYwSixesI8 RgjnE6PEkZkvWSCcz4wSM+ZdZ4VpufrsFxNEYhejxJuuL1AtPxglWpr62EGq2AQ0JZ7enApW JSLwgUni//JtjCAJZgF1iV0TTjCB2MICQRJbZj9iA7FZBFQlzs9fCVbDKxAtsWbjTzaIdXIS N891MoPYnAKWEvu2r2RDZXMA1SzkkDisClHuIjG16xDUpcISr45vYYewpSRe9rexQ5RnS+xZ KAYRrpBYPO0tC4RtLDHrWTsjSAkz0Pnrd+lDV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JO4ea4T rIZTwFJi3/aVYHEhAQuJFcc2MeISn8AosICRYRWjZGpBcW56brFhgVFearlecWJucWleul5y fu4mRnB8aGntYNyz6oPeIUYmDsZDjBIczEoivE812lOEeFMSK6tSi/Lji0pzUosPMUpzsCiJ 817oOhkvJJCeWJKanZpakFoEk2Xi4JRqYJJrNAmKjb5ncvBJi3Zm+Je9k9mmX/Dw1+I46Wey Ynbp//rqE9c2TJ/D66z/4kUQp7PH6yDRxX0JkrzdLTNWqyvotp2zKti64OsHwTn1+ssmnNmY 1bD1c09Xge6tgshOl1nL9W7M5m9/tPyVFdtLF+F/av/jPubqsemaSxs/T9Lt+Df/kVjS/xUf 5k79eiD1pcnkCy23vt35JfPSe7eqp4qfmNiODVKe+pwe+0rPhAolvfQ/bn9aKyH5sdmRB3pf jLWV/K6tmarm71tut6ZlTwTrsYcfYtPXOS/Zr+l+VLbrKveU0kLedztmfr2y0MCy7L5dh+6y 4q4qV21nl4N9ue8U3lz6xntP75nsXelHIUosxRmJhlrMRcWJAFu9BoH+AgAA X-CMS-MailID: 20230614044117epcas2p17e84a99b4cb1ae92a922dea59a5b77a1 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230614044117epcas2p17e84a99b4cb1ae92a922dea59a5b77a1 References: Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org __ufshcd_send_uic_cmd is wrapped uic_cmd_mutex and its related contexts are accessed within the period wrappted by uic_cmd_mutex. Thus, wrapping with host_lock is redundant. Signed-off-by: Kiwoong Kim Reviewed-by: Bart Van Assche --- drivers/ufs/core/ufshcd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 9434328..a89d39a 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2457,7 +2457,6 @@ __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd, bool completion) { lockdep_assert_held(&hba->uic_cmd_mutex); - lockdep_assert_held(hba->host->host_lock); if (!ufshcd_ready_for_uic_cmd(hba)) { dev_err(hba->dev, @@ -2484,7 +2483,6 @@ __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd, int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) { int ret; - unsigned long flags; if (hba->quirks & UFSHCD_QUIRK_BROKEN_UIC_CMD) return 0; @@ -2493,9 +2491,7 @@ int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) mutex_lock(&hba->uic_cmd_mutex); ufshcd_add_delay_before_dme_cmd(hba); - spin_lock_irqsave(hba->host->host_lock, flags); ret = __ufshcd_send_uic_cmd(hba, uic_cmd, true); - spin_unlock_irqrestore(hba->host->host_lock, flags); if (!ret) ret = ufshcd_wait_for_uic_cmd(hba, uic_cmd); @@ -4180,8 +4176,8 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd) wmb(); reenable_intr = true; } - ret = __ufshcd_send_uic_cmd(hba, cmd, false); spin_unlock_irqrestore(hba->host->host_lock, flags); + ret = __ufshcd_send_uic_cmd(hba, cmd, false); if (ret) { dev_err(hba->dev, "pwr ctrl cmd 0x%x with mode 0x%x uic error %d\n",