linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] PM / Domains: Fixes related to cpuidle
@ 2012-08-13 22:19 Rafael J. Wysocki
  2012-08-13 22:20 ` [PATCH 1/3] PM / Domains: Document cpuidle-related functions and change their names Rafael J. Wysocki
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2012-08-13 22:19 UTC (permalink / raw)
  To: Linux PM list; +Cc: LKML, Linux-sh list, Magnus Damm

Hi all,

The following three patches fix some relatively minor issues and add
a bit of new functionality related to the PM domains' support for cpuidle.

[1/3] - Fix names of cpuidle-related PM domain's functions and add kerneldoc
        comments describing them.
[2/3] - Make the cpuidle ladder governor use the "disabled" state flag.
[3/3] - Make it possible to use domain names for connecting cpuidle to and
        disconnecting it from a PM domain.

The patches are on top of the current linux-next branch of the linux-pm.git tree.

Thanks,
Rafael


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] PM / Domains: Document cpuidle-related functions and change their names
  2012-08-13 22:19 [PATCH 0/3] PM / Domains: Fixes related to cpuidle Rafael J. Wysocki
@ 2012-08-13 22:20 ` Rafael J. Wysocki
  2012-08-13 22:22 ` [PATCH 2/3] PM / cpuidle: Make ladder governor use the "disabled" state flag Rafael J. Wysocki
  2012-08-13 22:23 ` [PATCH 3/3] PM / Domains: Add operations related to cpuidle using domain names Rafael J. Wysocki
  2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2012-08-13 22:20 UTC (permalink / raw)
  To: Linux PM list; +Cc: LKML, Linux-sh list, Magnus Damm


The names of the cpuidle-related functions in
drivers/base/power/domain.c are inconsistent with the names of the
other exported functions in that file (the "pm_" prefix is missing
from them) and they are missing kerneldoc comments.

Fix that by adding the missing "pm_" prefix to the names of those
functions and add kerneldoc comments documenting them.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/base/power/domain.c |   20 ++++++++++++++++++--
 include/linux/pm_domain.h   |    8 ++++----
 2 files changed, 22 insertions(+), 6 deletions(-)

Index: linux/drivers/base/power/domain.c
===================================================================
--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -1829,7 +1829,16 @@ int __pm_genpd_remove_callbacks(struct d
 }
 EXPORT_SYMBOL_GPL(__pm_genpd_remove_callbacks);
 
-int genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state)
+/**
+ * pm_genpd_attach_cpuidle - Connect the given PM domain with cpuidle.
+ * @genpd: PM domain to be connected with cpuidle.
+ * @state: cpuidle state this domain can disable/enable.
+ *
+ * Make a PM domain behave as though it contained a CPU core, that is, instead
+ * of calling its power down routine it will enable the given cpuidle state so
+ * that the cpuidle subsystem can power it down (if possible and desirable).
+ */
+int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state)
 {
 	struct cpuidle_driver *cpuidle_drv;
 	struct gpd_cpu_data *cpu_data;
@@ -1878,7 +1887,14 @@ int genpd_attach_cpuidle(struct generic_
 	goto out;
 }
 
-int genpd_detach_cpuidle(struct generic_pm_domain *genpd)
+/**
+ * pm_genpd_detach_cpuidle - Remove the cpuidle connection from a PM domain.
+ * @genpd: PM domain to remove the cpuidle connection from.
+ *
+ * Remove the cpuidle connection set up by pm_genpd_attach_cpuidle() from the
+ * given PM domain.
+ */
+int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd)
 {
 	struct gpd_cpu_data *cpu_data;
 	struct cpuidle_state *idle_state;
Index: linux/include/linux/pm_domain.h
===================================================================
--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -155,8 +155,8 @@ extern int pm_genpd_add_callbacks(struct
 				  struct gpd_dev_ops *ops,
 				  struct gpd_timing_data *td);
 extern int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td);
-extern int genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state);
-extern int genpd_detach_cpuidle(struct generic_pm_domain *genpd);
+extern int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state);
+extern int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd);
 extern void pm_genpd_init(struct generic_pm_domain *genpd,
 			  struct dev_power_governor *gov, bool is_off);
 
@@ -225,11 +225,11 @@ static inline int __pm_genpd_remove_call
 {
 	return -ENOSYS;
 }
-static inline int genpd_attach_cpuidle(struct generic_pm_domain *genpd, int st)
+static inline int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int st)
 {
 	return -ENOSYS;
 }
-static inline int genpd_detach_cpuidle(struct generic_pm_domain *genpd)
+static inline int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd)
 {
 	return -ENOSYS;
 }


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] PM / cpuidle: Make ladder governor use the "disabled" state flag
  2012-08-13 22:19 [PATCH 0/3] PM / Domains: Fixes related to cpuidle Rafael J. Wysocki
  2012-08-13 22:20 ` [PATCH 1/3] PM / Domains: Document cpuidle-related functions and change their names Rafael J. Wysocki
@ 2012-08-13 22:22 ` Rafael J. Wysocki
  2012-08-13 22:23 ` [PATCH 3/3] PM / Domains: Add operations related to cpuidle using domain names Rafael J. Wysocki
  2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2012-08-13 22:22 UTC (permalink / raw)
  To: Linux PM list; +Cc: LKML, Linux-sh list, Magnus Damm


For the mechanism introduced by commit cbc9ef0 (PM / Domains: Add
preliminary support for cpuidle, v2) to work with the ladder
governor, that governor should respect the "disabled" state flag
added by that commit.  Change the ladder governor accordingly.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/cpuidle/governors/ladder.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux/drivers/cpuidle/governors/ladder.c
===================================================================
--- linux.orig/drivers/cpuidle/governors/ladder.c
+++ linux/drivers/cpuidle/governors/ladder.c
@@ -88,6 +88,7 @@ static int ladder_select_state(struct cp
 
 	/* consider promotion */
 	if (last_idx < drv->state_count - 1 &&
+	    !drv->states[last_idx + 1].disabled &&
 	    !dev->states_usage[last_idx + 1].disable &&
 	    last_residency > last_state->threshold.promotion_time &&
 	    drv->states[last_idx + 1].exit_latency <= latency_req) {
@@ -101,7 +102,8 @@ static int ladder_select_state(struct cp
 
 	/* consider demotion */
 	if (last_idx > CPUIDLE_DRIVER_STATE_START &&
-	    (dev->states_usage[last_idx].disable ||
+	    (drv->states[last_idx].disabled ||
+	    dev->states_usage[last_idx].disable ||
 	    drv->states[last_idx].exit_latency > latency_req)) {
 		int i;
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] PM / Domains: Add operations related to cpuidle using domain names
  2012-08-13 22:19 [PATCH 0/3] PM / Domains: Fixes related to cpuidle Rafael J. Wysocki
  2012-08-13 22:20 ` [PATCH 1/3] PM / Domains: Document cpuidle-related functions and change their names Rafael J. Wysocki
  2012-08-13 22:22 ` [PATCH 2/3] PM / cpuidle: Make ladder governor use the "disabled" state flag Rafael J. Wysocki
@ 2012-08-13 22:23 ` Rafael J. Wysocki
  2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2012-08-13 22:23 UTC (permalink / raw)
  To: Linux PM list; +Cc: LKML, Linux-sh list, Magnus Damm


Make it possible to use domain names in operations connecting cpuidle
to and disconnecting it from a PM domain.  This is useful on
platforms where PM domain objects are organized in such a way that
the names of the domains are easier to use than the addresses of
those objects.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/base/power/domain.c |   19 +++++++++++++++++++
 include/linux/pm_domain.h   |   10 ++++++++++
 2 files changed, 29 insertions(+)

Index: linux/drivers/base/power/domain.c
===================================================================
--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -1888,6 +1888,16 @@ int pm_genpd_attach_cpuidle(struct gener
 }
 
 /**
+ * pm_genpd_name_attach_cpuidle - Find PM domain and connect cpuidle to it.
+ * @name: Name of the domain to connect to cpuidle.
+ * @state: cpuidle state this domain can manipulate.
+ */
+int pm_genpd_name_attach_cpuidle(const char *name, int state)
+{
+	return pm_genpd_attach_cpuidle(pm_genpd_lookup_name(name), state);
+}
+
+/**
  * pm_genpd_detach_cpuidle - Remove the cpuidle connection from a PM domain.
  * @genpd: PM domain to remove the cpuidle connection from.
  *
@@ -1925,6 +1935,15 @@ int pm_genpd_detach_cpuidle(struct gener
 	return ret;
 }
 
+/**
+ * pm_genpd_name_detach_cpuidle - Find PM domain and disconnect cpuidle from it.
+ * @name: Name of the domain to disconnect cpuidle from.
+ */
+int pm_genpd_name_detach_cpuidle(const char *name)
+{
+	return pm_genpd_detach_cpuidle(pm_genpd_lookup_name(name));
+}
+
 /* Default device callbacks for generic PM domains. */
 
 /**
Index: linux/include/linux/pm_domain.h
===================================================================
--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -156,7 +156,9 @@ extern int pm_genpd_add_callbacks(struct
 				  struct gpd_timing_data *td);
 extern int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td);
 extern int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state);
+extern int pm_genpd_name_attach_cpuidle(const char *name, int state);
 extern int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd);
+extern int pm_genpd_name_detach_cpuidle(const char *name);
 extern void pm_genpd_init(struct generic_pm_domain *genpd,
 			  struct dev_power_governor *gov, bool is_off);
 
@@ -229,10 +231,18 @@ static inline int pm_genpd_attach_cpuidl
 {
 	return -ENOSYS;
 }
+static inline int pm_genpd_name_attach_cpuidle(const char *name, int state)
+{
+	return -ENOSYS;
+}
 static inline int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd)
 {
 	return -ENOSYS;
 }
+static inline int pm_genpd_name_detach_cpuidle(const char *name)
+{
+	return -ENOSYS;
+}
 static inline void pm_genpd_init(struct generic_pm_domain *genpd,
 				 struct dev_power_governor *gov, bool is_off)
 {


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-13 22:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-13 22:19 [PATCH 0/3] PM / Domains: Fixes related to cpuidle Rafael J. Wysocki
2012-08-13 22:20 ` [PATCH 1/3] PM / Domains: Document cpuidle-related functions and change their names Rafael J. Wysocki
2012-08-13 22:22 ` [PATCH 2/3] PM / cpuidle: Make ladder governor use the "disabled" state flag Rafael J. Wysocki
2012-08-13 22:23 ` [PATCH 3/3] PM / Domains: Add operations related to cpuidle using domain names Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).