All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Turquette <mturquette@linaro.org>
To: viresh.kumar@linaro.org
Cc: thomas.petazzoni@free-electrons.com, rjw@rjwysocki.net,
	linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org,
	shawn.guo@linaro.org, sboyd@codeaurora.org,
	linux-arm-msm@vger.kernel.org, spk.linux@gmail.com,
	pramod.gurav@smartplayin.com, rob.herring@linaro.org,
	ezequiel.garcia@free-electrons.com, tawfik@marvell.com,
	nadavh@marvell.com, alior@marvell.com, morten.rasmussen@arm.com,
	dietmar.eggemann@arm.com, vincent.guittot@linaro.org,
	nicolas.pitre@linaro.org, linux-kernel@vger.kernel.org,
	tuukka.tikkanen@linaro.org,
	Mike Turquette <mturquette@linaro.org>
Subject: [PATCH 1/2] cpufreq: add driver flag for sleepable transitions
Date: Wed,  8 Oct 2014 00:48:53 -0700	[thread overview]
Message-ID: <1412754534-14068-2-git-send-email-mturquette@linaro.org> (raw)
In-Reply-To: <1412754534-14068-1-git-send-email-mturquette@linaro.org>

The CPUfreq core does not differentiate between .target & .target_index
callbacks that may sleep or block and callbacks that are fast and return
immediately. To date this has not mattered much since the typical
CPUfreq governor calls the .target callback from process context via a
workqueue.

When calling the .target callback from a different context, such as a
scheduler load balance operation (see Morten's "energy aware scheduler"
RFC[0]), this detail matters.

This patch introduces a new CPUfreq driver flag for fast .target
callbacks that are guaranteed to neither sleep nor block. Setting this
flag allows for .target to be called from schedule() and other call
sites that have interrupts disabled or other constraints. Drivers may
set CPUFREQ_NO_SLEEP at driver registration-time.

The default is to not have this flag set, resulting in the need to defer
calls to .target and .target_index.

[0] http://lkml.kernel.org/r/<1381511957-29776-7-git-send-email-morten.rasmussen@arm.com>

Signed-off-by: Mike Turquette <mturquette@linaro.org>
---
 include/linux/cpufreq.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 138336b..9034573 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -308,6 +308,19 @@ struct cpufreq_driver {
  */
 #define CPUFREQ_NEED_INITIAL_FREQ_CHECK	(1 << 5)
 
+/*
+ * Set by drivers whose .target or .target_index callback will never sleep or
+ * block. Setting this flag allows for more optimal code by calling .target
+ * from a context that otherwise would require deferring the work.
+ *
+ * An example use of this flag is when scaling cpu frequency from within a call
+ * to schedule() with interrupts disabled and runqueue locks held.
+ *
+ * This flag is not set by default, causing calls to .target to be done in
+ * process context.
+ */
+#define CPUFREQ_NO_SLEEP (1 << 6)
+
 int cpufreq_register_driver(struct cpufreq_driver *driver_data);
 int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
 
-- 
1.8.3.2

  reply	other threads:[~2014-10-08  7:49 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10  4:29 [PATCH] cpufreq: dt: Support platforms with separate clock lines for each CPU Viresh Kumar
2014-09-10  6:29 ` Thomas Petazzoni
2014-09-10  6:42   ` Viresh Kumar
2014-09-10  9:41     ` [PATCH 0/4] cpufreq-dt, platform_data based proposal Thomas Petazzoni
2014-09-10  9:41       ` [PATCH 1/4] cpufreq: allow driver-specific flags Thomas Petazzoni
2014-09-10 10:49         ` Viresh Kumar
2014-09-27 22:44           ` Mike Turquette
2014-09-29  8:54             ` Viresh Kumar
     [not found]               ` <20141005004102.4379.42626@quantum>
2014-10-06  3:56                 ` Viresh Kumar
     [not found]                   ` <20141006183624.4379.26437@quantum>
2014-10-06 18:55                     ` Thomas Petazzoni
2014-10-06 21:44                       ` Mike Turquette
2014-10-07  3:27                         ` Viresh Kumar
2014-10-07  3:25                     ` Viresh Kumar
2014-10-08  7:48                       ` [PATCH 0/2] allow cpufreq drivers to export flags Mike Turquette
2014-10-08  7:48                         ` Mike Turquette [this message]
2014-10-08  7:48                         ` [PATCH 2/2] cpufreq: new function to query driver for flags Mike Turquette
2014-10-08  7:54                         ` [PATCH 0/2] allow cpufreq drivers to export flags Viresh Kumar
2014-10-08  7:54                           ` Viresh Kumar
2014-10-08  8:11                           ` Thomas Petazzoni
2014-10-08  8:11                             ` Thomas Petazzoni
2014-10-08  8:19                             ` Viresh Kumar
2014-10-08  8:19                               ` Viresh Kumar
2014-10-09  0:01                               ` Mike Turquette
2014-10-09  0:01                                 ` Mike Turquette
2014-10-09  3:37                                 ` Viresh Kumar
2014-10-09  3:37                                   ` Viresh Kumar
2014-09-10  9:41       ` [PATCH 2/4] cpufreq: cpufreq-dt: extend with platform_data Thomas Petazzoni
2014-09-10  9:41       ` [PATCH 3/4] ARM: mvebu: use the cpufreq-dt platform_data for independent clocks Thomas Petazzoni
2014-09-10  9:41       ` [PATCH 4/4] cpufreq: cpufreq-dt: remove warning about regulators Thomas Petazzoni
2014-09-10 10:30         ` Viresh Kumar
2014-09-10  9:53       ` [PATCH 0/4] cpufreq-dt, platform_data based proposal Arnd Bergmann
2014-09-10 10:10         ` Thomas Petazzoni
2014-09-10 10:19           ` Arnd Bergmann
2014-09-10 10:30             ` Thomas Petazzoni
2014-09-10 18:15         ` Stephen Boyd
2014-09-10 10:38       ` Viresh Kumar
2014-09-10 11:37         ` Thomas Petazzoni
2014-09-10 12:08     ` [PATCHv2 " Thomas Petazzoni
2014-09-10 12:08       ` [PATCHv2 1/4] cpufreq: allow driver-specific data Thomas Petazzoni
2014-09-10 12:08       ` [PATCHv2 2/4] cpufreq: cpufreq-dt: extend with platform_data Thomas Petazzoni
2014-09-10 12:22         ` Viresh Kumar
2014-09-10 12:28           ` Thomas Petazzoni
2014-09-10 12:32             ` Viresh Kumar
2014-09-10 12:36               ` Arnd Bergmann
2014-09-10 12:08       ` [PATCHv2 3/4] ARM: mvebu: use the cpufreq-dt platform_data for independent clocks Thomas Petazzoni
2014-09-10 12:08       ` [PATCHv2 4/4] cpufreq: cpufreq-dt: adjust message related to regulators Thomas Petazzoni
2014-09-10 12:23         ` Viresh Kumar
2014-09-10 12:38       ` [PATCHv2 0/4] cpufreq-dt, platform_data based proposal Viresh Kumar
2014-09-23  9:26       ` Thomas Petazzoni
2014-10-06  7:19       ` Thomas Petazzoni
2014-10-06 22:53         ` Rafael J. Wysocki
2014-10-07  3:30           ` Viresh Kumar
2014-10-07 23:59             ` Rafael J. Wysocki
2014-10-08  5:51               ` Viresh Kumar
2014-10-12 20:25                 ` Rafael J. Wysocki
2014-10-19  9:31                   ` Thomas Petazzoni

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=1412754534-14068-2-git-send-email-mturquette@linaro.org \
    --to=mturquette@linaro.org \
    --cc=alior@marvell.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=ezequiel.garcia@free-electrons.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=morten.rasmussen@arm.com \
    --cc=nadavh@marvell.com \
    --cc=nicolas.pitre@linaro.org \
    --cc=pramod.gurav@smartplayin.com \
    --cc=rjw@rjwysocki.net \
    --cc=rob.herring@linaro.org \
    --cc=sboyd@codeaurora.org \
    --cc=shawn.guo@linaro.org \
    --cc=spk.linux@gmail.com \
    --cc=tawfik@marvell.com \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=tuukka.tikkanen@linaro.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 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.