From patchwork Tue Feb 27 16:53:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 13574140 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32320C54E49 for ; Tue, 27 Feb 2024 16:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=517KPfffXI5TZNiooBHUpUzw2xRkvBUAiAKv0QazMtU=; b=MWiKCv2Ao9AOyp S1DL63NqM1T3U2newj1JfEr9NCWRqVimqZAGllnw4cZCPFOJsF5os622ih9R5SEhmNUDJn9hTVwmq tw/P+iFk7R8Ane+aW8Svqp5otEklQSeiLw30591BfnnKFEcLzO9DCdUlvW/jvGW8nYRSJ+LH2I1yz 3qKNYywRkkEV37JpqGiULyun7leLsxmxCdpfxsi5W2DAUmAy/0iNCUMs4z+mq9uoN5lcGQbKtPJuI 2/vcIraIcPo2pdMpbAJu9Hz9Q9bRjk5yP/jNy4SuJfzNPOdpcimE/U38GBoNxhIoWiqR0gq7u9Pf7 YF3Z6FfLuEDdFWQjb4MQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf0ii-000000065Fr-2nAb; Tue, 27 Feb 2024 16:54:20 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf0iH-0000000656o-35pE for linux-arm-kernel@lists.infradead.org; Tue, 27 Feb 2024 16:53:55 +0000 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41RGbNYp020484; Tue, 27 Feb 2024 16:53:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=1ukAByU/Y6XIpyYRk5+z3AWPCyZlxizj7T5qOMn6Q/k=; b=RK 26RgBcBggnl9gsxZouO/v1vknWSgHRBq8j+/wbit20e+HNroM2B5ptMH3LZvBBsx PNeeTK3R5ts0GTSckge0KdqGL9wgi5I2QY+rrFC47WNNo3ru3ek80SlsGRDoAbcN LfJtuO8f8fBx5HMajUDmfX4pHUBvQoHQNYEgZWF1BmxcS+nl7p8K8OSbizsGWx5c vrL3dJDYMN5SzUtxUmVzu5Ted/0FuR1HWe6FBsQv8qjK+EQX2PB/PvFQ4HhAOt9c gtIhJSuSgPeFYyNWnD8udf0LS03dfrwyYCMUVixUvlnqRiQE+xrV0CgPLPE/YfCO bkica+39w4bDQ/YUgMjw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3whkd5g1e1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 16:53:45 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41RGrjSg028353 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 16:53:45 GMT Received: from hu-sibis-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 27 Feb 2024 08:53:39 -0800 From: Sibi Sankar To: , , , , , , , CC: , , , , , , , , Sibi Sankar Subject: [PATCH 1/2] cpufreq: Fix per-policy boost behavior on SoCs using cpufreq_boost_set_sw Date: Tue, 27 Feb 2024 22:23:08 +0530 Message-ID: <20240227165309.620422-2-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227165309.620422-1-quic_sibis@quicinc.com> References: <20240227165309.620422-1-quic_sibis@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: K89-2LrXOKUphU7Q81xYmYKPS4TaY0_6 X-Proofpoint-ORIG-GUID: K89-2LrXOKUphU7Q81xYmYKPS4TaY0_6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-27_03,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 bulkscore=0 spamscore=0 adultscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402270130 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240227_085353_867159_FA76784F X-CRM114-Status: GOOD ( 13.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Incorporate per-policy boost flag in the policy->max calculus used in cpufreq_frequency_table_cpuinfo. This fixes the per-policy boost behavior on SoCs using cpufreq_boost_set_sw callback. Fixes: 218a06a79d9a ("cpufreq: Support per-policy performance boost") Reported-by: Dietmar Eggemann Signed-off-by: Sibi Sankar --- drivers/cpufreq/cpufreq.c | 15 +++++++++------ drivers/cpufreq/freq_table.c | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index ff69e9335645..76002aa3d12d 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -644,14 +644,16 @@ static ssize_t store_local_boost(struct cpufreq_policy *policy, if (policy->boost_enabled == enable) return count; + policy->boost_enabled = enable; + cpus_read_lock(); ret = cpufreq_driver->set_boost(policy, enable); cpus_read_unlock(); - if (ret) + if (ret) { + policy->boost_enabled = !policy->boost_enabled; return ret; - - policy->boost_enabled = enable; + } return count; } @@ -2791,11 +2793,12 @@ int cpufreq_boost_trigger_state(int state) cpus_read_lock(); for_each_active_policy(policy) { + policy->boost_enabled = state; ret = cpufreq_driver->set_boost(policy, state); - if (ret) + if (ret) { + policy->boost_enabled = !policy->boost_enabled; goto err_reset_state; - - policy->boost_enabled = state; + } } cpus_read_unlock(); diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index c4d4643b6ca6..c17dc51a5a02 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c @@ -40,7 +40,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, cpufreq_for_each_valid_entry(pos, table) { freq = pos->frequency; - if (!cpufreq_boost_enabled() + if ((!cpufreq_boost_enabled() || !policy->boost_enabled) && (pos->flags & CPUFREQ_BOOST_FREQ)) continue; From patchwork Tue Feb 27 16:53:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 13574138 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4992AC54798 for ; Tue, 27 Feb 2024 16:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=C0/2wNk4Y6Z6D/ez8fONTt3IsJr7dwlj7MjKLJcxw5I=; b=Gwjll/nZaXl+Ea N0XjwDJn5AQoq2qE3HdaSvnCYVcV0fmM0E0qg+L21w/RzOknAurgbB72xbUl4Yf5h78LnzsGARleT vD/n8SW3M4CAhpjt7pUa/CJq8J21S0ZfLlBo4Z7iOGq+cMRGcN2qMV2KuNlEyzCkHhTO9UpKuYKoK 3nqugkkNnaGwkz0TMRn1dDnf0W70gosD0LelmFrqjx9Yz1MbmF2olEkEHqaTZFZvHP5poB3LUpn5W ys0Lx6KXOfpnFhbKA6UlCaNMi7XmDpE5byBmWZD3BH+jJ+FDNCqC/p8ZYg7QDLGXVEez3LfHuNoXG WoXZziWydD9w7gr2DKrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf0ij-000000065GY-1eZH; Tue, 27 Feb 2024 16:54:21 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf0iN-0000000658s-39QC for linux-arm-kernel@lists.infradead.org; Tue, 27 Feb 2024 16:54:02 +0000 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41RAto7V008656; Tue, 27 Feb 2024 16:53:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=Xp1rHqH7daGk6V3hwTqtNayvUghKARCkNNKi0hgJW7Y=; b=UG vvmZQ2ILsxzeyqYBfNToIyqjiUgdKhtT5TGaG0nn9q9KjZxIZxT6S6bhzaWNrsgq PvT5H1avgvRGBNj6d6QAt8YjJZcCitYb5Nus4CGvj2Bh2/pLaUz36Rp4J2nURc4b LHyrM14EjaPOETb524qb97iQMksUMgcCGpKXcw6SuXhxNrTt+oJnvQ6CqJ11JI83 HCbx1Flno1CCuMYqiUrcxmDbT7VFcEq1E2RQfn7NEQnwvRnHjrALMLQhMyAxe3vv 8ne10xnajE/CrtHP1YDoBnYW42YTcu5Yjq1wDZWlSqd1oAVcLhCmhm4ZGnmpInud RXHCES4xAazM7BeJxlaA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3whedvrw05-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 16:53:51 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41RGroFU008292 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 16:53:50 GMT Received: from hu-sibis-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 27 Feb 2024 08:53:45 -0800 From: Sibi Sankar To: , , , , , , , CC: , , , , , , , , Sibi Sankar Subject: [PATCH 2/2] cpufreq: apple-soc: Align per-policy and global boost flags Date: Tue, 27 Feb 2024 22:23:09 +0530 Message-ID: <20240227165309.620422-3-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227165309.620422-1-quic_sibis@quicinc.com> References: <20240227165309.620422-1-quic_sibis@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: GVzO79U-yeiPTRFZ4WX9MhuCVs55PVoh X-Proofpoint-ORIG-GUID: GVzO79U-yeiPTRFZ4WX9MhuCVs55PVoh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-27_03,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 mlxlogscore=999 clxscore=1015 bulkscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 adultscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402270130 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240227_085359_939953_DBD6D218 X-CRM114-Status: GOOD ( 10.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org With the cpufreq_driver.boost_enabled flag set by default, the per-policy boost flags are left in a disabled state. Fix this by enabling the per-policy boost flag by default on policies supporting boost. Logs: root:/sys/devices/system/cpu/cpufreq# cat boost policy*/boost 1 0 0 Fixes: 218a06a79d9a ("cpufreq: Support per-policy performance boost") Reported-by: Dietmar Eggemann Signed-off-by: Sibi Sankar --- drivers/cpufreq/apple-soc-cpufreq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index 021f423705e1..b85c250e30d0 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -289,6 +289,7 @@ static int apple_soc_cpufreq_init(struct cpufreq_policy *policy) } else { apple_soc_cpufreq_hw_attr[1] = &cpufreq_freq_attr_scaling_boost_freqs; apple_soc_cpufreq_driver.boost_enabled = true; + policy->boost_enabled = true; } }