From: Beata Michalska <beata.michalska@arm.com>
To: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org,
ionela.voinescu@arm.com, sudeep.holla@arm.com, will@kernel.org,
catalin.marinas@arm.com, rafael@kernel.org,
viresh.kumar@linaro.org
Cc: sumitg@nvidia.com, yang@os.amperecomputing.com,
vanshikonda@os.amperecomputing.com, lihuisong@huawei.com,
zhanjie9@hisilicon.com, ptsm@linux.microsoft.com
Subject: [PATCH v10 4/4] arm64: Update AMU-based freq scale factor on entering idle
Date: Fri, 31 Jan 2025 16:24:39 +0000 [thread overview]
Message-ID: <20250131162439.3843071-5-beata.michalska@arm.com> (raw)
In-Reply-To: <20250131162439.3843071-1-beata.michalska@arm.com>
Now that the frequency scale factor has been activated for retrieving
current frequency on a given CPU, trigger its update upon entering
idle. This will, to an extent, allow querying last known frequency
in a non-invasive way. It will also improve the frequency scale factor
accuracy when a CPU entering idle did not receive a tick for a while.
As a consequence, for idle cores, the reported frequency will be the
last one observed before entering the idle state.
Suggested-by: Vanshidhar Konda <vanshikonda@os.amperecomputing.com>
Signed-off-by: Beata Michalska <beata.michalska@arm.com>
Reviewed-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
Reviewed-by: Sumit Gupta <sumitg@nvidia.com>
---
arch/arm64/kernel/topology.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c
index bd238e5c2133..6f0cab8e746b 100644
--- a/arch/arm64/kernel/topology.c
+++ b/arch/arm64/kernel/topology.c
@@ -213,6 +213,19 @@ static __always_inline bool amu_fie_cpu_supported(unsigned int cpu)
cpumask_test_cpu(cpu, amu_fie_cpus);
}
+void arch_cpu_idle_enter(void)
+{
+ unsigned int cpu = smp_processor_id();
+
+ if (!amu_fie_cpu_supported(cpu))
+ return;
+
+ /* Kick in AMU update but only if one has not happened already */
+ if (housekeeping_cpu(cpu, HK_TYPE_TICK) &&
+ time_is_before_jiffies(per_cpu(cpu_amu_samples.last_scale_update, cpu)))
+ amu_scale_freq_tick();
+}
+
#define AMU_SAMPLE_EXP_MS 20
int arch_freq_get_on_cpu(int cpu)
--
2.25.1
next prev parent reply other threads:[~2025-01-31 16:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-31 16:24 [PATCH v10 0/4] Add support for AArch64 AMUv1-based average freq Beata Michalska
2025-01-31 16:24 ` [PATCH v10 1/4] cpufreq: Allow arch_freq_get_on_cpu to return an error Beata Michalska
2025-02-05 7:00 ` Viresh Kumar
2025-01-31 16:24 ` [PATCH v10 2/4] cpufreq: Introduce an optional cpuinfo_avg_freq sysfs entry Beata Michalska
2025-02-05 7:01 ` Viresh Kumar
2025-02-17 11:52 ` Rafael J. Wysocki
2025-02-17 14:57 ` Catalin Marinas
2025-02-17 15:07 ` Ionela Voinescu
2025-02-17 16:05 ` Sudeep Holla
2025-02-17 18:20 ` Catalin Marinas
2025-01-31 16:24 ` [PATCH v10 3/4] arm64: Provide an AMU-based version of arch_freq_get_on_cpu Beata Michalska
2025-01-31 16:24 ` Beata Michalska [this message]
2025-02-17 21:32 ` [PATCH v10 0/4] Add support for AArch64 AMUv1-based average freq Catalin Marinas
2025-02-18 0:00 ` Beata Michalska
2025-02-18 9:18 ` Catalin Marinas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250131162439.3843071-5-beata.michalska@arm.com \
--to=beata.michalska@arm.com \
--cc=catalin.marinas@arm.com \
--cc=ionela.voinescu@arm.com \
--cc=lihuisong@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=ptsm@linux.microsoft.com \
--cc=rafael@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=sumitg@nvidia.com \
--cc=vanshikonda@os.amperecomputing.com \
--cc=viresh.kumar@linaro.org \
--cc=will@kernel.org \
--cc=yang@os.amperecomputing.com \
--cc=zhanjie9@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®