lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <170334779172.398.3874376570543618455.tip-bot2@tip-bot2>
Date: Sat, 23 Dec 2023 16:09:51 -0000
From: "tip-bot2 for Vincent Guittot" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Vincent Guittot <vincent.guittot@...aro.org>,
 Ingo Molnar <mingo@...nel.org>, Pierre Gondois <pierre.gondois@....com>,
 Sudeep Holla <sudeep.holla@....com>, Viresh Kumar <viresh.kumar@...aro.org>,
 x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: sched/core] cpufreq/cppc: Set the frequency used for computing
 the capacity

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     5477fa249b56c59c3baa1b237bf083cffa64c84a
Gitweb:        https://git.kernel.org/tip/5477fa249b56c59c3baa1b237bf083cffa64c84a
Author:        Vincent Guittot <vincent.guittot@...aro.org>
AuthorDate:    Mon, 11 Dec 2023 11:48:54 +01:00
Committer:     Ingo Molnar <mingo@...nel.org>
CommitterDate: Sat, 23 Dec 2023 15:52:36 +01:00

cpufreq/cppc: Set the frequency used for computing the capacity

Save the frequency associated to the performance that has been used when
initializing the capacity of CPUs.

Also, cppc cpufreq driver can register an artificial energy model. In such
case, it needs the frequency for this compute capacity.

Signed-off-by: Vincent Guittot <vincent.guittot@...aro.org>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Tested-by: Pierre Gondois <pierre.gondois@....com>
Acked-by: Sudeep Holla <sudeep.holla@....com>
Acked-by: Viresh Kumar <viresh.kumar@...aro.org>
Link: https://lore.kernel.org/r/20231211104855.558096-7-vincent.guittot@linaro.org
---
 drivers/base/arch_topology.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index 0c9ae5b..1aa76b5 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -349,6 +349,7 @@ bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu)
 
 void topology_init_cpu_capacity_cppc(void)
 {
+	u64 capacity, capacity_scale = 0;
 	struct cppc_perf_caps perf_caps;
 	int cpu;
 
@@ -365,6 +366,10 @@ void topology_init_cpu_capacity_cppc(void)
 		    (perf_caps.highest_perf >= perf_caps.nominal_perf) &&
 		    (perf_caps.highest_perf >= perf_caps.lowest_perf)) {
 			raw_capacity[cpu] = perf_caps.highest_perf;
+			capacity_scale = max_t(u64, capacity_scale, raw_capacity[cpu]);
+
+			per_cpu(capacity_freq_ref, cpu) = cppc_perf_to_khz(&perf_caps, raw_capacity[cpu]);
+
 			pr_debug("cpu_capacity: CPU%d cpu_capacity=%u (raw).\n",
 				 cpu, raw_capacity[cpu]);
 			continue;
@@ -375,7 +380,15 @@ void topology_init_cpu_capacity_cppc(void)
 		goto exit;
 	}
 
-	topology_normalize_cpu_scale();
+	for_each_possible_cpu(cpu) {
+		capacity = raw_capacity[cpu];
+		capacity = div64_u64(capacity << SCHED_CAPACITY_SHIFT,
+				     capacity_scale);
+		topology_set_cpu_scale(cpu, capacity);
+		pr_debug("cpu_capacity: CPU%d cpu_capacity=%lu\n",
+			cpu, topology_get_cpu_scale(cpu));
+	}
+
 	schedule_work(&update_topology_flags_work);
 	pr_debug("cpu_capacity: cpu_capacity initialization done\n");
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ