From: Tomeu Vizoso <tomeu.vizoso@collabora.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: "Thierry Reding" <thierry.reding@gmail.com>,
"Terje Bergström" <tbergstrom@nvidia.com>,
linux-pm@vger.kernel.org,
"Stephen Warren" <swarren@wwwdotorg.org>,
"Pavel Machek" <pavel@ucw.cz>, "Len Brown" <len.brown@intel.com>,
"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Javier Martinez Canillas" <javier.martinez@collabora.co.uk>,
"Mikko Perttunen" <mperttunen@nvidia.com>,
"Tomeu Vizoso" <tomeu.vizoso@collabora.com>
Subject: Re: [REPOST PATCH v4 1/2] PM / QoS: Add PM_QOS_MEMORY_BANDWIDTH class
Date: Fri, 12 Sep 2014 11:11:25 +0200 [thread overview]
Message-ID: <CAAObsKBkjqJiJ4OC4FYDXDBSFMFzvbvD_vJ6KzhqyyPCCB-o7g@mail.gmail.com> (raw)
In-Reply-To: <1409759373-22696-2-git-send-email-tomeu.vizoso@collabora.com>
On 3 September 2014 17:49, Tomeu Vizoso <tomeu.vizoso@collabora.com> wrote:
> Also adds a class type PM_QOS_SUM that aggregates the values by summing them.
>
> It can be used by memory controllers to calculate the optimum clock frequency
> based on the bandwidth needs of the different memory clients.
>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Acked-by: Pavel Machek <pavel@ucw.cz>
Hi Rafael,
will you take this one for 3.18?
Thanks,
Tomeu
> ---
>
> v3: * Changed units to be megabits per second
> ---
> Documentation/power/pm_qos_interface.txt | 4 +++-
> include/linux/pm_qos.h | 5 ++++-
> kernel/power/qos.c | 27 ++++++++++++++++++++++++++-
> 3 files changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/power/pm_qos_interface.txt b/Documentation/power/pm_qos_interface.txt
> index a5da5c7..129f7c0 100644
> --- a/Documentation/power/pm_qos_interface.txt
> +++ b/Documentation/power/pm_qos_interface.txt
> @@ -5,7 +5,8 @@ performance expectations by drivers, subsystems and user space applications on
> one of the parameters.
>
> Two different PM QoS frameworks are available:
> -1. PM QoS classes for cpu_dma_latency, network_latency, network_throughput.
> +1. PM QoS classes for cpu_dma_latency, network_latency, network_throughput,
> +memory_bandwidth.
> 2. the per-device PM QoS framework provides the API to manage the per-device latency
> constraints and PM QoS flags.
>
> @@ -13,6 +14,7 @@ Each parameters have defined units:
> * latency: usec
> * timeout: usec
> * throughput: kbs (kilo bit / sec)
> + * memory bandwidth: mbs (mega bit / sec)
>
>
> 1. PM QoS framework
> diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
> index 9ab4bf7..636e828 100644
> --- a/include/linux/pm_qos.h
> +++ b/include/linux/pm_qos.h
> @@ -15,6 +15,7 @@ enum {
> PM_QOS_CPU_DMA_LATENCY,
> PM_QOS_NETWORK_LATENCY,
> PM_QOS_NETWORK_THROUGHPUT,
> + PM_QOS_MEMORY_BANDWIDTH,
>
> /* insert new class ID */
> PM_QOS_NUM_CLASSES,
> @@ -32,6 +33,7 @@ enum pm_qos_flags_status {
> #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_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
> +#define PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE 0
> #define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0
> #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0
> #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1)
> @@ -69,7 +71,8 @@ struct dev_pm_qos_request {
> enum pm_qos_type {
> PM_QOS_UNITIALIZED,
> PM_QOS_MAX, /* return the largest value */
> - PM_QOS_MIN /* return the smallest value */
> + PM_QOS_MIN, /* return the smallest value */
> + PM_QOS_SUM /* return the sum */
> };
>
> /*
> diff --git a/kernel/power/qos.c b/kernel/power/qos.c
> index 884b770..5f4c006 100644
> --- a/kernel/power/qos.c
> +++ b/kernel/power/qos.c
> @@ -105,11 +105,27 @@ static struct pm_qos_object network_throughput_pm_qos = {
> };
>
>
> +static BLOCKING_NOTIFIER_HEAD(memory_bandwidth_notifier);
> +static struct pm_qos_constraints memory_bw_constraints = {
> + .list = PLIST_HEAD_INIT(memory_bw_constraints.list),
> + .target_value = PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE,
> + .default_value = PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE,
> + .no_constraint_value = PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE,
> + .type = PM_QOS_SUM,
> + .notifiers = &memory_bandwidth_notifier,
> +};
> +static struct pm_qos_object memory_bandwidth_pm_qos = {
> + .constraints = &memory_bw_constraints,
> + .name = "memory_bandwidth",
> +};
> +
> +
> static struct pm_qos_object *pm_qos_array[] = {
> &null_pm_qos,
> &cpu_dma_pm_qos,
> &network_lat_pm_qos,
> - &network_throughput_pm_qos
> + &network_throughput_pm_qos,
> + &memory_bandwidth_pm_qos,
> };
>
> static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
> @@ -130,6 +146,9 @@ static const struct file_operations pm_qos_power_fops = {
> /* unlocked internal variant */
> static inline int pm_qos_get_value(struct pm_qos_constraints *c)
> {
> + struct plist_node *node;
> + int total_value = 0;
> +
> if (plist_head_empty(&c->list))
> return c->no_constraint_value;
>
> @@ -140,6 +159,12 @@ static inline int pm_qos_get_value(struct pm_qos_constraints *c)
> case PM_QOS_MAX:
> return plist_last(&c->list)->prio;
>
> + case PM_QOS_SUM:
> + plist_for_each(node, &c->list)
> + total_value += node->prio;
> +
> + return total_value;
> +
> default:
> /* runtime check for not using enum */
> BUG();
> --
> 1.9.3
>
next prev parent reply other threads:[~2014-09-12 9:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-03 15:49 [REPOST PATCH v4 0/2] PM QoS: Add support for memory bandwidth constraints Tomeu Vizoso
2014-09-03 15:49 ` [REPOST PATCH v4 1/2] PM / QoS: Add PM_QOS_MEMORY_BANDWIDTH class Tomeu Vizoso
2014-09-12 9:11 ` Tomeu Vizoso [this message]
2014-09-14 17:06 ` Rafael J. Wysocki
2014-09-24 8:42 ` Tomeu Vizoso
2014-09-24 13:32 ` Rafael J. Wysocki
2014-09-24 13:31 ` Tomeu Vizoso
2014-09-25 23:51 ` Rafael J. Wysocki
2014-10-10 6:59 ` Tomeu Vizoso
2014-10-12 20:21 ` Rafael J. Wysocki
2014-09-03 15:49 ` [REPOST PATCH v4 2/2] drm/tegra: Request memory bandwidth for the display controller Tomeu Vizoso
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=CAAObsKBkjqJiJ4OC4FYDXDBSFMFzvbvD_vJ6KzhqyyPCCB-o7g@mail.gmail.com \
--to=tomeu.vizoso@collabora.com \
--cc=javier.martinez@collabora.co.uk \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mperttunen@nvidia.com \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=swarren@wwwdotorg.org \
--cc=tbergstrom@nvidia.com \
--cc=thierry.reding@gmail.com \
/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®