From patchwork Tue Oct 27 13:55:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 307140 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A49AC61DD8 for ; Tue, 27 Oct 2020 17:25:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F6DD21D42 for ; Tue, 27 Oct 2020 17:25:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603819548; bh=WLp/7ApDJMvNYaMBO/CNLukKMpcK9SehLbW5shjh7Jk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=y6iVvzVl+evi26H+kT7qHb4V5cZzDHh+7kTUzNd98JyjuUeKV7hL0CstGcSthtoxH muF+nmQzduV1AjVMwiMaTsdLHtDdCmTvGuOOb5QxR9n2tsj/G1S5ULwnVvjsHycI2H Dq1fSLx6JHSoCpjauFgYkIIsrKFqQAcVVddUKkps= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1776197AbgJ0Oxa (ORCPT ); Tue, 27 Oct 2020 10:53:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:46634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764327AbgJ0Oqo (ORCPT ); Tue, 27 Oct 2020 10:46:44 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 987172225E; Tue, 27 Oct 2020 14:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810004; bh=WLp/7ApDJMvNYaMBO/CNLukKMpcK9SehLbW5shjh7Jk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=shPQT2SkkbBkfizXAZtfEGXi0voA0qrD1/EqACjkAgN+u4nfTGvekvC5MoVB73FON xBICkjxvdYYZLmj5eo8JFO/tjM/TvD9FDx8ppS174bKsaf265yI8WeeluLDaEjXC83 Hnqug9ioI1Hwf+p4pMGaRUvbQtra/RffT9fDZtg8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hongwu Su , Avri Altman , Bean Huo , Asutosh Das , Can Guo , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.4 396/408] scsi: ufs: ufs-qcom: Fix race conditions caused by ufs_qcom_testbus_config() Date: Tue, 27 Oct 2020 14:55:34 +0100 Message-Id: <20201027135513.363364601@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Can Guo [ Upstream commit 89dd87acd40a44de8ff3358138aedf8f73f4efc6 ] 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 a race condition. Fix this by removing the unnecessary calls of pm_runtime_get_sync() and ufshcd_hold(). Link: https://lore.kernel.org/r/1596975355-39813-3-git-send-email-cang@codeaurora.org Reviewed-by: Hongwu Su Reviewed-by: Avri Altman Reviewed-by: Bean Huo Reviewed-by: Asutosh Das Signed-off-by: Can Guo Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- 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 c49e9f6c46f87..4f066e3b19af1 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1492,9 +1492,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); @@ -1507,8 +1504,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; }