From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796292812; b=P3qJrHIVHfcTCkb9ZjdY5tHyhKX0GjkOCC15Vabd2e3YA7o1kqQaxoqrNjjrY0sy7YVN vi+71HH1Q/oqenP3xXS0k9qq5U5jO7210Pzb2S3dwn9vhOtkU8YhRvzZCqdkFkETicgQB REnq9mrQS8DeK5fC6UALLRo71MmFp4I+XK1QoBB2tRgBjDimkSTwdNFvcpacpAzzKOAzy j02JM0EWgA9SrJjNa6HhsCCOe+t4gPdMGbvmbdp+d1RdfMl/0sHsi88VUhSmWgzBjOqZQ W7YnICRQrfS9ZJCBflEze1cHJ4sm/TfBTDd0fEbjA8YqFxhU+XANG/oLSu41aSjH2Gg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796292812; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg: X-Received:X-Received:Received:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-Proofpoint-GUID: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Spam-Info: X-Proofpoint-ORIG-GUID:X-Authority-Analysis: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=O0t66kbLq/IMdxFC8aj4qcf8A+7Y5Nc1PpxfnSh96xU=; b=F0jjmY+wCcFbQ/xcUUzNCWHak4HCu3M8HNV6mUxTAn6Qmv7cO7PlYtUzikZDpwWQjrM1 tiVjHFUhRGIaJMV7PrGNvcgZz8EYfsaux8dT7LUG4HfeXqz16nQFFjaBjknuZMrScdDgM xY23L2h5G5nMU+EjiHUB5oscDx3QJU5+7TWYEQwt5IAt2cJakX8sM/kzOVBCIGVMwqW7k eAeLfVbN6WJu6HZNWt6gSJq13P1Z0zAiVEzPNIQ6Qfa9OuKpy6Sho/LyVKGXq58nWen/N XMseEBzmWvWS3I0gqZ/3nsz+NlfyUlJeP4AEdomPQSn78UrAnM/Z5SF5dEV/Krp3oAQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=WlDYo3+8; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=bG2LJZXP; arc=none smtp.remote-ip=205.220.180.131 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36EE3606A322 for ; Thu, 3 Dec 2026 10:13:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 36EE3606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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.a=rsa-sha256 header.s=qcppdkim1 header.b=WlDYo3+8; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=bG2LJZXP Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B39KQee3580448 for ; Thu, 3 Dec 2026 10:13:31 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= O0t66kbLq/IMdxFC8aj4qcf8A+7Y5Nc1PpxfnSh96xU=; b=WlDYo3+8/nt3Kg+4 YlV6LD7fXCQYwlcU15vusFsOe+CDKINARTdgcM2+GZGdZON3MMNbdzUg1wd6MkkF qcN1Doo0nalaOzbJTE5rktjZ3wFi7V3b6J/5QScZO29Vzd9a2huiN1dUdaUZ/2sJ 8ak5FXN+a9yJ/XdZisGzLE9MagPkFS5OwC268BC1/kXfUOfEDG641K0dHnpKMqKX iSLDfIzkyKsbrvRdSlX1Mq0YuDoR/5GjSzOgPwStmKx5ALP1X4wk3dPebEECTDXp GAq60z8UwOMZjH3nqub5TAtcumkvFSeTQfzOTs4aRoLtKRngr/fck4dXzR1WSwsK hKgB5A== Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jb5q5r8e2-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 03 Dec 2026 10:13:30 +0000 (GMT) Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-8aa185840bdso10606949b3a.3 for ; Thu, 03 Dec 2026 02:13:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796292810; x=1796897610; 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=O0t66kbLq/IMdxFC8aj4qcf8A+7Y5Nc1PpxfnSh96xU=; b=bG2LJZXP125C31StULFpQhlhQLaBIHD6T/mQRZAAXhe8TaCmmcq0UwDK+on5LrE2sx ABXcCSNOz6cLFLn+UvauOJNV/T0nb5lerBavHDoCmL0AjVSXCRYHIGHyZwOvtmf35mY9 UKpispvx+Q4yg5l8i8CN4lyfVax9gec4KZJe/uaFVfsSLbJr8fngyr5fD8r1GMiOQRP7 8rtNYIHU4tm+Hjq2GDgUlUEfMslbl/DX/Cmbff15Ii1l5D99C1vf4UuuRbgXPer1dXzM 4g8P7+wmdfMugw1rjyxaWFKJQgNCsHNJ/PeJLXIrvSjLLozKV/EU69aLgOCHa/SgDQNJ SwdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796292810; x=1796897610; 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=O0t66kbLq/IMdxFC8aj4qcf8A+7Y5Nc1PpxfnSh96xU=; b=sUenINJLL6fpMN86cS/dIPL8ypMMXjoG6D27is/aAghWdUchtNY2FGkaI2urtBQG+w oyOFvdLTN3snxjpx8I+oHY6ZC7/uyDCj5jgxIJrku7TBDE6+gcu6yFpHu0njT1VoLHja Cj3J7m3b1rAbwXRb81tNlizteLqJ4TQ1GpkjjJPTYttR44pB199Ecx+3dD6P9fE4errw 8n2cRWzdF9TQTK5uDO6sdVz9esyAmnxkMdTpBvjUeMawzYQyXjctw0d+oRw7ZQ8Pqf1l gNEI3DyR/CcJfT44ivffvRFpp+4leIL6qu8Njfwvfrc3r74QUg6yJY5JYShbYbBZCpJ/ nVZA== X-Gm-Message-State: APuU4Z8/QxiJMnzn7WmqEEDIu0JioEPo6ZjVZnQ6gMFlO0YLABF5X7zY KzggFAFsakpNlAGgLxAniSGr5PdK9DJrlFlI9TIG3UJq0aADTZ56v6w7q84iUCLhuk1jjJ3z5Cm bKmkkLWrQ/JdnPuQEROoQqqX3L6KWlDju0zBGwMTw7KVBA8QAnm+s4oJ22jsjPw== X-Gm-Gg: AZFdTZe0BvqgonRoNdGli/SYjOJ4/T1uOgoqmtpmgMS5Ue4DXOK70sJ/WFkNI9YVRNg 7MIKaJVv8F0tQeKzsGn1CJ7nhir8VDe5reDeRzl1Xgf0NguuPo0yYxQJy00lKj7BKBmOfL4U1Ug ZKrreFFLMKAv7tRy/1m+X+Dqjd2lMJ9QI1eZV2rzJKwUb2mnMwKfm1Xh9PpG8Nn9r0vQbB55THN E1KTu++nsNv82cgwPNVtzrWJOd5/y4jsqDcis9XlBPF5x6uQlMRhLenpwX16mOHIU8VCOVcwlpQ 0C3txoSsYZmbhQ+nKjVJi6kOfJbMhGHql5SAM+/4pLFUXY+NuLoVg+GbwcHZSEDuSd/OzpkTYmw mR2Pwgx7Wg7D6tx1umVdxLNaGNRCPZ/Et2tkiZOycgpP3QDYvwLcySt4bXIdmFo5K7KG5UGk8id q6f2FTrEXq4y1P974Wb3WidBbn9q72JxpxLttwg9JkYHnY X-Received: by 2002:a05:6a00:1f0a:b0:881:9f52:ca00 with SMTP id d2e1a72fcca58-8c87cb4b0demr37770405b3a.42.1796292809649; Thu, 03 Dec 2026 02:13:29 -0800 (PST) X-Received: by 2002:a05:6a00:1f0a:b0:881:9f52:ca00 with SMTP id d2e1a72fcca58-8c87cb4b0demr37770386b3a.42.1796292809095; Thu, 03 Dec 2026 02:13:29 -0800 (PST) Received: from [10.133.33.245] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c872e45eccsm23849117b3a.31.2026.12.03.02.13.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Dec 2026 02:13:28 -0800 (PST) Message-ID: Date: Thu, 3 Dec 2026 18:13:24 +0800 X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 0/2] cpufreq: Keep global boost enabled after partial enable To: Jiangtian Feng , rafael@kernel.org, viresh.kumar@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, christian.loehle@arm.com, ananthu.cv@oss.qualcomm.com, pierre.gondois@arm.com, zhangpengjie2@huawei.com, zhenglifeng1@huawei.com, zhanjie9@hisilicon.com, Zhongqiu Han References: <20261201023001.1131130-1-jiangtianfeng@linux.alibaba.com> Content-Language: en-US From: Zhongqiu Han In-Reply-To: <20261201023001.1131130-1-jiangtianfeng@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: pZGihgnmDwmRK-rGDDXsGt-Le5fcfXGD X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAzMDA0MCBTYWx0ZWRfX2YHGTpHT91+H b7Abjy7lkGJGyHG1TOswNKqpWuhXC3KY9B1XayF1Nm9a14GJxyogksdEIA/Eolur2ZCzKX11oHz M22Xe9jVyZ6iIpvs7M7x2f7VjKrLruXSQRPfF6obOrVvUG0vUiBKH2SSs5S7r8TLMoGfVns2/tA yGnG/Koy5C0hEz+HwbnP6bRxkz+5NOXuduzUvOdT1Gy2R6ZCbaCOWEBh7T31HZERB2DU1fcPAe1 Otwyen91B4U1yWA2mJ43jtMkmkLSyQMrI63YkHCi/FJOvzYgnzFxcLRd8X+f0H9AGb2oKKZxNa5 KmaKz687u9Gjh7RfmMQTUjpRa+bEvoAfSXf/2FhlOcBFvLwrfIEUGvqAqIxYYsaRTBjaMg3GQ5v WX8ZtirvSrRXTRlpI3IaySoVmPthHjkXpcHJhTEYQoM6OlSBfrY9UFUf9W5DYLL9Ij6CmJe89rI /lM3ZiBLybqw5OmJVWw== X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAzMDA0MCBTYWx0ZWRfXztgT7Wot+s5o zvMbnoz+JnTQK2TPCu7KS/eKnwlcpEPfiq2HM3SYB2RJO4bo4H9d453JIx0DM+gGBIMVJcCa2rL KCgIpgURWiQ1uRczK5itLMDOsqn0POs= X-Proofpoint-ORIG-GUID: pZGihgnmDwmRK-rGDDXsGt-Le5fcfXGD X-Authority-Analysis: v=2.4 cv=Sa5i5fRu c=1 sm=1 tr=0 ts=6b1140ca cx=c_pps a=mDZGXZTwRPZaeRUbqKGCBw==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=VwQbUJbxAAAA:8 a=SRrdq9N9AAAA:8 a=i0EeH86SAAAA:8 a=ZoXmVBQ82pD0bBm7T1cA:9 a=QEXdDO2ut3YA:10 a=zc0IvFSfCIW2DFIPzwfm:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-03_02,2026-12-02_07,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 adultscore=0 spamscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612030040 On 12/1/2026 10:29 AM, Jiangtian Feng wrote: > This series treats global boost as a persistent permission that userspace > can configure even when no active policy currently supports boost. > > The first patch initializes ret to 0 so the no-active-capable-policy case > records the requested setting and returns success. The active-policy loop > is unchanged: active, boost-capable policies are still updated through > policy_set_boost(), and real callback failures are preserved. This > intentionally removes the no-policy -EOPNOTSUPP result introduced by > 77cf053b041f, which userspace sees as an -EINVAL write failure. > > This also handles the CPPC default-enabled case: userspace can disable > boost before a capable policy becomes available instead of having a failed > write leave the global permission enabled. > > The second patch is the existing partial-enable change. If enabling at > least one policy succeeds before a later failure, global boost remains > enabled so that the valid mixed per-policy state remains locally > repairable. Disable and no-success failure paths retain their previous > behavior. Behavior change of this series relative to the current code, based on code reading and QEMU testing (with a fake cpufreq driver that injects ->set_boost() failures): The result of a global boost write depends on whether, at the time of the write, there is any policy that is active (at least one CPU online) and supports boost. 1. None: no policy supports boost, or all boost-capable policies are offline. - Currently: writing 0 and writing 1 both return -EINVAL (even if the value is unchanged), and global boost is restored to its previous value. Userspace cannot change it; e.g. if it defaults to 1, it cannot be turned off. - With patch 1: the write succeeds and reads back the written value, but it is only a permission. No policy is changed at write time; boost capable policies are handled by cpufreq_online() (unchanged by this series) when they come online. Writing 0 applies to every policy that comes online afterwards. Writing 1 applies only to newly created policies; a re-onlined policy keeps the value it had before going offline. If no policy supports boost, the write only changes the value read back. 2. Some: at least one policy is active and supports boost. - Currently: policies are set one by one in order (a policy already at the value counts as success). Offline policies are skipped and are likewise handled by cpufreq_online() when they come online. The loop stops at the first failure and returns -EINVAL. Policies already updated are not rolled back, and global boost is restored to its previous value. If writing 1 fails after some policy was already set to 1, global boost is left at 0 while those policies remain boosted. Their own boost files cannot change them; options include writing global 0 (which disables all) or writing 1 again after the fault is cleared. - With patch 2: only a failed write of 1 changes. If some policy was set to 1 successfully before the failure (including one that was already 1), global boost stays 1, but -EINVAL is still returned; otherwise the previous value is restored. Writing 0 behaves as before. Patch 1 only changes case 1, patch 2 only changes case 2, and the two are functionally independent. > > Base: Linux v7.4-rc5 > fe6ff8d5d675c01793b9f051d16055dd4aa75244 > > Changes in v6: > - Simplify patch 1 to ret = 0, restore for_each_active_policy(), and drop > the v5 any_boost_supported tracking. > - Explicitly document the intentional no-policy ABI change from > 77cf053b041f and the CPPC default-enabled motivation. > - Keep patch 2 code unchanged and add Pengjie's Reviewed-by. > > Previous version: > https://lore.kernel.org/all/20261130111348.363810-1-jiangtianfeng@linux.alibaba.com/ > > Pengjie's default-enabled review: > https://lore.kernel.org/all/467b9ef5-1fc3-4771-9895-363e815670c7@huawei.com/ > > CPPC default boost change: > https://lore.kernel.org/all/20261118013558.3075038-1-zhangpengjie2@huawei.com/ Just for review reference, here is how I understand the revision history: v6 - P1: initialize ret to 0, so that a global write of 0/1 succeeds when there is no active boost-capable policy, instead of returning the -EOPNOTSUPP introduced by 77cf053b041f; when CPPC enables boost by default [1], userspace can write 0 to disable it (Pengjie) - Drop the for_each_policy() walk and any_boost_supported that v5 used to decide whether to return -EOPNOTSUPP; the loop goes back to for_each_active_policy(); relative to mainline, P1 only changes ret = 0 - P2: no code change, add Pengjie's Reviewed-by - https://lore.kernel.org/all/20261201023001.1131130-1-jiangtianfeng@linux.alibaba.com/ v5 - New P1: allow the global write when all boost-capable policies are inactive; still return the -EOPNOTSUPP from 77cf053b041f when no policy supports boost at all (Pengjie) - P2: no logic change - https://lore.kernel.org/all/20261130111348.363810-1-jiangtianfeng@linux.alibaba.com/ v4 - Drop RFC, add Zhongqiu's Reviewed-by, no code change - https://lore.kernel.org/all/20261127090513.910723-1-jiangtianfeng@linux.alibaba.com/ RFC v3 - Reword the changelog (drop the "same-state resynchronization" wording left over from v1) and the code comment (left over from v1's goto branch) to match the code (Zhongqiu) - Add version change notes and links to the previous versions (Zhongqiu) - No logic change - https://lore.kernel.org/all/20261127060407.732709-1-jiangtianfeng@linux.alibaba.com/ RFC v2 - Drop the goto since the function uses guard(); simplify the restore condition to !state || !policy_success (Zhongqiu) - https://lore.kernel.org/all/20261127014937.413500-1-jiangtianfeng@linux.alibaba.com/ RFC v1 - https://lore.kernel.org/all/20261126110903.3747240-1-jiangtianfeng@linux.alibaba.com/ [1] CPPC default boost change: https://lore.kernel.org/all/20261118013558.3075038-1-zhangpengjie2@huawei.com/ > > Validation: > - ARM64 W=1 build of drivers/cpufreq/cpufreq.o with Buildroot GCC 13.3.0 > and binutils 2.43.1. > - Complete ARM64 Image build; size 43,010,560 bytes, SHA-256 > d8bd08acc9584356805575d8b7fcbf758b85d2173787df23c11c71faf4525953. > - Static state-matrix and policy-list locking/lifetime review covering > no-policy, no-support, inactive-capable, active success/failure, > partial-enable and subsequent online behavior. > - Independent review found no High/Medium/Low functional code issue in the > two-patch candidate; the commit-description findings were corrected. > - Final signed patches: checkpatch 0 errors and 0 warnings for both patches. > > NOT_RUN: > - CPU hotplug, suspend/resume, driver unregister/global-write concurrency, > lockdep and KCSAN testing. > - CPPC, ACPI, AMD and ARM hardware frequency/QoS testing. > - Runtime fault injection for policy_set_boost() failures. > - The existing policy-online callback-failure handling is unchanged and is > not claimed to be fixed by this series. > > Qoder, an AI coding assistant, helped analyze the review history, design > and draft the preparatory change, and review the state matrix and failure > paths. The submitter reviewed the resulting changes and is responsible for > the final validation and submission. -- Thx and BRs, Zhongqiu Han