From: Morten Rasmussen <morten.rasmussen@arm.com>
To: mingo@kernel.org, peterz@infradead.org
Cc: pjt@google.com, arjan@linux.intel.com, rjw@sisk.pl,
dirk.j.brandewie@intel.com, vincent.guittot@linaro.org,
alex.shi@linaro.org, preeti@linux.vnet.ibm.com, efault@gmx.de,
corbet@lwn.net, tglx@linutronix.de, catalin.marinas@arm.com,
morten.rasmussen@arm.com, linux-kernel@vger.kernel.org,
linaro-kernel@lists.linaro.org
Subject: [RFC][PATCH 1/7] Initial power driver interface infrastructure
Date: Fri, 11 Oct 2013 18:19:11 +0100 [thread overview]
Message-ID: <1381511957-29776-2-git-send-email-morten.rasmussen@arm.com> (raw)
In-Reply-To: <1381511957-29776-1-git-send-email-morten.rasmussen@arm.com>
Infrastructure for power driver registration and defines three initial
power driver interface calls: go_faster(), go_slower(), and
at_max_capacity(). The intention is to use these to guide scheduling
decisions and frequency state selection in the power driver.
Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
---
arch/arm/Kconfig | 4 +++
include/linux/sched/power.h | 32 ++++++++++++++++++++++++
kernel/sched/Makefile | 1 +
kernel/sched/power.c | 58 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 95 insertions(+)
create mode 100644 include/linux/sched/power.h
create mode 100644 kernel/sched/power.c
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 43594d5..763d147 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1844,6 +1844,10 @@ config XEN
help
Say Y if you want to run Linux in a Virtual Machine on Xen on ARM.
+config SCHED_POWER
+ bool "(EXPERIMENTAL) Power aware scheduling"
+ default n
+
endmenu
menu "Boot options"
diff --git a/include/linux/sched/power.h b/include/linux/sched/power.h
new file mode 100644
index 0000000..cb2cf37
--- /dev/null
+++ b/include/linux/sched/power.h
@@ -0,0 +1,32 @@
+/*
+ * include/linux/sched/power.h
+ *
+ * Copyright (C) 2013 ARM Limited.
+ * Author: Morten Rasmussen <morten.rasmussen@arm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef _LINUX_SCHED_POWER_H
+#define _LINUX_SCHED_POWER_H
+
+struct power_driver {
+
+ /*
+ * Power driver calls may happen from scheduler context with irq
+ * disabled and rq locks held. This must be taken into account in the
+ * power driver.
+ */
+
+ /* cpu already at max capacity? */
+ int (*at_max_capacity) (int cpu);
+ /* Increase cpu capacity hint */
+ int (*go_faster) (int cpu, int hint);
+ /* Decrease cpu capacity hint */
+ int (*go_slower) (int cpu, int hint);
+};
+
+int power_driver_register(struct power_driver *driver);
+int power_driver_unregister(struct power_driver *driver);
+#endif
diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
index 54adcf3..55727b4 100644
--- a/kernel/sched/Makefile
+++ b/kernel/sched/Makefile
@@ -17,3 +17,4 @@ obj-$(CONFIG_SCHED_AUTOGROUP) += auto_group.o
obj-$(CONFIG_SCHEDSTATS) += stats.o
obj-$(CONFIG_SCHED_DEBUG) += debug.o
obj-$(CONFIG_CGROUP_CPUACCT) += cpuacct.o
+obj-$(CONFIG_SCHED_POWER) += power.o
diff --git a/kernel/sched/power.c b/kernel/sched/power.c
new file mode 100644
index 0000000..b82965a
--- /dev/null
+++ b/kernel/sched/power.c
@@ -0,0 +1,58 @@
+/*
+ * kernel/sched/power.c
+ *
+ * Copyright (C) 2013 ARM Limited.
+ * Author: Morten Rasmussen <morten.rasmussen@arm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/sched/power.h>
+
+static struct power_driver *power_driver;
+
+int power_driver_register(struct power_driver *driver)
+{
+ power_driver = driver;
+
+ return 1;
+}
+
+int power_driver_unregister(struct power_driver *driver)
+{
+ power_driver = NULL;
+
+ return 1;
+}
+
+int at_max_capacity(int cpu)
+{
+ /* Assume no performance scaling when no driver */
+ if (!power_driver)
+ return 1;
+
+ return power_driver->at_max_capacity(cpu);
+}
+
+int go_faster(int cpu, int hint)
+{
+ /* Assume no performance scaling when no driver */
+ if (!power_driver)
+ return 0;
+
+ return power_driver->go_faster(cpu, hint);
+}
+
+int go_slower(int cpu, int hint)
+{
+ /* Assume no performance scaling when no driver */
+ if (!power_driver)
+ return 0;
+
+ return power_driver->go_slower(cpu, hint);
+}
+
--
1.7.9.5
next prev parent reply other threads:[~2013-10-11 17:21 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 17:19 [RFC][PATCH 0/7] Power-aware scheduling v2 Morten Rasmussen
2013-10-11 17:19 ` Morten Rasmussen [this message]
2013-10-11 17:19 ` [RFC][PATCH 2/7] sched: power: Power driver late callback interface Morten Rasmussen
2013-10-14 13:42 ` Peter Zijlstra
2013-10-11 17:19 ` [RFC][PATCH 3/7] sched: power: go_faster/slower power driver hints Morten Rasmussen
2013-10-12 2:58 ` Michael wang
2013-10-14 12:42 ` Morten Rasmussen
2013-10-14 13:48 ` Peter Zijlstra
2013-10-14 15:55 ` Morten Rasmussen
2013-10-11 17:19 ` [RFC][PATCH 4/7] sched: power: Remove power capacity hints for kworker threads Morten Rasmussen
2013-10-14 13:33 ` Peter Zijlstra
2013-10-14 15:14 ` Arjan van de Ven
2013-10-17 16:40 ` Morten Rasmussen
2013-10-17 16:54 ` Peter Zijlstra
2013-10-17 17:18 ` Arjan van de Ven
2013-10-18 8:47 ` Morten Rasmussen
2013-10-18 13:43 ` Arjan van de Ven
2013-10-18 8:38 ` Morten Rasmussen
2013-10-14 16:10 ` Morten Rasmussen
2013-10-14 16:13 ` Arjan van de Ven
2013-10-14 17:19 ` Morten Rasmussen
2013-10-11 17:19 ` [RFC][PATCH 5/7] sched: power: Increase cpu capacity based on rq tracked load Morten Rasmussen
2013-10-11 17:19 ` [RFC][PATCH 6/7] sched: power: cpufreq: Initial schedpower cpufreq governor/power driver Morten Rasmussen
2013-10-11 17:19 ` [RFC][PATCH 7/7] sched: power: Let the power driver choose the best wake-up cpu Morten Rasmussen
2013-10-14 13:32 ` [RFC][PATCH 0/7] Power-aware scheduling v2 Peter Zijlstra
2013-10-14 17:15 ` Morten Rasmussen
2013-10-14 17:31 ` Peter Zijlstra
2013-10-15 17:05 ` Morten Rasmussen
2013-10-15 9:57 ` Preeti U Murthy
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=1381511957-29776-2-git-send-email-morten.rasmussen@arm.com \
--to=morten.rasmussen@arm.com \
--cc=alex.shi@linaro.org \
--cc=arjan@linux.intel.com \
--cc=catalin.marinas@arm.com \
--cc=corbet@lwn.net \
--cc=dirk.j.brandewie@intel.com \
--cc=efault@gmx.de \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=preeti@linux.vnet.ibm.com \
--cc=rjw@sisk.pl \
--cc=tglx@linutronix.de \
--cc=vincent.guittot@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®