From: Leonard Crestez <leonard.crestez@nxp.com>
To: Matthias Kaehlcke <mka@chromium.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Chanwoo Choi <cw00.choi@samsung.com>
Cc: "Kyungmin Park" <kyungmin.park@samsung.com>,
"MyungJoo Ham" <myungjoo.ham@samsung.com>,
"Artur Świgoń" <a.swigon@partner.samsung.com>,
"Saravana Kannan" <saravanak@google.com>,
"Krzysztof Kozlowski" <krzk@kernel.org>,
"Alexandre Bailon" <abailon@baylibre.com>,
"Georgi Djakov" <georgi.djakov@linaro.org>,
"Jacky Bai" <ping.bai@nxp.com>,
"Viresh Kumar" <viresh.kumar@linaro.org>,
dl-linux-imx <linux-imx@nxp.com>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH RFC 2/2] PM / devfreq: Use PM QoS for sysfs min/max_freq
Date: Mon, 25 Nov 2019 16:46:12 +0000 [thread overview]
Message-ID: <VI1PR04MB70237E859BBD7048B0DD0675EE4A0@VI1PR04MB7023.eurprd04.prod.outlook.com> (raw)
In-Reply-To: 20191121231622.GK27773@google.com
On 22.11.2019 01:16, Matthias Kaehlcke wrote:
> Hi Leonard,
>
> this seems to work ok as long as there are no other ('external') PM QoS
> requests, however the aggregate max_freq can be incorrect when there are
> multiple requests.
>
> I intended to test with devfreq_cooling using PM QoS, but this didn't work
> out due to limitations on my development platform. Instead I added another
> set of requests and sysfs attributes to devfreq (see patch below).
Thanks a lot for looking at this.
> With this we get:
>
> cat available_frequencies
> 180000000 267000000 355000000 430000000 565000000 650000000 800000000
>
> # ok
> cat max_freq
> 800000000
>
> # wtf???
> echo 650000000 > max_freq
> cat max_freq
> 800000000
>
> # this looks better
> echo 800000000 > test_max_freq
> cat max_freq
> 650000000
>
>
> The problem appears to be:
>
> #define PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE (-1)
>
> in include/linux/pm_qos.h (added by "PM / QoS: Restore
> DEV_PM_QOS_MIN/MAX_FREQUENCY")
>
> The aggregate value returned by
> dev_pm_qos_read_value(dev, DEV_PM_QOS_MAX_FREQUENCY) is the
> smallest of all requests, which is PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE
> unless all requests have set an actual constraint.
>
> You probably want to change the constant to resolve to S32_MAX or some
> other big value.
Since dev_pm_qos is now layered on top of freq_qos that should be:
#define PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE FREQ_QOS_MAX_DEFAULT_VALUE
I wrote a synthetic test and it seems your issue can be reproduced using
kunit on top of raw freq_qos. Looking a bit deeper into pm_qos
implementation it seems that there isn't much special treatment for
pm_qos_constraints. A reasonable solution would be:
#define FREQ_QOS_MAX_DEFAULT_VALUE S32_MAX
Cpufreq is not affected because it always sets "real" values but I
believe that creating requests that should be ignored is a valid approach.
Update on pm/qos here: https://patchwork.kernel.org/cover/11260627/
--
Regards,
Leonard
next prev parent reply other threads:[~2019-11-25 16:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-19 16:12 [PATCH RFC 0/2] PM / devfreq: Add dev_pm_qos support with minimal changes Leonard Crestez
2019-11-19 16:12 ` [PATCH RFC 1/2] PM / devfreq: Add PM QoS support Leonard Crestez
2019-12-02 1:13 ` Chanwoo Choi
2019-11-19 16:12 ` [PATCH RFC 2/2] PM / devfreq: Use PM QoS for sysfs min/max_freq Leonard Crestez
2019-11-21 23:16 ` Matthias Kaehlcke
2019-11-25 16:46 ` Leonard Crestez [this message]
2019-12-02 1:18 ` Chanwoo Choi
2019-12-04 10:46 ` [PATCH RFC 0/2] PM / devfreq: Add dev_pm_qos support with minimal changes Rafael J. Wysocki
2019-12-05 0:52 ` Chanwoo Choi
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=VI1PR04MB70237E859BBD7048B0DD0675EE4A0@VI1PR04MB7023.eurprd04.prod.outlook.com \
--to=leonard.crestez@nxp.com \
--cc=a.swigon@partner.samsung.com \
--cc=abailon@baylibre.com \
--cc=cw00.choi@samsung.com \
--cc=georgi.djakov@linaro.org \
--cc=krzk@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-pm@vger.kernel.org \
--cc=mka@chromium.org \
--cc=myungjoo.ham@samsung.com \
--cc=ping.bai@nxp.com \
--cc=rjw@rjwysocki.net \
--cc=saravanak@google.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).