linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Caleb Connolly <caleb.connolly@linaro.org>, rafael@kernel.org
Cc: lina.iyer@linaro.org, lukasz.luba@arm.com,
	quic_manafm@quicinc.com, quic_priyjain@quicinc.com,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Viresh Kumar <viresh.kumar@linaro.org>
Subject: Re: [PATCH v1 2/2] PM: QoS: Add a performance QoS
Date: Tue, 19 Dec 2023 13:33:25 +0100	[thread overview]
Message-ID: <3a61d2d9-158f-4728-af19-a8700d5ce1a1@linaro.org> (raw)
In-Reply-To: <9f8566b8-71d3-4dbd-8bde-f9a4cfde8372@linaro.org>


Hi Caleb,

[Cc'ed Viresh]

On 13/12/2023 19:35, Caleb Connolly wrote:
> Hi Daniel,
> 
> On 13/12/2023 17:58, Daniel Lezcano wrote:
>> Currently cpufreq and devfreq are using the freq QoS to aggregate the
>> requests for frequency ranges.
>>
>> However, there are new devices wanting to act not on a frequency range
>> but on a performance index range. Those need also to export to
>> userspace the knob to act on their performance limits.
>>
>> This change provides a performance limiter QoS based on a minimum /
>> maximum performance values. At init time, the limits of the interval
>> are 0 / 1024. It is up to the backend to convert the 1024 to the
>> maximum performance state. So if the performance must be limited to
>> 50%, it should set to maximum limit to 512 where the backend will end
>> up by converting (max performance index / 2). The same applies for the
>> minimum. Obviously, the min can not be greater than the max.
> 
> I really feel like it should be possible to have arbitrary min/max
> performance values. As is the case with latency and frequency.

We had an initial discussion about the performance QoS some weeks ago. 
Rafael is reluctant to have arbitrary values. So it was proposed a 1024 
based approach and let the back end to convert the value to its index.

If we go for a similar approach to the frequencies, then we should have 
more files to describe the different states. At least one defining the 
current state, the min and the max.


>>   1. With the example above, if there is a odd number like 5 for the
>>   number of performance indexes and we ask for 512 (so 50%), what would
>>   be the performance index computed? (5/2=2 or 5/2=3)? (I would say the
>>   minimum otherwise we end up with a performance limit greater than
>>   what we actually asked for).
> 
> For a device with just a handful of performance indices this is quite a
> large margin for error. If there are just 3 for example, and some
> algorithm is decreasing the performance level over time (e.g. due to
> some thermal condition), the algorithm cannot determine at what point
> the devices performance level has actually changed, making debugging and
> tuning of behaviour needlessly difficult.

Yes, it is a valid point. May be we can find an intermediate approach.

If we define an additional information, let's call it "granularity" for 
example and keep the 0-1023, then the userspace can rely on this 
information to build the steps.

If we take your example with a 3 performance states device, then the 
granularity would be:

1024 / 3 = 341.3

As floating does not exist in the kernel, then it would be 342.

State 0 = 0 x 342 = 0
State 1 = 1 x 342 = 342
State 2 = 2 x 342 = 684
State 3 = 3 x 342 = 1026 (floored to 1024)

So we end up with a fixed range, a way to quickly escalate the stairs 
and three files in the device's power sysfs entry.

> This also leaves it up to the backend driver to decide if it should
> round up or down, something that should definitely be handled by the
> framework.

> Maybe I missed some previous discussion, but isn't this what
> operating-points is designed for?
> 
> It has an `opp-level` property, but that is meant to be device-specific.
> With the `opp-hz` property being the "normalised" values that the
> framework deals with.
> 
> We would just want some way to defined an `opp-level` as a percentage
> (or whatever), with an arbitrary `opp-performance-index` being the
> device-specific property.
> 
> This also gracefully handles non-linear performance scaling.

I think it is a different subject, we are talking about how to describe 
the hardware and these performance states. But I agree, it is worth to 
keep the opp description in mind.

[ ... ]

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


  reply	other threads:[~2023-12-19 12:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13 17:58 [PATCH v1 1/2] PM: QoS: Rename freq to range constraint Daniel Lezcano
2023-12-13 17:58 ` [PATCH v1 2/2] PM: QoS: Add a performance QoS Daniel Lezcano
2023-12-13 18:35   ` Caleb Connolly
2023-12-19 12:33     ` Daniel Lezcano [this message]
2023-12-14  7:23   ` kernel test robot
2023-12-14  7:35   ` kernel test robot
2024-02-12 17:30   ` Rafael J. Wysocki
2024-02-14 10:41     ` Daniel Lezcano
2024-02-15  9:39   ` Dhruva Gole
2023-12-14  9:49 ` [PATCH v1 1/2] PM: QoS: Rename freq to range constraint Rafael J. Wysocki

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=3a61d2d9-158f-4728-af19-a8700d5ce1a1@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=caleb.connolly@linaro.org \
    --cc=lina.iyer@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=quic_manafm@quicinc.com \
    --cc=quic_priyjain@quicinc.com \
    --cc=rafael@kernel.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).