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-next>] [day] [month] [year] [list]
Message-ID: <1522229514-14377-1-git-send-email-shunyong.yang@hxt-semitech.com>
Date:   Wed, 28 Mar 2018 17:31:54 +0800
From:   Shunyong Yang <shunyong.yang@...-semitech.com>
To:     <rjw@...ysocki.net>
CC:     <viresh.kumar@...aro.org>, <linux-pm@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>,
        Shunyong Yang <shunyong.yang@...-semitech.com>,
        Joey Zheng <yu.zheng@...-semitech.com>
Subject: [PATCH] cpufreq: cppc_cpufreq: Initialize shared cpu's perf capabilities

When multiple cpus are related in one cpufreq policy, the first online
cpu will be chosen by default to handle cpufreq operations. Let's take
cpu0 and cpu1 as an example.

When cpu0 is offline, policy->cpu will be shifted to cpu1. Cpu1's should
be initialized. Otherwise, perf capabilities are 0s and speed change can
not take effect.

This patch copies perf capabilities of the first online cpu to other
shared cpus when policy shared type is CPUFREQ_SHARED_TYPE_ANY.

Cc: Joey Zheng <yu.zheng@...-semitech.com>
Signed-off-by: Shunyong Yang <shunyong.yang@...-semitech.com>
---

The original RFC link,
  https://patchwork.kernel.org/patch/10299055/.

This patch solves same issue as RFC above.

Patch name is changed as code is too much different with RFC above.

Remove extra init() per Viresh Kumar's comments and only handle
CPPC CPUFREQ_SHARED_TYPE_ANY case.

---
 drivers/cpufreq/cppc_cpufreq.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index 8f7b21a4d537..dc625a93a58e 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -164,8 +164,18 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
 	policy->cpuinfo.transition_latency = cppc_get_transition_latency(cpu_num);
 	policy->shared_type = cpu->shared_type;
 
-	if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
+	if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
+		int i;
+
 		cpumask_copy(policy->cpus, cpu->shared_cpu_map);
+
+		for_each_cpu(i, policy->cpus) {
+			if (i != policy->cpu)
+				memcpy(&all_cpu_data[i]->perf_caps,
+				       &cpu->perf_caps,
+				       sizeof(cpu->perf_caps));
+		}
+	}
 	else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) {
 		/* Support only SW_ANY for now. */
 		pr_debug("Unsupported CPU co-ord type\n");
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ