From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796229316; b=0FMjQGYVyFrr0968EjNvoe6SF5LIHDd1cieDTbFM3cNRwck3XaFP3t7psmNhdGgfBh/n ih3CqxdmExXGSQywxIQOSqyYrYTBLD8YIAkTMeucFvAWlxnEYljSdjelBA2rRBWoxdb3G Pp+aba5q9hLf2LWumEziFQavgHpBY3B5G+LlmmX3tfvLKUcvw4TptW/xb+ydUdefrStpK MHeOYcNsNrssSJ24WhNfKIuR2Fz2lr80nUE/xOnQ39puauJ9i27o8OxUbKINM6ltcDRsn /R5qTDnH1G7zsuzxfRMDRkDwjgajL9jst0xsvUg3DNgsoPtTJpl/1kma6W1y8zhL1ZA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796229316; h=DMARC-Filter:Received:Received:DKIM-Signature:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:From: Content-Language:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=yeQhWYTm+rMgfFTJ2nOvK7uhofem+WQf6VB4TVvstkc=; b=ZZO0i42UR8Up4u8tfSrqVSafFf/xaIULDZg6UclrOGGDZTxYLYFwXmASeWfA+fGg0C6k bTgQlK7nvSr8k2Wdqysd2g8X45JopkLMexSRDOA161CidNFP6ErQRUAi2JgecQ6irwCu+ Lqt4zR3Zgytn1C28FFHRMS44HyiuPpbRHGK4yyHPAEnkfjJXfbQfXALMMdliuKwMMvF20 fbmbrYDKYrXnBz+3U4BkqAUPY5HBfehUI0NC+KJ2raC+sYnrzzSLrI8OQmX+gqU0RHuOL AXUtsotWwySz4cWPG+TFv0nFT4ucxHYoWqrUhyWgK52Aet8WrbPcR/uuw7UQDRnDMCQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=X4lc5d6D; arc=none smtp.remote-ip=217.140.110.172 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B182E606A32E; Wed, 2 Dec 2026 16:35:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B182E606A32E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=X4lc5d6D Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 31FDA1570; Wed, 2 Dec 2026 08:35:12 -0800 (PST) Received: from [10.0.130.226] (e127648.arm.com [10.0.130.226]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E87803F86F; Wed, 2 Dec 2026 08:35:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796229314; bh=fG/DTtsESy96WeTPXW3Ijynaj9xEfPwSqZxbPo89vds=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=X4lc5d6DjWhJ+SjK1aorTnqSeDqfoLQrzEUKmpGKTfN4o64sV6qGKVw/eWlZDuvEU 3bmlxdpYhNmApukU2FmM5M4ePW8AKJR+ZRB/G30FKrSFqSysSYKtm0sQWf8PkLNlVA EaY1AJEW+52eWzF9H8yCr2WLtWk94m5XCFHUW8Yg= Message-ID: Date: Wed, 2 Dec 2026 16:35:10 +0000 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 2/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, zhongqiu.han@oss.qualcomm.com, ananthu.cv@oss.qualcomm.com, pierre.gondois@arm.com, zhangpengjie2@huawei.com, zhenglifeng1@huawei.com, zhanjie9@hisilicon.com References: <20261201023001.1131130-1-jiangtianfeng@linux.alibaba.com> <20261201023001.1131130-3-jiangtianfeng@linux.alibaba.com> From: Christian Loehle Content-Language: en-US In-Reply-To: <20261201023001.1131130-3-jiangtianfeng@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12/1/26 02:30, Jiangtian Feng wrote: > When global boost is enabled from the disabled state, a failure after > one or more policies have been updated successfully currently restores > the global flag to 0 without rolling back those policies. This leaves > them locally enabled, with their boost-related driver/QoS updates > retained, while the global flag rejects per-policy sysfs writes. > > Keep the global flag enabled if at least one policy_set_boost() call > succeeded, while preserving the existing error return path. Global > boost = 1 grants permission to boost; it does not require every policy > to have boost enabled. The mixed per-policy state is therefore valid > and individual policies remain accessible through per-policy sysfs. > > Restore the previous global state on disable and when no policy was > enabled successfully. After a partial enable, keep global boost enabled > so users can repair individual policies through sysfs. Do not roll back > earlier policy updates. > > Qoder, an AI coding assistant, helped analyze the issue, develop the fix > and state matrix, and draft this description. > > Fixes: 218a06a79d9a ("cpufreq: Support per-policy performance boost") > Reviewed-by: Zhongqiu Han > Reviewed-by: Pengjie Zhang > Signed-off-by: Jiangtian Feng > --- > drivers/cpufreq/cpufreq.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index e97838e40a54..d998ea0ed43c 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -2887,6 +2887,7 @@ static int cpufreq_boost_trigger_state(int state) > struct cpufreq_policy *policy; > unsigned long flags; > bool boost_enabled; > + bool policy_success = false; > int ret = 0; > > guard(mutex)(&cpufreq_boost_mutex); > @@ -2911,6 +2912,8 @@ static int cpufreq_boost_trigger_state(int state) > ret = policy_set_boost(policy, state); > if (unlikely(ret)) > break; > + > + policy_success = true; > } > > cpus_read_unlock(); > @@ -2918,9 +2921,12 @@ static int cpufreq_boost_trigger_state(int state) > if (likely(!ret)) > return 0; > > - write_lock_irqsave(&cpufreq_driver_lock, flags); > - cpufreq_driver->boost_enabled = boost_enabled; > - write_unlock_irqrestore(&cpufreq_driver_lock, flags); > + /* On failure, restore old state unless partial enable needs local repair. */ > + if (!state || !policy_success) { > + write_lock_irqsave(&cpufreq_driver_lock, flags); > + cpufreq_driver->boost_enabled = boost_enabled; > + write_unlock_irqrestore(&cpufreq_driver_lock, flags); > + } > > pr_err("%s: Cannot %s BOOST\n", > __func__, str_enable_disable(state)); Reviewed-by: Christian Loehle