From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=113.46.200.218 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796046578; b=LmFLUZ2sQ4T1u/MehjcyK+oKVvDcyQ+8qdXLbrrlqSm8JXs6JaFp7Ck4T1yX1DtHryGF dMRzo1jG/CJQdVt0irZMHO1tjOjInijgEdnFqa55aZHU1s8gUMeRrOFS5v6RfX+gbahYP bawFAhLM75IWTlj5dLEbO94k0v4OBYCR2pBuV5bbyVL2xfrcCmp3mhExJyM9IhFmc93dl jkpjpT570xdwAawn8VtOKH8l75GzsZnxJFrAqfgMtDQb5RpEoR/hpkeFVxzxyspKtkBCw VxiG3gHXhRisZu6EUN5WIfQWp01tHRYu2Q5FBLda6t7FeFJeG908aaDaGVRYIefYqrg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796046578; h=DMARC-Filter:dkim-signature:Received:Received:Received:Message-ID: Date:MIME-Version:User-Agent:Subject:To:CC:References:From: In-Reply-To:Content-Type:Content-Transfer-Encoding:X-Originating-IP: X-ClientProxiedBy; bh=c7cYl/Y3Za+IvdWBwwXwMBVLmWtMcpz7MlpERp6nG1w=; b=H+3a3Mjk2yza3/Z1OnKWr9w5wy5oOHGj6nP5THocubWJKapw26ajVHnpCYOHnPE6s7k4 nr549j86BP9UFYF3/vo9nAKjxEicEUogi9Qq3zy6qTOD84n3IkartLdpzKspRmPcCpeDz k0ISdF4Dbmw0CoLB/ZcXTKLmzwxFnlolKVnocQmwcR8Mw+xF4dRb/83yt1UDjfYqab+yO R6iprx3gl5IZWqcRuHyn5bE9z3qWrQX9c2IoORsssknmtLZi5u1vsYnnB+rp+4iUTK2KF /3mAFYJs5enAcO5n9ldIkAuTr+vxnsi5adbruaV18fnnR0IRipXkz7VbYnbWZEBUl8Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b="RMzqW/Uk"; arc=none smtp.remote-ip=113.46.200.218 Received: from canpmsgout03.his.huawei.com (canpmsgout03.his.huawei.com [113.46.200.218]) (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 F1385606A31C; Mon, 30 Nov 2026 13:49:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F1385606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=RMzqW/Uk dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=c7cYl/Y3Za+IvdWBwwXwMBVLmWtMcpz7MlpERp6nG1w=; b=RMzqW/UkXa0QXbZbuBqE9l0/5NkaxxIyMcZxjld4/GSXdGNwxb+R7gsBsDiAbttzFALvnPaLD rRwOBKHXbcgMDxaxoqCzDeYeC32Fh5g2Qnu9+tClj5tvr/pX2itm+fAJUTARkpv6+Mfbv5k0iET wbB1m0YEnn0ILk08kb7gMfg= Received: from mail.maildlp.com (unknown [172.19.162.140]) by canpmsgout03.his.huawei.com (SkyGuard) with ESMTPS id 4jdQMj5KHgzpTN8; Mon, 30 Nov 2026 21:48:17 +0800 (CST) Received: from kwepemr200004.china.huawei.com (unknown [7.202.195.241]) by mail.maildlp.com (Postfix) with ESMTPS id 4EE21203AB; Mon, 30 Nov 2026 21:49:29 +0800 (CST) Received: from [10.67.121.62] (10.67.121.62) by kwepemr200004.china.huawei.com (7.202.195.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.45; Mon, 30 Nov 2026 21:49:28 +0800 Message-ID: <467b9ef5-1fc3-4771-9895-363e815670c7@huawei.com> Date: Mon, 30 Nov 2026 21:49:28 +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 1/2] cpufreq: Allow global boost updates with inactive capable policies To: Jiangtian Feng , , CC: , , , , , , , References: <20261130111348.363810-1-jiangtianfeng@linux.alibaba.com> <20261130111348.363810-2-jiangtianfeng@linux.alibaba.com> From: Pengjie Zhang In-Reply-To: <20261130111348.363810-2-jiangtianfeng@linux.alibaba.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: kwepems500001.china.huawei.com (7.221.188.70) To kwepemr200004.china.huawei.com (7.202.195.241) Hi Jiangtian, Thanks for handling the offline case in v5. With 5785772fe9e6 ("cpufreq: CPPC: Enable boost by default") [1] in linux-pm/linux-next, the global boost knob can start at 1 on a CPPC system where no registered policy supports boost. With the v5 core changes applied on top, writing 0 would still return -EINVAL and leave the knob at 1. I understand that 77cf053b041f deliberately made this an error. Since the global knob controls permission to boost, could we let userspace write either 0 or 1 and read that value back even when no policy supports boost? A successful write of 0 must leave boost disabled on every active policy that supports it. [1] https://lore.kernel.org/all/20261118013558.3075038-1-zhangpengjie2@huawei.com/ Thanks, Pengjie On 11/30/2026 7:13 PM, Jiangtian Feng wrote: > Global boost is a permission to use boost, not a statement that boost is > currently active on every policy. A boost-capable policy can be inactive or > offline when the global knob is written. Rejecting the write in that case > loses the requested global setting and makes the policy list state affect > the result in a way that is not useful to userspace. > > Track boost support across all registered policies under cpus_read_lock, > but continue to call policy_set_boost() only for active, boost-capable > policies. An inactive boost-capable policy therefore no longer makes the > global write fail, and the requested setting can be applied when it becomes > active again. > > Preserve the -EOPNOTSUPP result when no registered policy supports boost, > as introduced by 77cf053b041f, and leave all real policy_set_boost() > failures unchanged. > > Link: https://lore.kernel.org/all/744b868b-55af-4a12-86a8-f4fd5d132e6a@huawei.com/ > Link: https://lore.kernel.org/all/wnnfdvp3r3bg5wztazoijei2uji5xypl4b4wlvlxuwxaizu6g7@2xxyrk7kdxhf/ > > Qoder, an AI coding assistant, helped analyze the 77cf history, review the > policy-list locking/lifetime and draft this change and description. The > policy state matrix and hardware/hotplug behavior remain subject to final > review and validation. > > Signed-off-by: Jiangtian Feng > --- > drivers/cpufreq/cpufreq.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 4332cb114070..f83fc6e40fbe 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -2887,7 +2887,8 @@ static int cpufreq_boost_trigger_state(int state) > struct cpufreq_policy *policy; > unsigned long flags; > bool boost_enabled; > - int ret = -EOPNOTSUPP; > + bool any_boost_supported = false; > + int ret = 0; > > guard(mutex)(&cpufreq_boost_mutex); > > @@ -2902,8 +2903,11 @@ static int cpufreq_boost_trigger_state(int state) > write_unlock_irqrestore(&cpufreq_driver_lock, flags); > > cpus_read_lock(); > - for_each_active_policy(policy) { > - if (!policy->boost_supported) > + /* Track capability across inactive policies, but only update active ones. */ > + for_each_policy(policy) { > + if (policy->boost_supported) > + any_boost_supported = true; > + if (policy_is_inactive(policy) || !policy->boost_supported) > continue; > > guard(cpufreq_policy_write)(policy); > @@ -2913,6 +2917,9 @@ static int cpufreq_boost_trigger_state(int state) > break; > } > > + if (!any_boost_supported) > + ret = -EOPNOTSUPP; > + > cpus_read_unlock(); > > if (likely(!ret))