Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp499049pxj; Tue, 18 May 2021 08:05:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzljypFu1Bj16jqYlDrXVvcIIU4FtWj2UYnpuB+RgE6Okj7KRICcWff2K8lrZojkBSHRZ+5 X-Received: by 2002:a02:5d44:: with SMTP id w65mr5968627jaa.15.1621350309294; Tue, 18 May 2021 08:05:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621350309; cv=none; d=google.com; s=arc-20160816; b=F/BEISNxxfTpqAc2mOiCNy1kbeVLV4Twy6j/fHubP9aA8USPoLoUvF2r8IjRKgEMRR QdHS7mJKzRVQ6rtxLTiWNc7SIa8DxYhHivp3oA75lrN6zI/eb/uDeyWgUurM0+Kkh9Vt 9buU2UNqhQPj809TVuprU7iFWjFCtBSqqMaKujSenizrBICUspK4kt8cQ5QqQuw/8KPb paym9HwUn6IIgcMv6/vJRPe5eys0wY2BNaLfL4hgvO9SItNbDz3AhU8Z5XKda5Jh4tVl vtPoua5C4XAteed10Tj8LeIbSVwnuodm1q5ssLySBcJ/TXIJ+XUQmxkqbWDsYHt7SoSM LvSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KA0+qDGSWy5BtQ67vqh5SxWGATTSU2K4KlOAXzwefME=; b=BV0CNkVkDpmHlneDhNzD6b79JlYRSS9cV9x55nYbyHDdiQFGC3cv+vYUXy4XbLNSE1 fnhyfiPBF0BRO2q/eDKhfNw/ta0hyBcIRgjvTPxa3zt/n4Y8uqpAOhWT/o00+UtgugPe B3+utzZK97EvVkVrYNLWaHQKxCQREa5/JuC1xOMTc3fm9BiUoIx0V7AstDD/paBwmF9+ 1QpUiHTOwxM9iJcjO7nc4NYf6YlLTTRSA3SQLIaP4A3XDrGJWQt8EXy7mSWsaT8Z67S7 W47aMRCmQKEhvIakvoktACCMCeeDLiq3szzKw9bT+X3HlduNgD8bHIo3sM4aoZPjjK+s KM+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oesPYXJF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si21845861ila.81.2021.05.18.08.04.55; Tue, 18 May 2021 08:05:09 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oesPYXJF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243576AbhEQPvU (ORCPT + 99 others); Mon, 17 May 2021 11:51:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:39362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243440AbhEQPeL (ORCPT ); Mon, 17 May 2021 11:34:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6DA0A61CDB; Mon, 17 May 2021 14:39:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262356; bh=GSJrn247YqS+Cydg3phcAoa55fgNHcwrUwssH5LB8lk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oesPYXJFmBucAEItHjq9x7/yFp4YGOa6aMUtvC2ZyfIsHEAX/pdj3mPPok/wmg+v8 RASScxIEnQ4io8yl2/8bLKmjspouA/EJNjV7/EHgIZBNVbhoF12TLzpHz7Nj5rYyN4 FmzEVO7dyrXadPRmVkBMK+MPyhldL7lXHIJwVZ6k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daejun Park , Can Guo , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.10 143/289] scsi: ufs: core: Narrow down fast path in system suspend path Date: Mon, 17 May 2021 16:01:08 +0200 Message-Id: <20210517140309.961258666@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Can Guo [ Upstream commit ce4f62f9dd8cf43ac044045ed598a0b80ef33890 ] If spm_lvl is set to 0 or 1, when system suspend kicks start and HBA is runtime active, system suspend may just bail without doing anything (the fast path), leaving other contexts still running, e.g., clock gating and clock scaling. When system resume kicks start, concurrency can happen between ufshcd_resume() and these contexts, leading to various stability issues. Add a check against HBA's runtime state and allowing fast path only if HBA is runtime suspended, otherwise let system suspend go ahead call ufshcd_suspend(). This will guarantee that these contexts are stopped by either runtime suspend or system suspend. Link: https://lore.kernel.org/r/1619408921-30426-4-git-send-email-cang@codeaurora.org Fixes: 0b257734344a ("scsi: ufs: optimize system suspend handling") Reviewed-by: Daejun Park Signed-off-by: Can Guo Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/ufs/ufshcd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 96f9c81d42b2..08d4d40c510e 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8825,6 +8825,7 @@ int ufshcd_system_suspend(struct ufs_hba *hba) hba->curr_dev_pwr_mode) && (ufs_get_pm_lvl_to_link_pwr_state(hba->spm_lvl) == hba->uic_link_state) && + pm_runtime_suspended(hba->dev) && !hba->dev_info.b_rpm_dev_flush_capable) goto out; -- 2.30.2