All of lore.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Rafael Wysocki <rjw@rjwysocki.net>
Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org,
	sboyd@codeaurora.org, prarit@redhat.com, skannan@codeaurora.org,
	Viresh Kumar <viresh.kumar@linaro.org>
Subject: [PATCH 11/18] cpufreq: Track cpu managing sysfs kobjects separately
Date: Tue, 27 Jan 2015 14:06:17 +0530	[thread overview]
Message-ID: <0e27bdf1275b50c03051a289f75b9bcc68947639.1422346933.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1422346933.git.viresh.kumar@linaro.org>
In-Reply-To: <cover.1422346933.git.viresh.kumar@linaro.org>

In order to prepare for the next few commits, that will stop migrating sysfs
files on cpu hotplug, this patch starts managing sysfs-cpu separately.

The behavior is still the same as we are still migrating sysfs files on hotplug,
later commits would change that.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/cpufreq.c | 11 +++++++----
 include/linux/cpufreq.h   |  4 +++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index fffa37136b7b..4476471c594e 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -921,7 +921,7 @@ static int cpufreq_add_dev_symlink(struct cpufreq_policy *policy)
 	for_each_cpu(j, policy->cpus) {
 		struct device *cpu_dev;
 
-		if (j == policy->cpu)
+		if (j == policy->kobj_cpu)
 			continue;
 
 		pr_debug("Adding link for CPU: %u\n", j);
@@ -1126,6 +1126,7 @@ static int update_policy_cpu(struct cpufreq_policy *policy, unsigned int cpu,
 
 	down_write(&policy->rwsem);
 	policy->cpu = cpu;
+	policy->kobj_cpu = cpu;
 	up_write(&policy->rwsem);
 
 	return 0;
@@ -1188,10 +1189,12 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
 	 * the creation of a brand new one. So we need to perform this update
 	 * by invoking update_policy_cpu().
 	 */
-	if (recover_policy && cpu != policy->cpu)
+	if (recover_policy && cpu != policy->cpu) {
 		WARN_ON(update_policy_cpu(policy, cpu, dev));
-	else
+	} else {
 		policy->cpu = cpu;
+		policy->kobj_cpu = cpu;
+	}
 
 	cpumask_copy(policy->cpus, cpumask_of(cpu));
 
@@ -1393,7 +1396,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
 				CPUFREQ_NAME_LEN);
 	}
 
-	if (cpu != policy->cpu) {
+	if (cpu != policy->kobj_cpu) {
 		sysfs_remove_link(&dev->kobj, "cpufreq");
 	} else if (cpus > 1) {
 		/* Nominate new CPU */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index e326cddef6db..9b8937f027fb 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -65,7 +65,9 @@ struct cpufreq_policy {
 
 	unsigned int		shared_type; /* ACPI: ANY or ALL affected CPUs
 						should set cpufreq */
-	unsigned int		cpu;    /* cpu nr of CPU managing this policy */
+	unsigned int		cpu;    /* cpu managing this policy, must be online */
+	unsigned int		kobj_cpu; /* cpu managing sysfs files, can be offline */
+
 	struct clk		*clk;
 	struct cpufreq_cpuinfo	cpuinfo;/* see above */
 
-- 
2.3.0.rc0.44.ga94655d


  parent reply	other threads:[~2015-01-27  8:37 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-27  8:36 [PATCH 00/18] cpufreq: don't loose cpufreq history on CPU hotplug Viresh Kumar
2015-01-27  8:36 ` [PATCH 01/18] cpufreq: Drop cpufreq_disabled() check from cpufreq_cpu_{get|put}() Viresh Kumar
2015-02-03 22:17   ` Saravana Kannan
2015-01-27  8:36 ` [PATCH 02/18] cpufreq: Create for_each_policy() Viresh Kumar
2015-02-03 22:22   ` Saravana Kannan
2015-02-04  4:53     ` Viresh Kumar
2015-01-27  8:36 ` [PATCH 03/18] cpufreq: Create for_each_governor() Viresh Kumar
2015-02-03 22:23   ` Saravana Kannan
2015-01-27  8:36 ` [PATCH 04/18] cpufreq: Manage fallback policies in a list Viresh Kumar
2015-02-03  0:41   ` Rafael J. Wysocki
2015-02-03  4:10     ` Viresh Kumar
2015-02-03 15:04       ` Rafael J. Wysocki
2015-02-04  6:18         ` Viresh Kumar
2015-02-03 22:28   ` Saravana Kannan
2015-02-04  6:20     ` Viresh Kumar
2015-02-04 22:28       ` Saravana Kannan
2015-02-04 23:20         ` Rafael J. Wysocki
2015-02-05  1:55           ` Saravana Kannan
2015-02-05 15:11             ` Rafael J. Wysocki
2015-02-05 22:55               ` Saravana Kannan
2015-02-17  8:06               ` Viresh Kumar
2015-02-17 18:15                 ` Rafael J. Wysocki
2015-02-18  4:23                   ` Viresh Kumar
2015-02-18 21:15                     ` Saravana Kannan
2015-02-19  3:24                       ` Viresh Kumar
2015-01-27  8:36 ` [PATCH 05/18] cpufreq: Manage governor usage history with 'policy->last_governor' Viresh Kumar
2015-02-12  3:03   ` Saravana Kannan
2015-02-12  7:44     ` Viresh Kumar
2015-02-12  8:00       ` skannan
2015-02-17  8:02         ` Viresh Kumar
2015-01-27  8:36 ` [PATCH 06/18] cpufreq: Reuse policy list instead of per-cpu variable 'cpufreq_cpu_data' Viresh Kumar
2015-02-12  3:13   ` Saravana Kannan
2015-02-12  7:48     ` Viresh Kumar
2015-01-27  8:36 ` [PATCH 07/18] cpufreq: Drop (now) useless check 'cpu > nr_cpu_ids' Viresh Kumar
2015-02-12  3:15   ` Saravana Kannan
2015-02-12  7:50     ` Viresh Kumar
2015-01-27  8:36 ` [PATCH 08/18] cpufreq: Add doc style comment about cpufreq_cpu_{get|put}() Viresh Kumar
2015-02-12  3:19   ` Saravana Kannan
2015-02-12  7:52     ` Viresh Kumar
2015-01-27  8:36 ` [PATCH 09/18] cpufreq: Mark policy->governor = NULL for fallback policies Viresh Kumar
2015-02-12  3:22   ` Saravana Kannan
2015-02-12  7:56     ` Viresh Kumar
2015-01-27  8:36 ` [PATCH 10/18] cpufreq: Don't allow updating inactive-policies from sysfs Viresh Kumar
2015-02-12  3:24   ` Saravana Kannan
2015-01-27  8:36 ` Viresh Kumar [this message]
2015-01-27  8:36 ` [PATCH 12/18] cpufreq: Stop migrating sysfs files on hotplug Viresh Kumar
2015-01-27  8:36 ` [PATCH 13/18] cpufreq: Keep a single path for adding managed CPUs Viresh Kumar
2015-01-27  8:36 ` [PATCH 14/18] cpufreq: Remove cpufreq_update_policy() Viresh Kumar
2015-01-27  8:36 ` [PATCH 15/18] cpufreq: Initialize policy->kobj while allocating policy Viresh Kumar
2015-01-27  8:36 ` [PATCH 16/18] cpufreq: Call cpufreq_policy_put_kobj() from cpufreq_policy_free() Viresh Kumar
2015-01-27  8:36 ` [PATCH 17/18] cpufreq: Restart governor as soon as possible Viresh Kumar
2015-01-27  8:36 ` [PATCH 18/18] cpufreq: Merge __cpufreq_add_dev() and cpufreq_add_dev() Viresh Kumar
2015-01-27 15:06 ` [PATCH 00/18] cpufreq: don't loose cpufreq history on CPU hotplug Rafael J. Wysocki
2015-01-27 14:59   ` Viresh Kumar
2015-01-28 19:35 ` Saravana Kannan
2015-01-29  1:43   ` Viresh Kumar
2015-02-03  0:30 ` Rafael J. Wysocki

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=0e27bdf1275b50c03051a289f75b9bcc68947639.1422346933.git.viresh.kumar@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=prarit@redhat.com \
    --cc=rjw@rjwysocki.net \
    --cc=sboyd@codeaurora.org \
    --cc=skannan@codeaurora.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.