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=vFM6ZcPJv2daubRawvR+qUt72KBV90PPqbm2ZHbsXLFXhq3snxZwftjRR2eJ8gQiYWM6 uVOBDd5Sbfw/QEstV2X0Nd+21WmzxBrboux7llWqUzUgKZjQZZuT6qvq0q+3CRqMpAOHH hSQkAeoG5dclzjWuLSVtENCa0B5+vkkze5owBYGMxguuz2lkDSnV7zUMN69GEQvjzYMOt m7oqYeVaBl4256wU2+LIAbBsjOVWib7VchQxPr50nRhHG/X8l0+CW0nnzSVq3bQ/hGZAq Mms65SUDGoJTyQcLWrOIJvkA80Nv84Kpbzn2htYxOPaocJJM63EB/3rk9L0P1CV4tCg== 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-Forwarded-Encrypted: 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-ORIG-GUID:X-Proofpoint-GUID: X-Authority-Analysis:X-Proofpoint-Spam-Info: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=O0t66kbLq/IMdxFC8aj4qcf8A+7Y5Nc1PpxfnSh96xU=; b=dylgjjWuK4qeUbkjxK7WYfoRG2mFOOcEMQ4R4PVOb8ORTL5XtJrmrEYHlfuti6XTcz4Q AALAbHBdxEj5V1sWzZ1vG9aO3hB2/1OcPspfiDcgrWbP+6Knir1A81xhrNm2p4nf4Wg+C /tFQzap/m2peePzWtSDbD/+ki5oQNqCerlq+d8TFTfztl2BKOoiBk0oLEIpkTLD8DEHLt ZxIu2NA9WtvtjFxU90rsaaavziMqihYscLVXapaOsVJA5FusnknkbNanU8mVnDjGbZ8k1 xEhBTsmPaGtxfU6WnAs25czE3pcaqMInaJcXX+olcmiy09CXRumn221oPg090W9Tueg== 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 513D4606A32C for ; Thu, 3 Dec 2026 10:13:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 513D4606A32C 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 (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B36kWKU607851 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-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jayjdsy92-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 03 Dec 2026 10:13:31 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-8c5408e418bso10365352b3a.0 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=csCAIzeHo+HapGe70v+uDz60PcTFA0MWHxBFLiohAYIwvHV9Cna3SZoqM6sdRrfbBb SiXwvPthfKyAr2hbBTziPCb7aP6W0/gemxqihhWzYZFaCZmIwGv4jdxUYrGTanuBkiEa +kYkxLQf7FkG2q63pnaIZmfcR+Cl5GXQEgsF7b1c3SC87k4ycuCY1NviobcpmUFj/oJW j2SLNUXElXY3YfSzLXCJsFglwcPWujDpAad8Xm8iXJMprISUGMHQgY+jDztJn1cURzxg u52ol1UCNqPdy0vWDWrbU/EFxXnnIUY99lAdSbAoh6hEcbluRpmESeOqKQaJ2/PkN2g5 T0Ng== X-Forwarded-Encrypted: i=1; AL+hErH/BdHp2npIq/oCy2b1GnPvy+lQGXp+YPl54P/mTAtyTS2N1Eu3PuTDn/5TWOoDzHfZmQm/iXIG0UFswSU=@vger.kernel.org X-Gm-Message-State: APuU4Z+ru8I2jvVkdQqCWmz3eCzul6BPZALTCXV43/67ddFORCza0IdF qd4Y52F6MFn9lKOXVED7qYXRvTGjOrPdTZDnwwvKEL2wwhut6r0m22xTi+A8zf/aOIpzpkkPWew MGXlds2/ulsl0db1a2CKjSxcGcBuNjhelHfMGO1pZ1ijXQuk/hHERELBkvi2fxcp790Q= X-Gm-Gg: AZFdTZfm/HUK9n/N2foC0d7GrYWUBDJr90OKg3xo9pGKTniNyB2hZ0OmB6xs3jD8n3z lSeUwZ0tmEesigiuTahDTjfaqGmlWM4rPLiqU7cwAoSDmZY/tiLk6HH/VC5XS5+i9GXU9/B01s9 OpMTCbamjHgdz/kI9d4jvQt4U7ORdIWE31wZIN/KUSkf6CkPqvLXPkz1esqvIWuwTvbsKafL2hR XZH3Xd1lShmbtTQzIsGWdB1V2FbqZxrsKcbgWzSeNqxRRkhNdLQeNTwPw2ch9sFWpv4hmZQzKxC Ho5GIbg7Od13XB3a/6FqX3oW/01ACwsNtb9QoNxM7aTOhvjuUzTEncOlm9YREWXdbBlqnvMidcC MtFkTJ0UrROUdcDvOnm7hXWMtdg4JHkmh/kUe6eW6OhaIdGdfrJpEJtMQzX0QT/dPeBZHv+h/Tj IxwT/loInfMB2t8HIGDRICv7ui7D0SCnD+cTNUOoZrOCCd X-Received: by 2002:a05:6a00:1f0a:b0:881:9f52:ca00 with SMTP id d2e1a72fcca58-8c87cb4b0demr37770412b3a.42.1796292809667; 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-kernel@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-ORIG-GUID: NWLyeGYM8fPAzDvd0q_4P4SNLm1EMyJK X-Proofpoint-GUID: NWLyeGYM8fPAzDvd0q_4P4SNLm1EMyJK X-Authority-Analysis: v=2.4 cv=QpLLTlyd c=1 sm=1 tr=0 ts=6b1140cb cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=VwQbUJbxAAAA:8 a=SRrdq9N9AAAA:8 a=i0EeH86SAAAA:8 a=ZoXmVBQ82pD0bBm7T1cA:9 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAzMDA0MCBTYWx0ZWRfXyggLGaMLYYWX tHn4vfeAwv3kEwg8rGNyJL8j3+/Tsz4O+C55swNaj2+U1h3EgWZmJQJSXEhzHStPGrct/Rlv5/7 xbZ1AW4q5rhK/2mEamU51RMulNVg9V0= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAzMDA0MCBTYWx0ZWRfX7Tlz6KoCWsN+ KZeV+qDNE5gSM9lRWVRpUCSjuI4fjFLHVeIib/l5iRjJu5nq7MGJNUxkU3m4wwPzVj/71lw7U58 QAqNy4TwckFDO2JtL4VJsGW1dBGfo4eAHhLFUjoEXkp9DEO4WuU23ix2TfheAG4UZRYf/je3uAd Lw1kl6rKPzrotDlonn/jMGKiqtWng1UprrY6q3MP8aX/mYRaEU53BgLXJwsWhB6rh3Pd/PZBv3Q 62KwF8DFKtlNn/Bxz5W9+9VwuRfNq2Jx1dhR/oj4JSowv3wl33eahzIVhRFHnjuJSSYi1BECuzI VfxEm8ZLin2VhXk5iwK9sI0R7VKZirL8x7GXN99CS+jwZLOOuQ0AOSKq09fqY+ogb3AfsV6hHAG 6hi4/BAsGOszkc89dQuLUDUPZEDGUA4U2cps0vHwMcjJ9ZfcAZXkig0yIEhIJM1uWYO12GKX42i 8Rkly/hhVWV7wtOKAkA== 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 suspectscore=0 malwarescore=0 spamscore=0 bulkscore=0 adultscore=0 phishscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 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