From patchwork Thu Jun 27 08:37:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ram Prakash Gupta X-Patchwork-Id: 808059 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3126A7EF04; Thu, 27 Jun 2024 08:38:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719477506; cv=none; b=gAJuvelWSM47HoeNARTbdI8Hb9h2JaisVD3/kh1Ko9rciyPr0O5qdexYj2rS4bFrwInDUO1hOBMc8lalA6TVbwiQ9tol1RfIPPOQxdYQujtIxzZvufUONRrw/QhzSeZUPyMlzGZZHiGuKxp/ssV47HeTi6n+8r00Kzk0JG+PLPM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719477506; c=relaxed/simple; bh=dHMQiAk0KuDJseI/jZU1VvVJtdyigKwX7iX6L7HwIz4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=FZkGbWMayH1KCw0t8+Jkl0WsLWUfKZ7QYnWQ/lbs7aontUTq/QQuFthXljoMDsmaJxl6V+rn10+PvbOMKvBu8hafp9vr0IUcQxiOz5FTDzcqhFw6RiS+6j2a7WoqcDywzeboeHYFva0V5tv7sXyTG0P/V1pKzN8f+0+S3oc1y1s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=qualcomm.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=FMlkLtYh; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="FMlkLtYh" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45R23F9e022671; Thu, 27 Jun 2024 08:38:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:date:from:in-reply-to:message-id:references:subject:to; s= qcppdkim1; bh=VkGm8NyiH5XHtCMqeL3s8fW7KGApr2o5luEf9lR9iJM=; b=FM lkLtYhjaSRmtmTFVIg+gGjzuVcOBuSv/IlBdMh5eKSj5W1+shXWP3Pgye2H8bew2 Q9rPYy1hJiKG2pUadI0vKBVF4+LplKdlG+ONj6BTeRZON6TqFz6vrhdehDYeBxZl 7DGt/zCLju61IhgSmOqGCA6xk06HLdcjiUgtA8ub+xgNpB32pc4Ws+3mF9fnv7WT ZcEi8k4oERqeKMDruigVv8/QuAI1laIXI11/bGhc7O/PNBRLiGzh+KM1pVFc6oSX Zj2yiR18DhXoUQ65fT4opYNMOPWsdUwJZsuW3QNJ4taqnVZNdUXaWDWLoxXtRqUH 15WA3ad/mT3n4e0+lN+g== Received: from apblrppmta02.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ywqw9k87a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 08:38:08 +0000 (GMT) Received: from pps.filterd (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTP id 45R8c4mr030665; Thu, 27 Jun 2024 08:38:04 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 3ywqpmddgk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 27 Jun 2024 08:38:04 +0000 Received: from APBLRPPMTA02.qualcomm.com (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 45R8asSP029540; Thu, 27 Jun 2024 08:38:04 GMT Received: from hu-maiyas-hyd.qualcomm.com (hu-rampraka-hyd.qualcomm.com [10.213.109.119]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 45R8c3l8030651; Thu, 27 Jun 2024 08:38:04 +0000 Received: by hu-maiyas-hyd.qualcomm.com (Postfix, from userid 2305851) id 0F2C852B08E; Thu, 27 Jun 2024 14:08:01 +0530 (+0530) From: Ram Prakash Gupta To: "James E.J. Bottomley" , "Martin K. Petersen" , Manivannan Sadhasivam Cc: Alim Akhtar , Avri Altman , Bart Van Assche , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, quic_cang@quicinc.com, quic_nguyenb@quicinc.com, quic_rampraka@quicinc.com, quic_pragalla@quicinc.com, quic_nitirawa@quicinc.com Subject: [PATCH v2 1/2] scsi: ufs: Suspend clk scaling on no request Date: Thu, 27 Jun 2024 14:07:55 +0530 Message-Id: <20240627083756.25340-2-quic_rampraka@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240627083756.25340-1-quic_rampraka@quicinc.com> References: <20240627083756.25340-1-quic_rampraka@quicinc.com> X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: nn0ctsMGxgrd-BtyAfCbFOlUa4OAMbv9 X-Proofpoint-GUID: nn0ctsMGxgrd-BtyAfCbFOlUa4OAMbv9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-27_04,2024-06-25_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 bulkscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406270065 Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Currently ufs clk scaling is getting suspended only when the clks are scaled down, but next when high load is generated its adding a huge amount of latency in scaling up the clk and complete the request post that. Now if the scaling is suspended in its existing state, and when high load is generated it is helping improve the random performance KPI by 28%. So suspending the scaling when there is no request. And the clk would be put in low scaled state when the actual request load is low. Making this change as optional for other vendor by having the check enabled using vops as for some vendor suspending without bringing the clk in low scaled state might have impact on power consumption on the SoC. Signed-off-by: Ram Prakash Gupta --- drivers/ufs/core/ufshcd.c | 3 ++- include/ufs/ufshcd.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 1b65e6ae4137..9f935e5c60e8 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -1560,7 +1560,8 @@ static int ufshcd_devfreq_target(struct device *dev, ktime_to_us(ktime_sub(ktime_get(), start)), ret); out: - if (sched_clk_scaling_suspend_work && !scale_up) + if (sched_clk_scaling_suspend_work && + (!scale_up || hba->clk_scaling.suspend_on_no_request)) queue_work(hba->clk_scaling.workq, &hba->clk_scaling.suspend_work); diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index bad88bd91995..c14607f2890b 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -457,6 +457,7 @@ struct ufs_clk_scaling { bool is_initialized; bool is_busy_started; bool is_suspended; + bool suspend_on_no_request; }; #define UFS_EVENT_HIST_LENGTH 8 From patchwork Thu Jun 27 08:37:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ram Prakash Gupta X-Patchwork-Id: 808628 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 312B280600; Thu, 27 Jun 2024 08:38:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719477507; cv=none; b=nSDod86CqBn00QCd0Wx4DFNHlcJVIQMSmVLTov2bUxO0h7vsWROBpEXFVrnEIusIK0gZrhRNZQT96Pqt1976apTPSABUPt5SYpQdkfh3BxD36ua2KZPbcWCVIlRuA2BwgMPYDOmnIA9SGobv2acbrrsQVbpW/8Zn8lnJgGCTU7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719477507; c=relaxed/simple; bh=kh3BvM1UYLJbgnRm0wk8tVIY19VqIuh2seSAOWDNjek=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=RFqBCqRkjLyvWASEmpR1OZDWEDf4x6ZOu0J031WRiXM0fp2TgUMtSRXJfJlXfCn7GKWbMhY/MruAg6ldGNDrrc5v5ilEOK+ou3WRCfkXweVUTVLCTN0woWfgPgjf78+MwNcexGu34rW3bGDvEiTQx39gLfmyN52sDJMqNVYk+TY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=qualcomm.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=pHa5Q4zd; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="pHa5Q4zd" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45R1mPr5022654; Thu, 27 Jun 2024 08:38:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:date:from:in-reply-to:message-id:references:subject:to; s= qcppdkim1; bh=/8PbBjaENy3mbbV95BuGAhcwyL8sMrqxjHV3mlbulEA=; b=pH a5Q4zdxYonEIAgUOqodamCFPxjqnYyINj/6wnFT1KCYuUZFXkl5ZNLJOG+fb36bQ dWC5XIiUQvO/KVqFP7DAT0yjDyZrZz0QJ4gg13hWjljf8LqOpah5bL/FDx26gvuo Ir757Il2AMiwKyYN4y7LMOVdyblG+l0rvJx2uo4kd0+w6MaLS+Fray4Dko4cOPhu hoaop8yLWzjK+IFcSJEowVWgUPy66QVjyHFS4Gl7wnKHqd1Z+ApqCRXi4BatmYlG 8cIOyJ4J1V4cXWa192wwhRjsU9o4+hvywWf2DJmRJqjJV4Q7AHEGAoDhhtYl61UX bzly/eq9/9QQydB8cc8g== Received: from apblrppmta02.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ywqw9k87b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 08:38:08 +0000 (GMT) Received: from pps.filterd (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTP id 45R8c4n4030671; Thu, 27 Jun 2024 08:38:04 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 3ywqpmddgq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 27 Jun 2024 08:38:04 +0000 Received: from APBLRPPMTA02.qualcomm.com (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 45R8c4nW030658; Thu, 27 Jun 2024 08:38:04 GMT Received: from hu-maiyas-hyd.qualcomm.com (hu-rampraka-hyd.qualcomm.com [10.213.109.119]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 45R8c4f6030653; Thu, 27 Jun 2024 08:38:04 +0000 Received: by hu-maiyas-hyd.qualcomm.com (Postfix, from userid 2305851) id 23F0352B08F; Thu, 27 Jun 2024 14:08:02 +0530 (+0530) From: Ram Prakash Gupta To: "James E.J. Bottomley" , "Martin K. Petersen" , Manivannan Sadhasivam Cc: Alim Akhtar , Avri Altman , Bart Van Assche , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, quic_cang@quicinc.com, quic_nguyenb@quicinc.com, quic_rampraka@quicinc.com, quic_pragalla@quicinc.com, quic_nitirawa@quicinc.com Subject: [PATCH v2 2/2] scsi: ufs: qcom: Enable suspending clk scaling on no request Date: Thu, 27 Jun 2024 14:07:56 +0530 Message-Id: <20240627083756.25340-3-quic_rampraka@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240627083756.25340-1-quic_rampraka@quicinc.com> References: <20240627083756.25340-1-quic_rampraka@quicinc.com> X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: n8FFsEVu6fw-16fLYKiKxRFkmINht5Zg X-Proofpoint-GUID: n8FFsEVu6fw-16fLYKiKxRFkmINht5Zg X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-27_04,2024-06-25_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 bulkscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406270065 Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Enable suspending clk scaling on no request for Qualcomm SoC. Signed-off-by: Ram Prakash Gupta --- drivers/ufs/host/ufs-qcom.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index cca190d1c577..9041ffab152c 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1548,6 +1548,8 @@ static void ufs_qcom_config_scaling_param(struct ufs_hba *hba, p->timer = DEVFREQ_TIMER_DELAYED; d->upthreshold = 70; d->downdifferential = 5; + + hba->clk_scaling.suspend_on_no_request = true; } #else static void ufs_qcom_config_scaling_param(struct ufs_hba *hba,