From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A88412B89; Tue, 16 Jan 2024 00:09:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="q5mgIebH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13002C433C7; Tue, 16 Jan 2024 00:09:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705363764; bh=6UglXZc7mfYGHwHNw2RQBoiS3OjUzMb1B5BuMr7JggE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q5mgIebHg+VjXlmpd72kYJV4qSSsLoRpfc58t3LrUI0UlDZPhPP/7/ZEQB3oaPQ4U lO9Bg5B0ULDo3NUGz2Vdb4RZa8IdsfJB4kZ3kEm747+vyJpQRecUKYZVEina9hc/cb XGqhfcuk163OJa5Dw5CNasQh3sKYov84jOeYig262Uop+ck37c9/gMiXspaPNwIpek aRlrs005vTuJh0vTPhMbZKnftkH7VJFn1ohKv2i0SFLXdYBPfzFpdNTYaVVdlUMghJ X1bCQ/IIPAyvkPz4MtSohtDnJ3mp9sRJxndIMZ6gPO3XEYqp6h+swk7XGvFok66QQx VVILKy1n/qL8w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Vincent Guittot , Ingo Molnar , Lukasz Luba , Viresh Kumar , "Rafael J . Wysocki" , Sasha Levin , linux-pm@vger.kernel.org Subject: [PATCH AUTOSEL 6.6 4/6] cpufreq: Use the fixed and coherent frequency for scaling capacity Date: Mon, 15 Jan 2024 19:08:59 -0500 Message-ID: <20240116000909.212520-4-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116000909.212520-1-sashal@kernel.org> References: <20240116000909.212520-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.6.12 Content-Transfer-Encoding: 8bit From: Vincent Guittot [ Upstream commit 599457ba15403037b489fe536266a3d5f9efaed7 ] cpuinfo.max_freq can change at runtime because of boost as an example. This implies that the value could be different from the frequency that has been used to compute the capacity of a CPU. The new arch_scale_freq_ref() returns a fixed and coherent frequency that can be used to compute the capacity for a given frequency. [ Also fix a arch_set_freq_scale() newline style wart in . ] Signed-off-by: Vincent Guittot Signed-off-by: Ingo Molnar Tested-by: Lukasz Luba Reviewed-by: Lukasz Luba Acked-by: Viresh Kumar Acked-by: Rafael J. Wysocki Link: https://lore.kernel.org/r/20231211104855.558096-3-vincent.guittot@linaro.org Signed-off-by: Sasha Levin --- drivers/cpufreq/cpufreq.c | 4 ++-- include/linux/cpufreq.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 60ed89000e82..8c4f9c2f9c44 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -454,7 +454,7 @@ void cpufreq_freq_transition_end(struct cpufreq_policy *policy, arch_set_freq_scale(policy->related_cpus, policy->cur, - policy->cpuinfo.max_freq); + arch_scale_freq_ref(policy->cpu)); spin_lock(&policy->transition_lock); policy->transition_ongoing = false; @@ -2174,7 +2174,7 @@ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, policy->cur = freq; arch_set_freq_scale(policy->related_cpus, freq, - policy->cpuinfo.max_freq); + arch_scale_freq_ref(policy->cpu)); cpufreq_stats_record_transition(policy, freq); if (trace_cpu_frequency_enabled()) { diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 71d186d6933a..738dcddf3cfe 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -1211,6 +1211,7 @@ void arch_set_freq_scale(const struct cpumask *cpus, { } #endif + /* the following are really really optional */ extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; extern struct freq_attr cpufreq_freq_attr_scaling_boost_freqs; -- 2.43.0