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: <3b6663b03fe837615ba608aff50b4b2a27ab2ab3.1552545525.git.viresh.kumar@linaro.org>
Date:   Thu, 14 Mar 2019 12:12:47 +0530
From:   Viresh Kumar <viresh.kumar@...aro.org>
To:     Rafael Wysocki <rjw@...ysocki.net>
Cc:     Viresh Kumar <viresh.kumar@...aro.org>, linux-pm@...r.kernel.org,
        Vincent Guittot <vincent.guittot@...aro.org>,
        linux-kernel@...r.kernel.org
Subject: [PATCH 1/7] cpufreq: Pass policy->related_cpus to transition notifiers

Currently we call these notifiers once for each CPU of the policy->cpus
cpumask, which isn't that efficient.

This patch adds a cpumask pointer to struct cpufreq_freqs and copies
policy->related_cpus to it. The notifiers will have information about
all the affected CPUs now with the first call itself and once all the
notifier callbacks are updated to use the new field, we can remove the
"cpu" field from struct cpufreq_freqs and call the notifier only once
per policy.

Some of the transition notifier users use per-cpu data to read and store
their data and they rely on it being correct. With CPU offline/online
sequences we may end up with using stale data for those CPUs (which are
offlined/onlined). In order to avoid such corner cases, this patch uses
policy->related_cpus instead of policy->cpus.

Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
---
 drivers/cpufreq/cpufreq.c | 1 +
 include/linux/cpufreq.h   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 0e626b00053b..b1b012169f00 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -311,6 +311,7 @@ static void cpufreq_notify_transition(struct cpufreq_policy *policy,
 	if (cpufreq_disabled())
 		return;
 
+	freqs->cpus = policy->related_cpus;
 	freqs->flags = cpufreq_driver->flags;
 	pr_debug("notification %u of frequency transition to %u kHz\n",
 		 state, freqs->new);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index b160e98076e3..dd318363dfc2 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -43,6 +43,7 @@ enum cpufreq_table_sorting {
 };
 
 struct cpufreq_freqs {
+	struct cpumask *cpus;
 	unsigned int cpu;	/* cpu nr */
 	unsigned int old;
 	unsigned int new;
-- 
2.21.0.rc0.269.g1a574e7a288b

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ