From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.130 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796037246; b=aRIwa+YK+yI6BNkc5NqzYZwxVjgfHhhIEGByTIyCg+I08tMVAtxyfsrkPEZIjMjutGy5 PQ2PuJDK7598n8vn6uH3MUGeH/U65uYXz0Bc6hn7p6HvdU2Mmb+OB2Qf7Ez4FItK3bAsn X00swB8ItWtYCJo/xXXIFUWNhNMqjcke7+B3VviDH8lUz0hcHV9UtADg49FkjdhRun0gu M1BA/4fowCmNlJBnHmbT+eRHcsm9kJABhn3QhLWYrs9fQfcIEB0Uc/S2AFBQO6+q0nReR koVyk98iJG1obK3ae8npvPNnmDoeSu864V5VI6v6Ef2rxKM7QZUS6Too5SI9iEf5tqg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796037246; h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=rnSlXy4p3/KrVYR2lSEV/xxALHLcijb5Zt2Wbqoe23w=; b=eCJHRGXRvluGleibHHdLAA6waPy9P/ji6Ze3i4PW2y/urCKhF6XHOgQkhX2hCQycPR4I CQ8jq26cmXLQWSKdxhURymdgYfxaOltAiEMQhks/UU3p1bCW8s4o5lqiILJn1xb3kDYEY YIm0lFZIAv5L0+utm47jsL4ZGZm5VAUb3Tdl4ms9QY4/Mu98la89S2DEwyM3f1Dbnb/rK qqumqw8Ghlf1VM1bRTq4tuI2/p2028deCzfJ9XFr81beGjLHdng4EkahPiotAY8pQo8wo lqhbNdlpX8mX9DCvkE46/PvRZrVswnyU8xPkIScIiaCbN3/gFtGdru7zhLdBUGdOsMQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b="iCa/u2ij"; arc=none smtp.remote-ip=115.124.30.130 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) (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 F0280606A338; Mon, 30 Nov 2026 11:14:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F0280606A338 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=iCa/u2ij DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1796037242; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=rnSlXy4p3/KrVYR2lSEV/xxALHLcijb5Zt2Wbqoe23w=; b=iCa/u2ijwr9V2IaGdim/k63DetCbOQf5gVjbfRWisTgZIt37b2FPW7SFy/lIjM0niQRSwn/TMD6S1ZVYcXq0QiX+l7NV6nu8ZuCgrE4x3G66HoEnJgdR/qKlFID0N0ZwZe9zJP3X/Rs9zi+Tqgxts4MerSVZpoU92vR0FjvbI/A= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037009110;MF=jiangtianfeng@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0XFk0Ske_1796037238; Received: from h68d07384.sqa.eu95.tbsite.net(mailfrom:jiangtianfeng@linux.alibaba.com fp:SMTPD_---0XFk0Ske_1796037238 cluster:ay36) by smtp.aliyun-inc.com; Mon, 30 Nov 2026 19:14:02 +0800 From: Jiangtian Feng To: rafael@kernel.org, viresh.kumar@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, zhongqiu.han@oss.qualcomm.com, christian.loehle@arm.com, ananthu.cv@oss.qualcomm.com, pierre.gondois@arm.com, zhangpengjie2@huawei.com, zhenglifeng1@huawei.com, zhanjie9@hisilicon.com, Jiangtian Feng Subject: [PATCH 1/2] cpufreq: Allow global boost updates with inactive capable policies Date: Mon, 30 Nov 2026 19:13:47 +0800 Message-ID: <20261130111348.363810-2-jiangtianfeng@linux.alibaba.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261130111348.363810-1-jiangtianfeng@linux.alibaba.com> References: <20261130111348.363810-1-jiangtianfeng@linux.alibaba.com> 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 Content-Transfer-Encoding: 8bit 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)) -- 2.47.3