All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin Cross <ccross@android.com>
To: Len Brown <len.brown@intel.com>
Cc: Kevin Hilman <khilman@ti.com>,
	linux-kernel@vger.kernel.org,
	Amit Kucheria <amit.kucheria@linaro.org>,
	Colin Cross <ccross@android.com>,
	linux-pm@lists.linux-foundation.org,
	Arjan van de Ven <arjan@linux.intel.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] cpuidle: coupled: fix count of online cpus
Date: Fri, 18 May 2012 11:05:23 -0700	[thread overview]
Message-ID: <1337364324-12171-2-git-send-email-ccross@android.com> (raw)
In-Reply-To: <1337364324-12171-1-git-send-email-ccross@android.com>

online_count was never incremented on boot, and was also counting
cpus that were not part of the coupled set.  Fix both issues by
introducting a new function that counts online coupled cpus, and
call it from register as well as the hotplug notifier.

Signed-off-by: Colin Cross <ccross@android.com>
---
 drivers/cpuidle/coupled.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
index 3e65de1..b02810a 100644
--- a/drivers/cpuidle/coupled.c
+++ b/drivers/cpuidle/coupled.c
@@ -532,6 +532,13 @@ int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
 	return entered_state;
 }
 
+static void cpuidle_coupled_update_online_cpus(struct cpuidle_coupled *coupled)
+{
+	cpumask_t cpus;
+	cpumask_and(&cpus, cpu_online_mask, &coupled->coupled_cpus);
+	coupled->online_count = cpumask_weight(&cpus);
+}
+
 /**
  * cpuidle_coupled_register_device - register a coupled cpuidle device
  * @dev: struct cpuidle_device for the current cpu
@@ -570,6 +577,8 @@ int cpuidle_coupled_register_device(struct cpuidle_device *dev)
 	if (WARN_ON(!cpumask_equal(&dev->coupled_cpus, &coupled->coupled_cpus)))
 		coupled->prevent++;
 
+	cpuidle_coupled_update_online_cpus(coupled);
+
 	coupled->refcnt++;
 
 	csd = &per_cpu(cpuidle_coupled_poke_cb, dev->cpu);
@@ -668,7 +677,7 @@ static int cpuidle_coupled_cpu_notify(struct notifier_block *nb,
 		break;
 	case CPU_ONLINE:
 	case CPU_DEAD:
-		dev->coupled->online_count = num_online_cpus();
+		cpuidle_coupled_update_online_cpus(dev->coupled);
 		/* Fall through */
 	case CPU_UP_CANCELED:
 	case CPU_DOWN_FAILED:
-- 
1.7.7.3

WARNING: multiple messages have this Message-ID (diff)
From: ccross@android.com (Colin Cross)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] cpuidle: coupled: fix count of online cpus
Date: Fri, 18 May 2012 11:05:23 -0700	[thread overview]
Message-ID: <1337364324-12171-2-git-send-email-ccross@android.com> (raw)
In-Reply-To: <1337364324-12171-1-git-send-email-ccross@android.com>

online_count was never incremented on boot, and was also counting
cpus that were not part of the coupled set.  Fix both issues by
introducting a new function that counts online coupled cpus, and
call it from register as well as the hotplug notifier.

Signed-off-by: Colin Cross <ccross@android.com>
---
 drivers/cpuidle/coupled.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
index 3e65de1..b02810a 100644
--- a/drivers/cpuidle/coupled.c
+++ b/drivers/cpuidle/coupled.c
@@ -532,6 +532,13 @@ int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
 	return entered_state;
 }
 
+static void cpuidle_coupled_update_online_cpus(struct cpuidle_coupled *coupled)
+{
+	cpumask_t cpus;
+	cpumask_and(&cpus, cpu_online_mask, &coupled->coupled_cpus);
+	coupled->online_count = cpumask_weight(&cpus);
+}
+
 /**
  * cpuidle_coupled_register_device - register a coupled cpuidle device
  * @dev: struct cpuidle_device for the current cpu
@@ -570,6 +577,8 @@ int cpuidle_coupled_register_device(struct cpuidle_device *dev)
 	if (WARN_ON(!cpumask_equal(&dev->coupled_cpus, &coupled->coupled_cpus)))
 		coupled->prevent++;
 
+	cpuidle_coupled_update_online_cpus(coupled);
+
 	coupled->refcnt++;
 
 	csd = &per_cpu(cpuidle_coupled_poke_cb, dev->cpu);
@@ -668,7 +677,7 @@ static int cpuidle_coupled_cpu_notify(struct notifier_block *nb,
 		break;
 	case CPU_ONLINE:
 	case CPU_DEAD:
-		dev->coupled->online_count = num_online_cpus();
+		cpuidle_coupled_update_online_cpus(dev->coupled);
 		/* Fall through */
 	case CPU_UP_CANCELED:
 	case CPU_DOWN_FAILED:
-- 
1.7.7.3

WARNING: multiple messages have this Message-ID (diff)
From: Colin Cross <ccross@android.com>
To: Len Brown <len.brown@intel.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-pm@lists.linux-foundation.org,
	Kevin Hilman <khilman@ti.com>,
	Arjan van de Ven <arjan@linux.intel.com>,
	Deepthi Dharwar <deepthi@linux.vnet.ibm.com>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Amit Kucheria <amit.kucheria@linaro.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Colin Cross <ccross@android.com>
Subject: [PATCH 1/2] cpuidle: coupled: fix count of online cpus
Date: Fri, 18 May 2012 11:05:23 -0700	[thread overview]
Message-ID: <1337364324-12171-2-git-send-email-ccross@android.com> (raw)
In-Reply-To: <1337364324-12171-1-git-send-email-ccross@android.com>

online_count was never incremented on boot, and was also counting
cpus that were not part of the coupled set.  Fix both issues by
introducting a new function that counts online coupled cpus, and
call it from register as well as the hotplug notifier.

Signed-off-by: Colin Cross <ccross@android.com>
---
 drivers/cpuidle/coupled.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
index 3e65de1..b02810a 100644
--- a/drivers/cpuidle/coupled.c
+++ b/drivers/cpuidle/coupled.c
@@ -532,6 +532,13 @@ int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
 	return entered_state;
 }
 
+static void cpuidle_coupled_update_online_cpus(struct cpuidle_coupled *coupled)
+{
+	cpumask_t cpus;
+	cpumask_and(&cpus, cpu_online_mask, &coupled->coupled_cpus);
+	coupled->online_count = cpumask_weight(&cpus);
+}
+
 /**
  * cpuidle_coupled_register_device - register a coupled cpuidle device
  * @dev: struct cpuidle_device for the current cpu
@@ -570,6 +577,8 @@ int cpuidle_coupled_register_device(struct cpuidle_device *dev)
 	if (WARN_ON(!cpumask_equal(&dev->coupled_cpus, &coupled->coupled_cpus)))
 		coupled->prevent++;
 
+	cpuidle_coupled_update_online_cpus(coupled);
+
 	coupled->refcnt++;
 
 	csd = &per_cpu(cpuidle_coupled_poke_cb, dev->cpu);
@@ -668,7 +677,7 @@ static int cpuidle_coupled_cpu_notify(struct notifier_block *nb,
 		break;
 	case CPU_ONLINE:
 	case CPU_DEAD:
-		dev->coupled->online_count = num_online_cpus();
+		cpuidle_coupled_update_online_cpus(dev->coupled);
 		/* Fall through */
 	case CPU_UP_CANCELED:
 	case CPU_DOWN_FAILED:
-- 
1.7.7.3


  reply	other threads:[~2012-05-18 18:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-18 18:05 [PATCH 0/2] bug fixes for coupled cpuidle Colin Cross
2012-05-18 18:05 ` Colin Cross
2012-05-18 18:05 ` Colin Cross
2012-05-18 18:05 ` Colin Cross [this message]
2012-05-18 18:05   ` [PATCH 1/2] cpuidle: coupled: fix count of online cpus Colin Cross
2012-05-18 18:05   ` Colin Cross
2012-05-18 18:05 ` [PATCH 2/2] cpuidle: coupled: fix decrementing ready count Colin Cross
2012-05-18 18:05   ` Colin Cross
2012-05-18 18:05   ` Colin Cross
2012-05-21  6:44 ` [PATCH 0/2] bug fixes for coupled cpuidle Santosh Shilimkar
2012-05-21  6:44   ` Santosh Shilimkar
2012-05-21  6:44   ` Santosh Shilimkar
2012-05-25 22:38   ` [linux-pm] " Kevin Hilman
2012-05-25 22:38     ` Kevin Hilman
2012-06-02  5:50 ` Len Brown
2012-06-02  5:50   ` [linux-pm] " Len Brown
2012-06-02  5:50   ` Len Brown
2012-06-02  6:41   ` Colin Cross
2012-06-05 18:12   ` [linux-pm] " Kevin Hilman
2012-06-05 18:12     ` Kevin Hilman

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=1337364324-12171-2-git-send-email-ccross@android.com \
    --to=ccross@android.com \
    --cc=amit.kucheria@linaro.org \
    --cc=arjan@linux.intel.com \
    --cc=khilman@ti.com \
    --cc=len.brown@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.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.