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 8A045415F17 for ; Tue, 22 Sep 2026 13:39:55 +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=1790084397; cv=none; b=GjbQyc86p3ISR4vgS4Kwl5+lPRl4owNRLmDQTgHnvSjNgnjxX1HXONf4NhGfPPlCFYDIb7fI9K23Fi2UU9JVgI/x9iCAqvmwbm12HEi+gTSA5IOKrjarZ/aoyMxbXWfa+GjbdiqDDuEvefq6FOA+X7Fatoe7uarzY8Pa7aURBEo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790084397; c=relaxed/simple; bh=7QHutKGaN9i99xihPm4cE0w+hK9skWSFtV7wIltN2hc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ZCTx+SfOwhpDbQ9G6oVThEtyOeWHtRMeRc4P8wiEBV6OKmUCzPrWWjK8O7o9x5MobFRePp6aYn01pPhVWrM9R+vJeuymKc+izTspbiplpv888K8ThGqTx8oYgUqfB6iAxbCgHyIOBNxf7T2qW8EKTEmrYoMIdXN6irn3dUY91Vo= 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=Wd8kCYiE; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ExUcNiRx; 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="Wd8kCYiE"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ExUcNiRx" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68MBPB5B015163 for ; Tue, 22 Sep 2026 13:39:54 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= +n557K+DZqVRpFdTKZE18fW896KFDQSu6kLWIm5rBnQ=; b=Wd8kCYiEqJZM3jNc wzCzWbEduiUWF5Bf4A3gXNPM2MR4eQAy258UCXkq0dbjCrA1BmiPYd8/p1/ysx+s lZ7fhXLSAM86XeXEgFWfDj7vqE7eSWz7t1I8KhzI9y3qVWb9Yhn89R1nUEmQl875 aIU67kpo1Z255jLS8QAZi+/uGje0nIuy0po7Asj4L9GwYiX/frCHOGfRj0k40GCy ryH+ymyrcP82ndiOcSYOnq6IkG7ZXaQsoLcMU+z7GtF/nwLjBBiyWgluHt9rtjLv sSxcuPFjLtC4m41yrSxb+jdJp4Xzp/rYqEXyTo/SMWcxWISFHlt9pWMNXOkCfbID EGLZ2g== Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gunjysjn7-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 22 Sep 2026 13:39:54 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-398dc3d8f0fso963773a91.0 for ; Tue, 22 Sep 2026 06:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790084393; x=1790689193; darn=lists.linux.dev; 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=+n557K+DZqVRpFdTKZE18fW896KFDQSu6kLWIm5rBnQ=; b=ExUcNiRxZn+vBOarqIqzyEQ2cdYAyeSmy8fg0FR/0nETAXTmBpE6i0rPh58OyKbJ9B XrdwKx44aPBlkkJuoRXK6c+yGtImLKGcD5J/5/VdpWTHpJKmlW1fhElha3vLu7Fkjc7v I+Amu2bynMfkl401Jb6Tvib5LlTVflTDCERweB0zIlPJXrrhYUXIHLdmVTX4ZLwLrdJC ISh1SYgigKPr0o9jk8sUxww42C4k0DpM5pEjNQFSiMbH/ML8qvnNLYw3oc0Om8h7RUC4 4zkeeX8MUI/TYMgRCZbOxHZ1/skZf8RbxDbym8nZ94SSpmYZq2IEk9v78zMnxkWTTvYU g3xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790084393; x=1790689193; 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=+n557K+DZqVRpFdTKZE18fW896KFDQSu6kLWIm5rBnQ=; b=dl1jRs3uukFpn1AY8HzY3YR1uHruHR1CmWRGgf9paSwDs+xJjeDhrb0DRRKpC9YS3L XltPRrcMId/YHUjG+52WaWBvL9rEBSRO4c33zaptqxHMzrioBZNNsBKaRWjJN6r/eyX6 BDGHB/7bU9XitQb8BQZqF58gzvkiZXHtcRh6Q1aUNXq52Sz+ilboLNe/icweGzDLUWC1 UuorC0k8SAIh001MW8D02O0gzRnmI7DuqcrtK7lNtq/g1J21jNyVjo7gVu16NyuoVX9J 6ldIK6vGOIkD2trd0mPFax8DjU7Z+huPKYzXT/n6EW9Ri85ZHue9wJ0kK/4Xa+ICK8n1 7+6g== X-Forwarded-Encrypted: i=1; AKwUvBx7VumYcdRx2i5uOjnZIiGt7NRjivCJ0pc1kyXd2xwlbN4lJNP82L7jk0jaifBu6vpzpF2i3lSKQSVM7w==@lists.linux.dev X-Gm-Message-State: AFuF++nhpMeXhQOemLubcnNaikC417tlA4UfFBXi1A1ulpW/WKw7e8px KMQ7kA1V19BHIRWRCOXcE893cHBwQr30xPJUbVvQEioSpDLgcPB0+XkQDqN19V/FRnYP9PViN1U afjbP8DIP5dRG2DRZIBh2K0LmIZR7u+PSoQJMZmjcccPPC7bTnjrb519MrzL3CwEZyQ== X-Gm-Gg: AYBFou04P2KPqBIKIyqkjaTdQndrX/9xlyGW/0yquEDHcKbYQXUZP37B0u05YPw8oVo gKv7s9LKMJ8uhDDGtzy3G9SPrNG8RjwdnAe6oRKAiX2T6KLONf8PNkR1h8/Uogx+4By+gdu6/AK zz8lF7welABmpd/xYlapRBEZuGi41lC2UzS3dD0mUFJmu34RbD4c3WukJh0gwnKpjl+VHcUiJ+m FYsodIrdD0UPIw4NyskhRcHy49AeaV8rENfOqzhQdxquEIovufffzKHSJLE7BXNc46a6BDnPtk2 fFdrv7SQVwUVTJG5joAabKHTdSEKy5VOMMM577f/Uouhw69ofjQ8942x1AiD0RDXzfRMmReReWr 760mFLGy1izmVz9/9+qC954/nLEkl+8SvyGouxRPGneXiluz+bnaY7+JTeI6V4mPW+IVcKgc= X-Received: by 2002:a17:90b:3d8d:b0:39e:6c68:fd8c with SMTP id 98e67ed59e1d1-3a0736b0193mr789249a91.33.1790084393183; Tue, 22 Sep 2026 06:39:53 -0700 (PDT) X-Received: by 2002:a17:90b:3d8d:b0:39e:6c68:fd8c with SMTP id 98e67ed59e1d1-3a0736b0193mr789219a91.33.1790084392633; Tue, 22 Sep 2026 06:39:52 -0700 (PDT) Received: from [10.133.33.241] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3a067409854sm4883133a91.7.2026.09.22.06.39.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Sep 2026 06:39:52 -0700 (PDT) Message-ID: <4f0915c0-5950-4e45-a72b-0db2942f00b5@oss.qualcomm.com> Date: Tue, 22 Sep 2026 21:39:47 +0800 Precedence: bulk X-Mailing-List: driver-core@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/2] cpufreq: fix schedutil not returning to non-boost freq when boost is disabled To: Ananthu C V Cc: Vincent Guittot , Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Viresh Kumar , linux-kernel@vger.kernel.org, driver-core@lists.linux.dev, linux-pm@vger.kernel.org, Sibi Sankar , zhongqiu.han@oss.qualcomm.com References: <20260908-schedutil-boost-frequency-handling-v2-0-25312a713699@oss.qualcomm.com> <20260908-schedutil-boost-frequency-handling-v2-2-25312a713699@oss.qualcomm.com> <05c00750-7fc2-49d4-9336-7beb33fd9380@oss.qualcomm.com> Content-Language: en-US From: Zhongqiu Han In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: iz7YsrUcvgObd99rL-sbRaXQ6lKZv69R X-Authority-Analysis: v=2.4 cv=KqHYSmWN c=1 sm=1 tr=0 ts=6ab2852a cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=WZsD97d4U260xpjQMLoA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=iS9zxrgQBfv6-_F4QbHw:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTIyMDE5OCBTYWx0ZWRfX0wcIbDg9ryEo eHAdvF32SLDqFOd7UL0euhskYgD34QPAu2AdH6FPqman9NIMeDoKXd8w2Vz8zqGXLcYgQMekCt+ iiGQCNCUlrl6Ss/zbrR071weJpGu+Dz6wkOHPk5M/igWr/fVSoKPzQI9d9f/icIasvHuLM9hSVn dDHNRjNyPzBj8paCC/+gn1nqHJRZVDznizFEva25FmvUFQOoGQIanPocXE87qyrvYweJWoJURT5 PRVX8NSLUrY+710WjXb9LlTTnLA1qVnZqgEAWTQisNwJF3JHfuQChgtspBaQjJq1+6GgUttfYby oQJyRU31V6hXNUq1qlgow1vf3+JZzEnul2OLTLJAAJpFeri+4l3tc1PY6g0/aOTne8X8DNxIH1a pJCecr/TMegBX63gK6H3/utOaGCMUKU2bgbY7gkzw17M8NeNBMQk6WJ3kJYBCH4pOtdfXRYuNT7 QzO9oeWJLiRP1cnBArA== X-Proofpoint-ORIG-GUID: iz7YsrUcvgObd99rL-sbRaXQ6lKZv69R X-Proofpoint-Spam-Info: AW1haW4tMjYwOTIyMDE5OCBTYWx0ZWRfX6Ya2rYTVBz+c 93a32RSOXuwvkEsAeguBPnp8AZRMf1vfDxWbyaCJrrpuVcLVv/O30xQ3RL180bBsSU/ypZ6240S Zs79dm4hdE/PJFmgua79G6cuhnYuP9o= 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-09-22_01,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 bulkscore=0 priorityscore=1501 phishscore=0 malwarescore=0 suspectscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609220198 Hi Ananthu, On 9/21/2026 6:34 PM, Ananthu C V wrote: > Hi Zhongqiu, > > On Fri, Sep 18, 2026 at 05:15:07PM +0800, Zhongqiu Han wrote: >> Hi Ananthu, >> >> On 9/8/2026 4:30 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, >>> causing cpuinfo max 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. When a freq table is available, use max_table_freq/ >>> max_base_freq instead of cpuinfo->max_freq to control boost values, so >>> the value can decrease again when boost is disabled. >> >> This issue does not appear to be limited to schedutil, so the subject >> seems too restrictive. > > That makes sense, I'll update it on the next run. > >>> >>> Fixes: 538b0188da46 ("cpufreq: ACPI: Set cpuinfo.max_freq directly if max boost is known") >> >> I already commented on the Fixes: tag in v1. >> https://lore.kernel.org/all/3a20b69e-b072-4723-925f-514d8162e259@oss.qualcomm.com/#t >> >> IMO it should be: 6e39ba4e5a82 ("cpufreq: Add boost_freq_req QoS >> request") >> >> Could you please comment on this? > > The specific issue we are trying to fix is that once boost is disabled the > frequency is not able to come down to a non boost value, which was introduced > by the upward guard added in 538b0188da46. Consequently, if that guard is removed, > the issue does not exist. So it makes sense to add a fixes for that specific > commit. I just did some testing with the SCMI driver on the SM8850 platform, and the results matched my previous v1 comments[1]: 02/15/2021 538b0188da46 ("cpufreq: ACPI: Set cpuinfo.max_freq directly if max boost is known") ---> Not reproduced 03/26/2026 6e39ba4e5a82 ("cpufreq: Add boost_freq_req QoS request") ---> Not reproduced 03/28/2026 db80ad776cd2 ("cpufreq: Remove driver default policy->min /max init") ---> Reproduced the issue [1]: https://lore.kernel.org/all/3a20b69e-b072-4723-925f-514d8162e259@oss.qualcomm.com/#t 538b0188da46 made cpuinfo.max_freq increase-only, so it stays pinned at the boost frequency once boost has been enabled. This stayed harmless because cpufreq_frequency_table_cpuinfo() also assigned policy->max = max_freq; directly, recomputed per boost state on every call. 6e39ba4e5a82 moved the boost QoS update to the dirty cpuinfo.max_freq, but since that value is unchanged on disable, freq_qos_update_request() bails out early, cpufreq_set_policy() is never invoked and the directly written policy->max survives, so the bug remained invisible. db80ad776cd2 then deleted policy->max = max_freq;, leaving nothing to bring policy->max back down from the boost value that cpufreq_set_policy() had installed when boost was enabled. Correcting myself: from the point of view of where the issue first becomes reproducible, the Fixes tag can be: Fixes: db80ad776cd2 ("cpufreq: Remove driver default policy->min/max init") Comments are welcome. > >>> Signed-off-by: Ananthu C V >>> --- >>> drivers/cpufreq/cpufreq.c | 14 +++++++++++++- >>> drivers/cpufreq/freq_table.c | 5 +++++ >>> include/linux/cpufreq.h | 1 + >>> 3 files changed, 19 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c >>> index 0d0df986fa3d..a13e72711597 100644 >>> --- a/drivers/cpufreq/cpufreq.c >>> +++ b/drivers/cpufreq/cpufreq.c >>> @@ -574,6 +574,7 @@ 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; >>> int ret; >>> if (policy->boost_enabled == enable) >>> @@ -587,7 +588,18 @@ 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); >>> + if (policy->freq_table) { >> >> acpi-cpufreq has a freq table but never sets CPUFREQ_BOOST_FREQ, so >> max_table_freq == max_base_freq == _PSS P0 here, and the real boost >> ceiling kept in cpuinfo.max_freq is lost. It seems that the condition >> needs to be "does the freq table list boost frequencies" rather than "is >> there a freq table" — e.g. recorded during the table scan, the same way >> boost_supported is derived from the flags in >> cpufreq_table_validate_and_sort(). And then: >> >> if (policy->cpuinfo.boost_in_table) { >> xxx; >> } > > That makes sense. I think the best thing to do here will be to export/move > policy_has_boost_freq from freq_table.c and reuse it. Comments on this are > welcome. > >>> + max_freq = enable ? policy->cpuinfo.max_table_freq : >>> + policy->cpuinfo.max_base_freq; >>> + >>> + if (!max_freq) >>> + /* when the freq table contains only boost frequencies */ >>> + max_freq = policy->cpuinfo.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 4984142dc08a..7e183e16162d 100644 >>> --- a/drivers/cpufreq/freq_table.c >>> +++ b/drivers/cpufreq/freq_table.c >>> @@ -34,6 +34,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy) >>> unsigned int min_freq = ~0; >>> unsigned int max_freq = 0; >>> unsigned int max_table_freq = 0; >>> + unsigned int max_base_freq = 0; >>> unsigned int freq, i; >>> cpufreq_for_each_valid_entry_idx(pos, table, i) { >>> @@ -42,6 +43,9 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy) >>> if (freq > max_table_freq) >>> max_table_freq = freq; >>> + 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; >>> @@ -62,6 +66,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy) >>> policy->cpuinfo.max_freq = max_freq; >>> policy->cpuinfo.max_table_freq = max_table_freq; >>> + policy->cpuinfo.max_base_freq = max_base_freq; >>> if (min_freq == ~0) >>> return -EINVAL; >>> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h >>> index 3f3b1380251a..419c71ccff7c 100644 >>> --- a/include/linux/cpufreq.h >>> +++ b/include/linux/cpufreq.h >>> @@ -46,6 +46,7 @@ struct cpufreq_cpuinfo { >>> unsigned int max_freq; >>> unsigned int min_freq; >>> unsigned int max_table_freq; /* Highest valid frequency in the table */ >>> + unsigned int max_base_freq; /* Highest non-boost frequency in the table */ >>> /* in 10^(-9) s = nanoseconds */ >>> unsigned int transition_latency; >>> >> >> >> -- >> Thx and BRs, >> Zhongqiu Han > > Best, > Ananthu -- Thx and BRs, Zhongqiu Han