Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp237947pxu; Fri, 11 Dec 2020 00:46:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxXv7cElUW2JocwFJJ19TXrzJDgitKcdPcbl8TDvYU0cPjJDpZjPcQDt7MphEBXDiU0KF5 X-Received: by 2002:a50:b002:: with SMTP id i2mr10657221edd.99.1607676382654; Fri, 11 Dec 2020 00:46:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607676382; cv=none; d=google.com; s=arc-20160816; b=SdKb2p1TtNAB70K8OzOd7nk79t0aHu8JSHVOfTSA/gtVTnjElV+vv/dleUsPNWyJo/ w1Rc8zk9FJp62zPxumVTCcUsE677HZtHOhwxjs+AHN1QsN6vZx/xWe6zAY59G97/Zr0F nVsCz3qRbepLb0Cbpj28fFXE+RfI4upQIXpSFBYk93Cb08O5vGo8JUPLxA+alEr6E4xN 2LtrvmnwIBXwOP4rU5+osbsu6UpHT0qKQTF2FM+dBv+EuoO3eiDwfOKDnFROpwo4HC7a 3S7/lbQRZhWUC39qUdS7OuK7Gx/BHQFV9R/i7TWseDqrQpNLFX3+XUQqf1w3+1dcx4o2 i3tg== 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 :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=FEqXylzJnhyP5wm7scZDvKf6/krakNPXkfWkNPRzS5k=; b=PUqxdMDPvSONAb3gbLcUeNX2T8Cwf5fWFgVREmjQQtqf+9pDsaRiw4JsEj238gNR60 7F2Vzg+EkF5yUYI2ohYR5uu3POoQmQjAsprbP9fDR/Pfkyf5/0JvvAc1lZjYKX4+cbQo KcVZqGuyATOlm3v6HxaYRCnG2AHH8AxmzM2mmjaD1p0vpHSSSvyLoMpl8089yfXUYecF 60xIg1zf8EZOXtBX+yaZaBZcXs6LW+pz+MzoZBTfqUpvVtn0nmAQObotDKrMgDVuxB/e uRg8tqd/oWSDfpzMnFc8V34JUW/+VMZhIhzIPV/nxAE2dPKYbiC+woqGLpTxuMdOsblC 4zqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RZ6uskt9; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si4862928edv.324.2020.12.11.00.45.57; Fri, 11 Dec 2020 00:46:22 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=RZ6uskt9; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392709AbgLJRft (ORCPT + 99 others); Thu, 10 Dec 2020 12:35:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392789AbgLJRfc (ORCPT ); Thu, 10 Dec 2020 12:35:32 -0500 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 159DFC0613CF; Thu, 10 Dec 2020 09:34:52 -0800 (PST) Received: by mail-ed1-x541.google.com with SMTP id c7so6402793edv.6; Thu, 10 Dec 2020 09:34:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=FEqXylzJnhyP5wm7scZDvKf6/krakNPXkfWkNPRzS5k=; b=RZ6uskt9xr3e73phy2hVIm7xogs/sSJRj9aVgfwfKPhUQiuCuQxKV+lrv4qyAADMgN e4KLOrS3fuIIbeKqYGrWJCpNoVVU/M5AkqA5Y3A6XbRcaP4cuHr9m7T2BVULH/Rw4KnP 9KADwlRA0XcyPhIbn54RJ1kN6vaq4n2111LKBqJPiKZI289JbjEWv7Dyq4y922uQqY8D EDJO//nfZPUg7XFoAdGEXuNCq024czb7PBKhN9N1GowqxgE+4TG0KnExr240VdAl6noy cnUCp+yOG6km+gLW3KWTFgSpBvvAJuaTRlrfmudTxaq0bt49kgNoba/08VTn4vXkXArO mddQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=FEqXylzJnhyP5wm7scZDvKf6/krakNPXkfWkNPRzS5k=; b=GELAmEGPgMZyF6wWykNrIiEICc5cHKtXOirOVDq8RYkE4+av2AbjbcT8RhLF+xmCAv 5lu5kX5NpFho5D9DPq/ANuiPNNNhb7JTY/JToOCgmedCIS1QR1f3My2TJyMMJA4WLIaG 6nC5Ak6axfI805PhHJtTxmFgz+k5w0zEupu30Isf41HQWFWOtRZGKryC5aQP2hMghc7i gWIDzcLZfAeErj4EjQY1SWRFuqDQjYZxeQCMLArwBEoqVUsfEIAeVDPbo0Lts9Sf1WSZ TfslMmOrYMnDrfoD/TNWz4SFsNc8InvSmhXnRWa0fxmtCRpfRG9ahaCbiuuqTNmlrUlT sPIQ== X-Gm-Message-State: AOAM531kkBwSpCQxKhn0/Rx0BZb0CTwFB5OHc56qtFxj+I21RvdSBL1g uC+2UvNrE0Rcih7KsIXKqmU= X-Received: by 2002:a50:8741:: with SMTP id 1mr7971377edv.349.1607621690847; Thu, 10 Dec 2020 09:34:50 -0800 (PST) Received: from ubuntu-laptop (ip5f5bfce9.dynamic.kabel-deutschland.de. [95.91.252.233]) by smtp.googlemail.com with ESMTPSA id 2sm4883388ejw.65.2020.12.10.09.34.49 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Dec 2020 09:34:50 -0800 (PST) Message-ID: Subject: Re: [PATCH 1/2] scsi: ufs: Protect some contexts from unexpected clock scaling From: Bean Huo To: Can Guo , asutoshd@codeaurora.org, nguyenb@codeaurora.org, hongwus@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com Cc: Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Bart Van Assche , Satya Tangirala , open list Date: Thu, 10 Dec 2020 18:34:49 +0100 In-Reply-To: <1607520942-22254-2-git-send-email-cang@codeaurora.org> References: <1607520942-22254-1-git-send-email-cang@codeaurora.org> <1607520942-22254-2-git-send-email-cang@codeaurora.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Can On Wed, 2020-12-09 at 05:35 -0800, Can Guo wrote: > > > @@ -1160,6 +1166,7 @@ static void > ufshcd_clock_scaling_unprepare(struct ufs_hba *hba) > { > up_write(&hba->clk_scaling_lock); > ufshcd_scsi_unblock_requests(hba); > + ufshcd_release(hba); > } > > /** > @@ -1175,12 +1182,9 @@ static int ufshcd_devfreq_scale(struct ufs_hba > *hba, bool scale_up) > { > int ret = 0; > > - /* let's not get into low power until clock scaling is > completed */ > - ufshcd_hold(hba, false); > - > ret = ufshcd_clock_scaling_prepare(hba); > if (ret) > - goto out; > + return ret; > > /* scale down the gear before scaling down clocks */ > if (!scale_up) { > @@ -1212,8 +1216,6 @@ static int ufshcd_devfreq_scale(struct ufs_hba > *hba, bool scale_up) > > out_unprepare: > ufshcd_clock_scaling_unprepare(hba); > -out: > - ufshcd_release(hba); > return ret; > } I didn't understand why moving ufshcd_hold/ufshcd_release into ufshcd_clock_scaling_prepare()/ufshcd_clock_scaling_unprepare(). > > @@ -1294,15 +1296,8 @@ static int ufshcd_devfreq_target(struct device > *dev, > } > spin_unlock_irqrestore(hba->host->host_lock, irq_flags); > > - pm_runtime_get_noresume(hba->dev); > - if (!pm_runtime_active(hba->dev)) { > - pm_runtime_put_noidle(hba->dev); > - ret = -EAGAIN; > - goto out; > - } > start = ktime_get(); > ret = ufshcd_devfreq_scale(hba, scale_up); > - pm_runtime_put(hba->dev); > which branch are you working on? I didn't see this part codes in the branch 5.11/scsi-queue and 5.11/scsi-staging. Bean