All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC/PATCH] PM QoS: main memory throughput constraints
@ 2011-09-30 14:16 Jean Pihet
  2011-09-30 14:17 ` [PATCH] PM QoS: add a PM_QOS_MEMORY_THROUGHPUT class jean.pihet
  2011-09-30 20:28 ` [RFC/PATCH] PM QoS: main memory throughput constraints Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: Jean Pihet @ 2011-09-30 14:16 UTC (permalink / raw)
  To: Rafael J. Wysocki, Kevin Hilman, Paul Walmsley
  Cc: Linux PM mailing list, linux-omap, Benoit Cousson

Hi,

Here is a patch which adds a PM_QOS_MEMORY_THROUGHPUT class to the PM
QoS framework. The idea is to provide a memory or SDMA throughput
constraints class, which can be applied to the low level platform code
using the callback notification mechanism and also a MISC /dev entry
for the constraints from user space.

The first user of this class of constraints is the OMAP platform. The
aggregated constraint is fed to the DVFS layer in order to control the
main interconnect (L3) frequency and so the memory bandwidth. This
comes as a subsequent patch.

This patch is RFC since more throughput constraints could be added in
the future, in order to control more clocks in the system. Is it worth
adding a class for every new subsystem to control?

What do you think?

The patch follows asap as a reply to this message. It applies on
Rafael' latest linux-pm tree, cf.
https://github.com/rjwysocki/linux-pm/commits/pm-qos.

Regards,
Jean

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

* [PATCH] PM QoS: add a PM_QOS_MEMORY_THROUGHPUT class
  2011-09-30 14:16 [RFC/PATCH] PM QoS: main memory throughput constraints Jean Pihet
@ 2011-09-30 14:17 ` jean.pihet
  2011-09-30 20:28 ` [RFC/PATCH] PM QoS: main memory throughput constraints Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: jean.pihet @ 2011-09-30 14:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Kevin Hilman, Paul Walmsley,
	Linux PM mailing list, linux-omap
  Cc: Jean Pihet

From: Jean Pihet <j-pihet@ti.com>

Provide a memory or SDMA throughput constraints class,
which can be applied to the low level platform code using the
callback notification mechanism and
also a MISC /dev entry for the constraints from user space.

Signed-off-by: Jean Pihet <j-pihet@ti.com>
---
 include/linux/pm_qos.h |   14 ++++++++------
 kernel/power/qos.c     |   17 +++++++++++++++++
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 83b0ea3..bd3d936 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -9,16 +9,18 @@
 #include <linux/miscdevice.h>
 #include <linux/device.h>
 
-#define PM_QOS_RESERVED 0
-#define PM_QOS_CPU_DMA_LATENCY 1
-#define PM_QOS_NETWORK_LATENCY 2
-#define PM_QOS_NETWORK_THROUGHPUT 3
+#define PM_QOS_RESERVED			0
+#define PM_QOS_CPU_DMA_LATENCY		1
+#define PM_QOS_NETWORK_LATENCY		2
+#define PM_QOS_MEMORY_THROUGHPUT	3
+#define PM_QOS_NETWORK_THROUGHPUT	4
 
-#define PM_QOS_NUM_CLASSES 4
-#define PM_QOS_DEFAULT_VALUE -1
+#define PM_QOS_NUM_CLASSES		5
+#define PM_QOS_DEFAULT_VALUE		-1
 
 #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE	(2000 * USEC_PER_SEC)
 #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE	(2000 * USEC_PER_SEC)
+#define PM_QOS_MEMORY_THROUGHPUT_DEFAULT_VALUE	0
 #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE	0
 #define PM_QOS_DEV_LAT_DEFAULT_VALUE		0
 
diff --git a/kernel/power/qos.c b/kernel/power/qos.c
index 1c1797d..b1b909d 100644
--- a/kernel/power/qos.c
+++ b/kernel/power/qos.c
@@ -84,6 +84,18 @@ static struct pm_qos_object network_lat_pm_qos = {
 	.name = "network_latency",
 };
 
+static BLOCKING_NOTIFIER_HEAD(memory_throughput_notifier);
+static struct pm_qos_constraints memory_tput_constraints = {
+	.list = PLIST_HEAD_INIT(memory_tput_constraints.list),
+	.target_value = PM_QOS_MEMORY_THROUGHPUT_DEFAULT_VALUE,
+	.default_value = PM_QOS_MEMORY_THROUGHPUT_DEFAULT_VALUE,
+	.type = PM_QOS_MAX,
+	.notifiers = &memory_throughput_notifier,
+};
+static struct pm_qos_object memory_throughput_pm_qos = {
+	.constraints = &memory_tput_constraints,
+	.name = "memory_throughput",
+};
 
 static BLOCKING_NOTIFIER_HEAD(network_throughput_notifier);
 static struct pm_qos_constraints network_tput_constraints = {
@@ -103,6 +115,7 @@ static struct pm_qos_object *pm_qos_array[] = {
 	&null_pm_qos,
 	&cpu_dma_pm_qos,
 	&network_lat_pm_qos,
+	&memory_throughput_pm_qos,
 	&network_throughput_pm_qos
 };
 
@@ -479,6 +492,10 @@ static int __init pm_qos_power_init(void)
 		printk(KERN_ERR "pm_qos_param: network_latency setup failed\n");
 		return ret;
 	}
+	ret = register_pm_qos_misc(&memory_throughput_pm_qos);
+	if (ret < 0)
+		printk(KERN_ERR
+			"pm_qos_param: memory_throughput setup failed\n");
 	ret = register_pm_qos_misc(&network_throughput_pm_qos);
 	if (ret < 0)
 		printk(KERN_ERR
-- 
1.7.4.1


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

* Re: [RFC/PATCH] PM QoS: main memory throughput constraints
  2011-09-30 14:16 [RFC/PATCH] PM QoS: main memory throughput constraints Jean Pihet
  2011-09-30 14:17 ` [PATCH] PM QoS: add a PM_QOS_MEMORY_THROUGHPUT class jean.pihet
@ 2011-09-30 20:28 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2011-09-30 20:28 UTC (permalink / raw)
  To: Jean Pihet
  Cc: Kevin Hilman, Paul Walmsley, Linux PM mailing list, linux-omap,
	Benoit Cousson

Hi,

On Friday, September 30, 2011, Jean Pihet wrote:
> Hi,
> 
> Here is a patch which adds a PM_QOS_MEMORY_THROUGHPUT class to the PM
> QoS framework. The idea is to provide a memory or SDMA throughput
> constraints class, which can be applied to the low level platform code
> using the callback notification mechanism and also a MISC /dev entry
> for the constraints from user space.
> 
> The first user of this class of constraints is the OMAP platform. The
> aggregated constraint is fed to the DVFS layer in order to control the
> main interconnect (L3) frequency and so the memory bandwidth. This
> comes as a subsequent patch.
> 
> This patch is RFC since more throughput constraints could be added in
> the future, in order to control more clocks in the system. Is it worth
> adding a class for every new subsystem to control?
> 
> What do you think?
> 
> The patch follows asap as a reply to this message. It applies on
> Rafael' latest linux-pm tree, cf.
> https://github.com/rjwysocki/linux-pm/commits/pm-qos.

Quite frankly, I'm not very fond of creating more special device files for
PM QoS at this point.  It would be nice if you could give an example of
how you intend to use it, especially from the user space's viewpoint.

Thanks,
Rafael

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

end of thread, other threads:[~2011-09-30 20:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-30 14:16 [RFC/PATCH] PM QoS: main memory throughput constraints Jean Pihet
2011-09-30 14:17 ` [PATCH] PM QoS: add a PM_QOS_MEMORY_THROUGHPUT class jean.pihet
2011-09-30 20:28 ` [RFC/PATCH] PM QoS: main memory throughput constraints Rafael J. Wysocki

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.