From: Leonard Crestez <leonard.crestez@nxp.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Viresh Kumar <viresh.kumar@linaro.org>
Cc: Linux PM <linux-pm@vger.kernel.org>,
Linux ACPI <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Sudeep Holla <sudeep.holla@arm.com>,
Dmitry Osipenko <digetx@gmail.com>
Subject: Re: [RFT][PATCH 1/3] PM: QoS: Introduce frequency QoS
Date: Thu, 24 Oct 2019 19:01:06 +0000 [thread overview]
Message-ID: <VI1PR04MB7023ECFFD42193CF864524ACEE6A0@VI1PR04MB7023.eurprd04.prod.outlook.com> (raw)
In-Reply-To: 4551555.oysnf1Sd0E@kreacher
On 16.10.2019 13:48, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Introduce frequency QoS, based on the "raw" low-level PM QoS, to
> represent min and max frequency requests and aggregate constraints.
>
> The min and max frequency requests are to be represented by
> struct freq_qos_request objects and the aggregate constraints are to
> be represented by struct freq_constraints objects. The latter are
> expected to be initialized with the help of freq_constraints_init().
>
> The freq_qos_read_value() helper is defined to retrieve the aggregate
> constraints values from a given struct freq_constraints object and
> there are the freq_qos_add_request(), freq_qos_update_request() and
> freq_qos_remove_request() helpers to manipulate the min and max
> frequency requests. It is assumed that the the helpers will not
> run concurrently with each other for the same struct freq_qos_request
> object, so if that may be the case, their uses must ensure proper
> synchronization between them (e.g. through locking).
>
> In addition, freq_qos_add_notifier() and freq_qos_remove_notifier()
> are provided to add and remove notifiers that will trigger on aggregate
> constraint changes to and from a given struct freq_constraints object,
> respectively.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> include/linux/pm_qos.h | 44 ++++++++
> kernel/power/qos.c | 240 +++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 284 insertions(+)
>
> Index: linux-pm/include/linux/pm_qos.h
> ===================================================================
> --- linux-pm.orig/include/linux/pm_qos.h
> +++ linux-pm/include/linux/pm_qos.h
> @@ -267,4 +267,48 @@ static inline s32 dev_pm_qos_raw_resume_
> }
> #endif
>
> +#define FREQ_QOS_MIN_DEFAULT_VALUE 0
> +#define FREQ_QOS_MAX_DEFAULT_VALUE (-1)
> +
> +enum freq_qos_req_type {
> + FREQ_QOS_MIN = 1,
> + FREQ_QOS_MAX,
> +};
> +
> +struct freq_constraints {
> + struct pm_qos_constraints min_freq;
> + struct blocking_notifier_head min_freq_notifiers;
> + struct pm_qos_constraints max_freq;
> + struct blocking_notifier_head max_freq_notifiers;
These min/max_freq_notifiers fields seem unused? They're initialized but
the freq_qos_add/remove_notifier calls use min/max_freq.notifiers directly.
Should probably just be dropped.
> +/**
> + * freq_qos_add_notifier - Add frequency QoS change notifier.
> + * @qos: List of requests to add the notifier to.
> + * @type: Request type.
> + * @notifier: Notifier block to add.
> + */
> +int freq_qos_add_notifier(struct freq_constraints *qos,
> + enum freq_qos_req_type type,
> + struct notifier_block *notifier)
> +{
> + int ret;
> +
> + if (IS_ERR_OR_NULL(qos) || !notifier)
> + return -EINVAL;
> +
> + switch (type) {
> + case FREQ_QOS_MIN:
> + ret = blocking_notifier_chain_register(qos->min_freq.notifiers,
> + notifier);
> + break;
> + case FREQ_QOS_MAX:
> + ret = blocking_notifier_chain_register(qos->max_freq.notifiers,
> + notifier);
> + break;
> + default:
> + WARN_ON(1);
> + ret = -EINVAL;
> + }
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(freq_qos_add_notifier);
> +
> +/**
> + * freq_qos_remove_notifier - Remove frequency QoS change notifier.
> + * @qos: List of requests to remove the notifier from.
> + * @type: Request type.
> + * @notifier: Notifier block to remove.
> + */
> +int freq_qos_remove_notifier(struct freq_constraints *qos,
> + enum freq_qos_req_type type,
> + struct notifier_block *notifier)
> +{
> + int ret;
> +
> + if (IS_ERR_OR_NULL(qos) || !notifier)
> + return -EINVAL;
> +
> + switch (type) {
> + case FREQ_QOS_MIN:
> + ret = blocking_notifier_chain_unregister(qos->min_freq.notifiers,
> + notifier);
> + break;
> + case FREQ_QOS_MAX:
> + ret = blocking_notifier_chain_unregister(qos->max_freq.notifiers,
> + notifier);
> + break;
> + default:
> + WARN_ON(1);
> + ret = -EINVAL;
> + }
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(freq_qos_remove_notifier);
next prev parent reply other threads:[~2019-10-24 19:01 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-16 10:37 [RFT][PATCH 0/3] cpufreq / PM: QoS: Introduce frequency QoS and use it in cpufreq Rafael J. Wysocki
2019-10-16 10:41 ` [RFT][PATCH 1/3] PM: QoS: Introduce frequency QoS Rafael J. Wysocki
2019-10-17 9:41 ` Viresh Kumar
2019-10-17 14:16 ` Rafael J. Wysocki
2019-10-18 5:41 ` Viresh Kumar
2019-10-24 19:01 ` Leonard Crestez [this message]
2019-10-24 19:34 ` Leonard Crestez
2019-11-17 16:13 ` Doug Smythies
2019-11-19 14:35 ` Doug Smythies
2019-11-19 19:17 ` Rafael J. Wysocki
2019-11-19 22:13 ` Rafael J. Wysocki
2019-11-20 6:55 ` Doug Smythies
2019-11-20 9:08 ` Rafael J. Wysocki
2019-10-16 10:47 ` [RFT][PATCH 2/3] cpufreq: Use per-policy " Rafael J. Wysocki
2019-10-16 18:01 ` Dmitry Osipenko
2019-10-17 21:29 ` Dmitry Osipenko
2019-10-18 9:29 ` Viresh Kumar
2019-10-18 15:31 ` Dmitry Osipenko
2019-10-16 10:47 ` [RFT][PATCH 3/3] PM: QoS: Drop frequency QoS types from device PM QoS Rafael J. Wysocki
2019-10-16 14:23 ` [RFT][PATCH 0/3] cpufreq / PM: QoS: Introduce frequency QoS and use it in cpufreq Sudeep Holla
2019-10-17 9:57 ` Viresh Kumar
2019-10-17 9:59 ` Sudeep Holla
2019-10-17 16:34 ` Rafael J. Wysocki
2019-10-17 16:42 ` Sudeep Holla
2019-10-18 5:44 ` Viresh Kumar
2019-10-18 8:24 ` Rafael J. Wysocki
2019-10-18 8:27 ` Viresh Kumar
2019-10-18 8:30 ` Rafael J. Wysocki
2019-10-18 9:24 ` Viresh Kumar
2019-10-18 9:26 ` Rafael J. Wysocki
2019-10-18 9:28 ` Viresh Kumar
2019-10-17 17:14 ` Sudeep Holla
2019-10-17 9:46 ` Viresh Kumar
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=VI1PR04MB7023ECFFD42193CF864524ACEE6A0@VI1PR04MB7023.eurprd04.prod.outlook.com \
--to=leonard.crestez@nxp.com \
--cc=digetx@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=sudeep.holla@arm.com \
--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).