From patchwork Wed Mar 8 03:00:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asutosh Das X-Patchwork-Id: 65991 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp112169wrd; Tue, 7 Mar 2023 19:28:16 -0800 (PST) X-Google-Smtp-Source: AK7set+f6eJemzhA/oJ5hH9wQCI4KW8Dd7w0bbpwuGntg26ziRxUB5ikECaa2ENrb7q5j8SS1uHT X-Received: by 2002:a17:903:441:b0:19b:fa9:678b with SMTP id iw1-20020a170903044100b0019b0fa9678bmr16512733plb.40.1678246096637; Tue, 07 Mar 2023 19:28:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678246096; cv=none; d=google.com; s=arc-20160816; b=vViScO+efVKccvT9w6H9lO5zc+bBCoU3oYNF6CEKyMqDo8+bXyZQrxV7VaCXMv8B1/ XG6ZHNmO2L6yyCkLCB2k9DieOftgmxabQElNFSlefatPYXyGNns6CNptE7b7P/GhKKve 87+646bOK3QOL/qunNBInhxgZC9n9ueffNRfzI8TRGHAmQndHU6I0X2O+nxlahgIuKoS bdbOYjM7j2jcFDWB5exi52s4B2/9TFzeSroE0rzP/FUsCK7r13fXqu/EuXNBKDjx/4KC 0naG26qzcWXlgkeodD/DdkXmQk88IfRMvlTtN3RWqScSnYOt44g3SXdJh/VYK4ZFgtQe mw0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=3XXnDnblTu0EK4aaQgq7s0zMJDrtKcirk7Sy688Cgf4=; b=I3/XvDYUpg6DvrP2XE5Q90nywVFalpggMJv7266jUqSljw4z8DH3+stcUokgeruzlj 5pj0lAV9DX+QIqtjzg7NYoPNrRYlbKTQhLB9v4fqtx453xl4H3FUemK6VMaX4nGg4WNz Uh2F2XTeL/3teSE8/XNkFhBgQJrApMJe/cucTfWMgxusKQQKpkg8j8A3nqUGKV3HZk9u eI741IN4UQY+jsMWUzt0uO5vMQBXKlUMG78JSyHKBP+Goy4DqUqfx7Qjd+i7rQOhF131 XV+sbwzzgJzuQE+bU6k4tgq8d5mgAztKs2wAJFhFTyTl4tH2dAHoBZJ9bHekFC/w27NO wvcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=esaq0YQC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j10-20020a170902690a00b00192c6aeaf07si13237788plk.191.2023.03.07.19.28.03; Tue, 07 Mar 2023 19:28:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=esaq0YQC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229605AbjCHDBX (ORCPT + 99 others); Tue, 7 Mar 2023 22:01:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229754AbjCHDBV (ORCPT ); Tue, 7 Mar 2023 22:01:21 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FE91A3375; Tue, 7 Mar 2023 19:01:19 -0800 (PST) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3282mgvO011303; Wed, 8 Mar 2023 03:01:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=3XXnDnblTu0EK4aaQgq7s0zMJDrtKcirk7Sy688Cgf4=; b=esaq0YQCJI7NASfm2N97ByyEGI7MQJhz+yUM8E24+kA/uOY+4oH34WWBEztb2nGQBCeo ei9E419dbaTbFIAOxLyHFd0aWtOE7Ope2vTrd59+UVxEfBQJBHgggu0Mttyy6mUtuuUS 0bKo93qL6y5RZ1XzuHjEIPBmZC96Qql/+jvKX+tj6ctDJ3sU7paAhDS8tFLfh+B5+Hdf MshFN9+WBTf9nE0gX61BGDiFZ+LYb1w4Ylk+l9jkD0e7kgkG82bK71xQs0UmgpLLE2EL m4Iwxb/nKkT+E62bi1/8xqYsvxdVjcfB8f/09RBmm4Cvm7SOV/1OxcaVFsOb/ejHKD95 bA== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p6fmm0a0w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Mar 2023 03:01:05 +0000 Received: from nasanex01a.na.qualcomm.com ([10.52.223.231]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 328314qL018168 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 8 Mar 2023 03:01:04 GMT Received: from asutoshd-linux1.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 7 Mar 2023 19:01:03 -0800 From: Asutosh Das To: , , CC: , , , , , , , , Asutosh Das , , Alim Akhtar , "James E.J. Bottomley" , "open list" Subject: [PATCH v1 1/1] scsi: ufs: mcq: Use active_reqs to check busy in clock scaling Date: Tue, 7 Mar 2023 19:00:09 -0800 Message-ID: X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: HEjOp2cq81wtiGcYwWl7XfVrTCJJYVnS X-Proofpoint-ORIG-GUID: HEjOp2cq81wtiGcYwWl7XfVrTCJJYVnS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-07_18,2023-03-07_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 malwarescore=0 phishscore=0 clxscore=1011 adultscore=0 mlxscore=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303080024 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759768578976132091?= X-GMAIL-MSGID: =?utf-8?q?1759768578976132091?= Multi Circular Queue doesn't use outstanding_reqs. But the ufs clock scaling functions use outstanding_reqs to determine if there're requests pending. When MCQ is enabled this check always returns false. Hence use active_reqs to check if there're pending requests. Signed-off-by: Asutosh Das Reviewed-by: Manivannan Sadhasivam --- drivers/ufs/core/ufshcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 172d25fef740..c6b35123c83b 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -1500,7 +1500,7 @@ static int ufshcd_devfreq_get_dev_status(struct device *dev, scaling->window_start_t = curr_t; scaling->tot_busy_t = 0; - if (hba->outstanding_reqs) { + if (scaling->active_reqs) { scaling->busy_start_t = curr_t; scaling->is_busy_started = true; } else { @@ -2118,7 +2118,7 @@ static void ufshcd_clk_scaling_update_busy(struct ufs_hba *hba) spin_lock_irqsave(hba->host->host_lock, flags); hba->clk_scaling.active_reqs--; - if (!hba->outstanding_reqs && scaling->is_busy_started) { + if (!scaling->active_reqs && scaling->is_busy_started) { scaling->tot_busy_t += ktime_to_us(ktime_sub(ktime_get(), scaling->busy_start_t)); scaling->busy_start_t = 0;