From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 AB20844AB84 for ; Sun, 11 Oct 2026 14:17:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791728263; cv=none; b=r6G/EFjl2TS5XMqFKQyDiRRfU++l7Z+wH7OKP4+VzegX5hcA7d+sjSwM6ml6/glRwr7j3E4xeB7J+sAOncsOYgNiLs0glDS3ZzeF+nedpTih7JugG42yNZ+YcZkEsm1aq1RlbSteOhzKGvxflULDIQdrfI+tysIKg+8FN7BlMFE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791728263; c=relaxed/simple; bh=QhE1BI0sOXWtBfGC0rLmez15LhvXAeMMSv4ir+L+uY0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CnEaGDTxT+UPmYg9goKhV2FczW4rdkyltsN6vPnINHlmEqeFvcrZeOp7aEksPTYjo0UunKms9vtHa1EwyoGy53aJrnN7jgNTT0qzaHg27u7fRJ3C//6mfS0XkmDc1YBUb4ItJQdyujNUvpE7xCnkNvi1JqVPGPFvj8i2O81ywHk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ew42wOJO; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=iVwgQR3b; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ew42wOJO"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="iVwgQR3b" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 69B85Ubt1946412 for ; Sun, 11 Oct 2026 14:17:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= wOLlwEieA5QUKwTZQoQXtWGYO+pXqkTk6kdhFCGgK5o=; b=ew42wOJOzPyztr3x ChIgXlUghIxqXBsi11pHHtKtPtR5lT62wzz9ZgdfT3NwVY1L5ggkTJu4Ex0bL2lI TNq1uW69IZIG9AuEj+3Ke5PgdgRB6XPVeE6gQBQFwf+Z/SiyvCyjPGuU4zz/Fp30 ad8RFlKtis6fTOyoQ6kjDd5xKYwOHm/pdUo0VmZgKwK7q9fD0WblQ+aOK5bKMSLm GPWey2G7GuYO6N8mk3lABgf/cUprk4N+vSd8t7LlzX9iDFC/F2olLI45TfCB+m1d dJZLuQ7Ifh7acoiS/wsJ0ppFi+1OSGMMkCF5hTMhfmNAke/R46DmXgjpabPuiTPB LSJ8NQ== Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4h7dr7k4ka-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 11 Oct 2026 14:17:38 +0000 (GMT) Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-cd1e45a268cso409539a12.1 for ; Sun, 11 Oct 2026 07:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1791728257; x=1792333057; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=wOLlwEieA5QUKwTZQoQXtWGYO+pXqkTk6kdhFCGgK5o=; b=iVwgQR3bEnCrDYKBFmnATi7065fijEJn9RQHGPjKcomMOvT7suU6qoSXDARsjT8nKV 2fLQhcj1F73WIk7CBP82Pg0qt8FrG/sq0RI3Fl2sxquJeV3GSz+nfkT1uORqWcUAxpdL OwBuvROZhxEqLRmbObbwHkyFApNWgfHcI5WLlYQYp7TjkjgYJxd91mahHXnlotiHfYWW G6YoBvCmNDZfkA6M3g9z581dXPaOpFPyxugtGVGUtE3es54D0AQrRoTL272sRpYqNY5O W0/Tq91KY2xQ5AiHEUeYMj4T16/wwxF9x5bRTQ/sDhkdm99x6VAzDpiuInprG/SbKQ0d irUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791728257; x=1792333057; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=wOLlwEieA5QUKwTZQoQXtWGYO+pXqkTk6kdhFCGgK5o=; b=ywHjrE7ozuSAQ4j4+MnZPYOyNAphCd5XVWoonjADWLOn91pGx6H1BWGwQWsYa1ZlYa DshsjUihRq2LgEEXMMOeTJwHY7iuIF30abPcChXp62yHZGR2ZqzpvFRhw31TlH+UuVDE vbt7gOY72MN/4d/WJtCVVW51Hgfo5sKvChaJuQRevto3t2XAjXPvXgIcCn9GlTa9rrEn SNmEvrzkLC8/8fH9Gy/+Msud0sMt4/C5P5CtZP5DQwaFfglCXNh49TfJy3kp8QdsYNrA M1x8TwePvqUpIVg1UmpSRaUUrQOZ4+0s1138Sr0qLK3LJ2RadSj6NonANUQpyY2AGMdE 3hXw== X-Gm-Message-State: AFq9FYIMnaX+l/CBOctVgX3Qs7EsJSO78qakTvTblHYiIONY9iQXAfr6 HbT6c7Kw8lQLQIgu9xfXFltiAAx2/MBKGorKSD6puvlid1GHkQ/y8PH6sLWIDBMkYVkankH6o+1 IsQtR0s12eUEQZwW1Adt2VDjZZgYCFJ0Q2Yq9bMLUqyRBMXQY/WBQaLSxVM6Zyswxzt8= X-Gm-Gg: AYBFou3Dmfb+U+KXRrH9mHAHqqr/8FWQG90iHPMHennhxc1IFO1qHKaRTM5m1ay+1FR WQ40YI6Zs41cpDU82KgkB6F9oC2DIDYvUOsk1FVia7lhaTZ51t85p34WKX9E+A+gJ4f0IhrKMzI aauBXhGWLTgNd0zWmnVSdpJRqGRnltwQLpn5sZyTTw4gLmSsneYiPcZyEGr4+spK2LxJosgQ8af Qj5c9PWAzCwvhL9G7x7lQYKYcIFfTCFvqk6hfhMDuX8z2f7bRIY6hw1jwl6apakTxmnFg9s5XbG cg3kaT3EsuIbF6QmJipluwXJhCb1fmg/Pfo4dXttzhzJZqiytM5WiOOv5pCvTSLWTAfyvG0u/RI V8lahb6StdWHXMVcN7FjgyXDMpFUU5zHy+dt3RvTT16Y7AVJAi1Hx0filij4w1/A= X-Received: by 2002:a17:90b:4a8f:b0:3a6:e985:5631 with SMTP id 98e67ed59e1d1-3ab3a99b88emr6463609a91.62.1791728257099; Sun, 11 Oct 2026 07:17:37 -0700 (PDT) X-Received: by 2002:a17:90b:4a8f:b0:3a6:e985:5631 with SMTP id 98e67ed59e1d1-3ab3a99b88emr6463585a91.62.1791728256511; Sun, 11 Oct 2026 07:17:36 -0700 (PDT) Received: from ?IPV6:240e:400:e20:12c6:a578:1ef6:8335:64b6? ([240e:400:e20:12c6:a578:1ef6:8335:64b6]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cd3d9e21db1sm3375013a12.16.2026.10.11.07.17.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 11 Oct 2026 07:17:35 -0700 (PDT) Message-ID: <41f328b2-0825-4023-b86c-48136ba6ecd2@oss.qualcomm.com> Date: Sun, 11 Oct 2026 22:17:14 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/2] cpufreq: fix policy max not returning to non-boost freq on boost disable To: Ananthu C V , Vincent Guittot , Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Viresh Kumar , Jie Zhan , Pierre Gondois Cc: linux-kernel@vger.kernel.org, driver-core@lists.linux.dev, linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Oleg Keri , zhongqiu.han@oss.qualcomm.com References: <20260929-schedutil-boost-frequency-handling-v3-0-68de169498c7@oss.qualcomm.com> <20260929-schedutil-boost-frequency-handling-v3-2-68de169498c7@oss.qualcomm.com> Content-Language: en-US From: Zhongqiu Han In-Reply-To: <20260929-schedutil-boost-frequency-handling-v3-2-68de169498c7@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-ORIG-GUID: LP1XuYCpjwPTu6hCggRIBAwPKKYF300R X-Proofpoint-Spam-Info: AW1haW4tMjYxMDExMDA1NiBTYWx0ZWRfX69enrsjFi/Sh RjHDtVNXGsrHEoby+zFjbavLYtCUEYK/ccjwsjN4odR3ESBbVPQhnPZq2dRPHteje2Cs0vrg0ke xPShfYWaYK0ymtM9Ur7II2cwOxAZw0c= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDExMDA1NiBTYWx0ZWRfX8bAXZyY0APvN G7Aj87RGQToGUlKviamZHpy82yrPVu8YT7AXWMUMf6GSkNmBkm2em/ljLVLM20vp/nNp74LCuAv bCDhFYHJTKOFa67NP9pWVSKy/J/MvnQgHkefElN9RMRMjiuwimNoOlMkQaF8409LKHUyK1+f24g u5K1smHzck7CygS/AdMBn1uEfqPr6fsTgapf5SKqepGsEx79q0hhPkpzCDF1Qmzmpc7a1LevwhS SEvyf3o9hDYWd1hflkqdrVw0v1I8pOJZ/i0hhIEf8+o3wdoTBqSz25OxIgrotkA/HZjw1jOmxZL T8nn6GjYB0rD7qjGf6LPgg0sWCJA7l1wQFWeNbyvOpEx9r1IYYcA+zWdR8svUWKzDlVHhbDbYzO q8qnMCmFXDisD/i6snvJ5Op9LubAJhUEf+MYRc/oQMa33NQaoOHb0/VbmkZFh1G8QTrQuBospOo 5ieuUc1YQhqqeHR/8LQ== X-Proofpoint-GUID: LP1XuYCpjwPTu6hCggRIBAwPKKYF300R X-Authority-Analysis: v=2.4 cv=asknmiZV c=1 sm=1 tr=0 ts=6acb9a82 cx=c_pps a=Oh5Dbbf/trHjhBongsHeRQ==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=660iZSQnnn4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=szoK_18ZvN8xkPl22oQA:9 a=QEXdDO2ut3YA:10 a=_Vgx9l1VpLgwpw_dHYaR:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-10-11_03,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 phishscore=0 spamscore=0 adultscore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610110056 On 9/29/2026 7:38 PM, Ananthu C V wrote: > Commit 538b0188da46 ("cpufreq: ACPI: Set cpuinfo.max_freq directly if > max boost is known") introduced a guard for cpuinfo max updates to only > increase, to preserve driver-set values above the freq table maximum. I think as discussed in v2 the changelog should describe the impact of commit 6e39ba4e5a82 ("cpufreq: Add boost_freq_req QoS request"), since it is relevant to understanding this fix. > Later commit db80ad776cd2 ("cpufreq: Remove driver default policy->min/max > init") dropped the 'policy->max = max_freq' assignment from > cpufreq_frequency_table_cpuinfo, leaving that one-way-guard to be the only > path for cpuinfo max and consequently policy max to be updated, causing > both values to be stuck at boost frequency even when boost is disabled. > > Unconditionally track the highest non-boost frequency (max_base_freq) > in the freq table. If boost frequencies are available, use the highest > frequency from the table/max_base_freq instead of cpuinfo->max_freq to > control boost values, so the value can decrease again when boost is > disabled. > > Fixes: db80ad776cd2 ("cpufreq: Remove driver default policy->min/max init") Patch 2/2 currently depends on a helper introduced by patch 1/2, which prevents it from being backported independently. Since 2/2 is an independent fix that should be backported to stable on its own, I think it should be placed before patch 1/2 in the series and kept self contained. > Signed-off-by: Ananthu C V > --- > drivers/cpufreq/cpufreq.c | 16 +++++++++++++++- > drivers/cpufreq/freq_table.c | 9 ++++++++- > include/linux/cpufreq.h | 3 +++ > 3 files changed, 26 insertions(+), 2 deletions(-) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 96515880b4ac..5e6afb6f8826 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -574,6 +574,8 @@ static ssize_t show_local_boost(struct cpufreq_policy *policy, char *buf) > > static int policy_set_boost(struct cpufreq_policy *policy, bool enable) > { > + unsigned int max_freq; > + unsigned int max_table_freq; > int ret; > > if (policy->boost_enabled == enable) > @@ -587,7 +589,19 @@ static int policy_set_boost(struct cpufreq_policy *policy, bool enable) > return ret; > } > > - ret = freq_qos_update_request(&policy->boost_freq_req, policy->cpuinfo.max_freq); > + max_table_freq = cpufreq_frequency_table_max(policy); > + > + if (policy_has_boost_freq(policy)) { > + max_freq = enable ? max_table_freq : policy->cpuinfo.max_base_freq; > + > + if (!max_freq) > + /* when the freq table contains only boost frequencies */ > + max_freq = max_table_freq; > + } else { > + max_freq = policy->cpuinfo.max_freq; > + } > + > + ret = freq_qos_update_request(&policy->boost_freq_req, max_freq); > if (ret < 0) { > policy->boost_enabled = !policy->boost_enabled; > cpufreq_driver->set_boost(policy, policy->boost_enabled); > diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c > index ea994647abc8..820ed4559f6c 100644 > --- a/drivers/cpufreq/freq_table.c > +++ b/drivers/cpufreq/freq_table.c > @@ -14,7 +14,7 @@ > * FREQUENCY TABLE HELPERS * > *********************************************************************/ > > -static bool policy_has_boost_freq(struct cpufreq_policy *policy) > +bool policy_has_boost_freq(struct cpufreq_policy *policy) > { > struct cpufreq_frequency_table *pos, *table = policy->freq_table; > > @@ -27,17 +27,22 @@ static bool policy_has_boost_freq(struct cpufreq_policy *policy) > > return false; > } > +EXPORT_SYMBOL_GPL(policy_has_boost_freq); > > int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy) > { > struct cpufreq_frequency_table *pos, *table = policy->freq_table; > unsigned int min_freq = ~0; > unsigned int max_freq = 0; > + unsigned int max_base_freq = 0; > unsigned int freq, i; > > cpufreq_for_each_valid_entry_idx(pos, table, i) { > freq = pos->frequency; > > + if (!(pos->flags & CPUFREQ_BOOST_FREQ) && freq > max_base_freq) > + max_base_freq = freq; > + > if ((!cpufreq_boost_enabled() || !policy->boost_enabled) > && (pos->flags & CPUFREQ_BOOST_FREQ)) > continue; > @@ -57,6 +62,8 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy) > if (policy->cpuinfo.max_freq < max_freq) > policy->cpuinfo.max_freq = max_freq; > > + policy->cpuinfo.max_base_freq = max_base_freq; > + > if (min_freq == ~0) > return -EINVAL; > else > diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h > index f048c925fd98..7bb58405e004 100644 > --- a/include/linux/cpufreq.h > +++ b/include/linux/cpufreq.h > @@ -45,6 +45,7 @@ enum cpufreq_table_sorting { > struct cpufreq_cpuinfo { > unsigned int max_freq; > unsigned int min_freq; > + unsigned int max_base_freq; /* Highest non-boost frequency in the table */ To avoid introducing a new member that is only used by frequency-table drivers, please consider the following implementation instead: If there are boost entries in the frequency table, the table is the only source of cpuinfo.max_freq, so let cpufreq_frequency_table_cpuinfo() set it unconditionally in that case. diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index ea99464..8c8bad2 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c @@ -33,14 +33,17 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy) struct cpufreq_frequency_table *pos, *table = policy->freq_table; unsigned int min_freq = ~0; unsigned int max_freq = 0; + bool has_boost = false; unsigned int freq, i; cpufreq_for_each_valid_entry_idx(pos, table, i) { freq = pos->frequency; - if ((!cpufreq_boost_enabled() || !policy->boost_enabled) - && (pos->flags & CPUFREQ_BOOST_FREQ)) - continue; + if (pos->flags & CPUFREQ_BOOST_FREQ) { + has_boost = true; + if (!cpufreq_boost_enabled() || !policy->boost_enabled) + continue; + } pr_debug("table entry %u: %u kHz\n", i, freq); if (freq < min_freq) @@ -50,17 +53,20 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy) } policy->cpuinfo.min_freq = min_freq; + + if (min_freq == ~0) + return -EINVAL; + /* * If the driver has set its own cpuinfo.max_freq above max_freq, leave - * it as is. + * it as is. This does not apply to tables with boost entries, because + * the table is the only source of cpuinfo.max_freq then and it needs + * to go down again when boost is disabled. */ - if (policy->cpuinfo.max_freq < max_freq) + if (has_boost || policy->cpuinfo.max_freq < max_freq) policy->cpuinfo.max_freq = max_freq; - if (min_freq == ~0) - return -EINVAL; - else - return 0; + return 0; } int cpufreq_frequency_table_verify(struct cpufreq_policy_data *policy) > > /* in 10^(-9) s = nanoseconds */ > unsigned int transition_latency; > @@ -791,6 +792,8 @@ struct cpufreq_frequency_table { > > int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy); > > +bool policy_has_boost_freq(struct cpufreq_policy *policy); > + > int cpufreq_frequency_table_verify(struct cpufreq_policy_data *policy); > > int cpufreq_generic_frequency_table_verify(struct cpufreq_policy_data *policy); > -- Thx and BRs, Zhongqiu Han