From: Steve Muckle <steve.muckle@linaro.org>
To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
Vincent Guittot <vincent.guittot@linaro.org>,
Morten Rasmussen <morten.rasmussen@arm.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Juri Lelli <Juri.Lelli@arm.com>,
Patrick Bellasi <patrick.bellasi@arm.com>,
Michael Turquette <mturquette@baylibre.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>
Subject: [RFCv6 PATCH 02/10] cpufreq: introduce cpufreq_driver_is_slow
Date: Tue, 8 Dec 2015 22:19:23 -0800 [thread overview]
Message-ID: <1449641971-20827-3-git-send-email-smuckle@linaro.org> (raw)
In-Reply-To: <1449641971-20827-1-git-send-email-smuckle@linaro.org>
From: Michael Turquette <mturquette@baylibre.com>
Some architectures and platforms perform CPU frequency transitions
through a non-blocking method, while some might block or sleep. Even
when frequency transitions do not block or sleep they may be very slow.
This distinction is important when trying to change frequency from
a non-interruptible context in a scheduler hot path.
Describe this distinction with a cpufreq driver flag,
CPUFREQ_DRIVER_FAST. The default is to not have this flag set,
thus erring on the side of caution.
cpufreq_driver_is_slow() is also introduced in this patch. Setting
the above flag will allow this function to return false.
[smuckle@linaro.org: change flag/API to include drivers that are too
slow for scheduler hot paths, in addition to those that block/sleep]
Cc: Rafael J. Wysocki <rafael@kernel.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Signed-off-by: Steve Muckle <smuckle@linaro.org>
---
drivers/cpufreq/cpufreq.c | 6 ++++++
include/linux/cpufreq.h | 9 +++++++++
2 files changed, 15 insertions(+)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 7c48e73..8482820 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -154,6 +154,12 @@ bool have_governor_per_policy(void)
}
EXPORT_SYMBOL_GPL(have_governor_per_policy);
+bool cpufreq_driver_is_slow(void)
+{
+ return !(cpufreq_driver->flags & CPUFREQ_DRIVER_FAST);
+}
+EXPORT_SYMBOL_GPL(cpufreq_driver_is_slow);
+
struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy)
{
if (have_governor_per_policy())
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index ef4c5b1..7f8c63d 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -159,6 +159,7 @@ u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy);
int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
int cpufreq_update_policy(unsigned int cpu);
bool have_governor_per_policy(void);
+bool cpufreq_driver_is_slow(void);
struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
#else
static inline unsigned int cpufreq_get(unsigned int cpu)
@@ -316,6 +317,14 @@ struct cpufreq_driver {
*/
#define CPUFREQ_NEED_INITIAL_FREQ_CHECK (1 << 5)
+/*
+ * Indicates that it is safe to call cpufreq_driver_target from
+ * non-interruptable context in scheduler hot paths. Drivers must
+ * opt-in to this flag, as the safe default is that they might sleep
+ * or be too slow for hot path use.
+ */
+#define CPUFREQ_DRIVER_FAST (1 << 6)
+
int cpufreq_register_driver(struct cpufreq_driver *driver_data);
int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
--
2.4.10
next prev parent reply other threads:[~2015-12-09 6:26 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-09 6:19 [RFCv6 PATCH 00/10] sched: scheduler-driven CPU frequency selection Steve Muckle
2015-12-09 6:19 ` [RFCv6 PATCH 01/10] sched: Compute cpu capacity available at current frequency Steve Muckle
2015-12-09 6:19 ` Steve Muckle [this message]
2015-12-09 6:19 ` [RFCv6 PATCH 03/10] sched: scheduler-driven cpu frequency selection Steve Muckle
2015-12-11 11:04 ` Juri Lelli
2015-12-15 2:02 ` Steve Muckle
2015-12-15 10:31 ` Juri Lelli
2015-12-16 1:22 ` Steve Muckle
2015-12-16 3:48 ` Leo Yan
2015-12-17 1:24 ` Steve Muckle
2015-12-17 7:17 ` Leo Yan
2015-12-18 19:15 ` Steve Muckle
2015-12-19 5:54 ` Leo Yan
2016-01-25 12:06 ` Ricky Liang
2016-01-27 1:14 ` Steve Muckle
2016-02-01 17:10 ` Ricky Liang
2016-02-11 4:44 ` Steve Muckle
2015-12-09 6:19 ` [RFCv6 PATCH 04/10] sched/fair: add triggers for OPP change requests Steve Muckle
2015-12-09 6:19 ` [RFCv6 PATCH 05/10] sched/{core,fair}: trigger OPP change request on fork() Steve Muckle
2015-12-09 6:19 ` [RFCv6 PATCH 06/10] sched/fair: cpufreq_sched triggers for load balancing Steve Muckle
2015-12-09 6:19 ` [RFCv6 PATCH 07/10] sched/fair: jump to max OPP when crossing UP threshold Steve Muckle
2015-12-11 11:12 ` Juri Lelli
2015-12-15 2:42 ` Steve Muckle
2015-12-09 6:19 ` [RFCv6 PATCH 08/10] sched: remove call of sched_avg_update from sched_rt_avg_update Steve Muckle
2015-12-09 6:19 ` [RFCv6 PATCH 09/10] sched: deadline: use deadline bandwidth in scale_rt_capacity Steve Muckle
2015-12-09 8:50 ` Vincent Guittot
2015-12-10 13:27 ` Luca Abeni
2015-12-10 16:11 ` Vincent Guittot
2015-12-11 7:48 ` Luca Abeni
2015-12-14 14:02 ` Vincent Guittot
2015-12-14 14:38 ` Luca Abeni
2015-12-14 15:17 ` Peter Zijlstra
2015-12-14 15:56 ` Vincent Guittot
2015-12-14 16:07 ` Juri Lelli
2015-12-14 21:19 ` Luca Abeni
2015-12-14 16:51 ` Peter Zijlstra
2015-12-14 21:31 ` Luca Abeni
2015-12-15 12:38 ` Peter Zijlstra
2015-12-15 13:30 ` Luca Abeni
2015-12-15 13:42 ` Peter Zijlstra
2015-12-15 21:24 ` Luca Abeni
2015-12-16 9:28 ` Juri Lelli
2015-12-15 4:43 ` Vincent Guittot
2015-12-15 12:41 ` Peter Zijlstra
2015-12-15 12:56 ` Vincent Guittot
2015-12-14 21:12 ` Luca Abeni
2015-12-15 4:59 ` Vincent Guittot
2015-12-15 8:50 ` Luca Abeni
2015-12-15 12:20 ` Peter Zijlstra
2015-12-15 12:46 ` Vincent Guittot
2015-12-15 13:18 ` Luca Abeni
2015-12-15 12:23 ` Peter Zijlstra
2015-12-15 13:21 ` Luca Abeni
2015-12-15 12:43 ` Vincent Guittot
2015-12-15 13:39 ` Luca Abeni
2015-12-15 12:58 ` Vincent Guittot
2015-12-15 13:41 ` Luca Abeni
2015-12-09 6:19 ` [RFCv6 PATCH 10/10] sched: rt scheduler sets capacity requirement Steve Muckle
2015-12-11 11:22 ` Juri Lelli
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=1449641971-20827-3-git-send-email-smuckle@linaro.org \
--to=steve.muckle@linaro.org \
--cc=Juri.Lelli@arm.com \
--cc=dietmar.eggemann@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=morten.rasmussen@arm.com \
--cc=mturquette@baylibre.com \
--cc=patrick.bellasi@arm.com \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@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;
as well as URLs for NNTP newsgroup(s).