DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kevin Laatz <kevin.laatz@intel.com>
To: "Burakov, Anatoly" <anatoly.burakov@intel.com>, <dev@dpdk.org>
Cc: David Hunt <david.hunt@intel.com>, Ray Kinsella <mdr@ashroe.eu>
Subject: Re: [PATCH v2 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode
Date: Mon, 23 May 2022 17:25:25 +0100	[thread overview]
Message-ID: <8cdc40ad-b53f-32f6-db3c-260829892837@intel.com> (raw)
In-Reply-To: <f9f7528d-00ab-b375-3602-1b58a11b24aa@intel.com>


On 18/05/2022 10:05, Burakov, Anatoly wrote:
> On 19-Apr-22 12:25 PM, Kevin Laatz wrote:
>> Add new get/set API to allow the user or application to set the minimum
>> and maximum frequencies to use when scaling.
>> Previously, the frequency range was determined by the HW capabilities of
>> the CPU. With this new API, the user or application can constrain this
>> if required.
>>
>> Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
>> ---
>
> <snip>
>
>>   +int
>> +rte_power_pmd_mgmt_set_scaling_freq_min(unsigned int lcore, unsigned 
>> int min)
>> +{
>> +    if (lcore >= RTE_MAX_LCORE) {
>> +        RTE_LOG(ERR, POWER, "Invalid lcore ID: %u\n", lcore);
>> +        rte_errno = EINVAL;
>> +        return -1;
>> +    }
>> +    scale_freq_min[lcore] = min;
>
> Are there any constraints on the value ranges, or are we just going to 
> accept any and all values? If the idea was to allow valid values plus 
> some special "default" value, you can still restrict the range, but 
> allow 0 as a special case?

When writing min/max values to HW the values are clamped. Since the API 
takes unsigned integer for the frequency value (in this case 'min'), any 
value can be considered as 'valid'.

That being said, this should at least check that min <= max for the same 
lcore. I'll add this for v3.


>
>> +
>> +    return 0;
>> +}
>> +
>> +int
>> +rte_power_pmd_mgmt_set_scaling_freq_max(unsigned int lcore, unsigned 
>> int max)
>> +{
>> +    if (lcore >= RTE_MAX_LCORE) {
>> +        RTE_LOG(ERR, POWER, "Invalid lcore ID: %u\n", lcore);
>> +        rte_errno = EINVAL;
>> +        return -1;
>> +    }
>> +    scale_freq_max[lcore] = max;
>
> Same as above. Also, do we want UINT32_MAX be the "special" value for 
> the "max" case? What do you think of having "0" as "not set", but 
> maybe set it internally to UINT32_MAX if you still want to keep using 
> the RTE_MIN/MAX macros?

Similar to  'set_scaling_freq_min', the value will be clamped by HW so 
any value can be considered 'valid'. I don't see the benefit of having 
"0" for not set, since UINT32_MAX will achieve the same result, i.e. the 
value won't be used (it will fall back the max value in sysfs). Do you 
have a use-case for it if we don't need a 'special case'?

Will add a check to make sure max >= min for v3.


>
>> +
>> +    return 0;
>> +}
>> +
>> +int
>> +rte_power_pmd_mgmt_get_scaling_freq_min(unsigned int lcore)
>> +{
>
> <snip>
>
>> diff --git a/lib/power/rte_power_pmd_mgmt.h 
>> b/lib/power/rte_power_pmd_mgmt.h
>> index 18a9c3abb5..74e3fa710b 100644
>> --- a/lib/power/rte_power_pmd_mgmt.h
>> +++ b/lib/power/rte_power_pmd_mgmt.h
>> @@ -148,6 +148,86 @@ __rte_experimental
>>   unsigned int
>>   rte_power_pmd_mgmt_get_pause_duration(void);
>>   +/**
>> + * @warning
>> + * @b EXPERIMENTAL: this API may change, or be removed, without 
>> prior notice.
>> + *
>> + * Set the min frequency to be used for frequency scaling.
>> + *
>> + * @note Supported by: Pstate mode.
>> + *
>> + * @param lcore
>> + *   The ID of the lcore to set the min frequency for.
>> + * @param min
>> + *   The value, in Hertz, to set the minimum frequency to.
>
> Is it really in Hertz? As far as I can tell, it's in steps of 100MHz 
> (BUS_FREQ).

Correct, the frequency changes in steps of 100MHz, but the value passed 
to 'min' is in kHz - will ammend the comments.



  reply	other threads:[~2022-05-23 16:25 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08 14:08 [PATCH 0/4] Add APIs for configurable power options Kevin Laatz
2022-04-08 14:08 ` [PATCH 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-04-15 14:43   ` Ray Kinsella
2022-04-19 11:25     ` Kevin Laatz
2022-04-08 14:08 ` [PATCH 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-04-08 14:08 ` [PATCH 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-04-08 14:08 ` [PATCH 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-04-19 11:24 ` [PATCH v2 0/4] Add APIs for configurable power options Kevin Laatz
2022-04-19 11:24   ` [PATCH v2 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-04-19 15:42     ` Ray Kinsella
2022-04-19 11:24   ` [PATCH v2 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-04-19 15:42     ` Ray Kinsella
2022-05-18  8:58     ` Burakov, Anatoly
2022-04-19 11:25   ` [PATCH v2 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-04-19 15:43     ` Ray Kinsella
2022-05-18  9:05     ` Burakov, Anatoly
2022-05-23 16:25       ` Kevin Laatz [this message]
2022-04-19 11:25   ` [PATCH v2 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-05-18  9:11     ` Burakov, Anatoly
2022-05-23 16:54       ` Kevin Laatz
2022-05-23 20:21   ` [PATCH v3 0/4] Add APIs for configurable power options Kevin Laatz
2022-05-23 20:21     ` [PATCH v3 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-05-24 13:45       ` Ray Kinsella
2022-05-23 20:21     ` [PATCH v3 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-05-23 20:21     ` [PATCH v3 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-05-24 10:00       ` Burakov, Anatoly
2022-05-23 20:21     ` [PATCH v3 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-05-24 10:03       ` Burakov, Anatoly
2022-05-24 13:14 ` [PATCH v4 0/4] Add APIs for configurable power options Kevin Laatz
2022-05-24 13:14   ` [PATCH v4 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-05-24 14:40     ` David Hunt
2022-05-24 13:14   ` [PATCH v4 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-05-24 14:39     ` David Hunt
2022-05-24 13:14   ` [PATCH v4 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-05-24 14:39     ` David Hunt
2022-05-24 13:14   ` [PATCH v4 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-05-24 14:38     ` David Hunt
2022-05-27 16:04   ` [PATCH v4 0/4] Add APIs for configurable power options Burakov, Anatoly
2022-05-31  9:59 ` [PATCH v5 " Kevin Laatz
2022-05-31  9:59   ` [PATCH v5 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-05-31  9:59   ` [PATCH v5 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-06-02 14:01     ` Burakov, Anatoly
2022-06-02 14:53       ` Kevin Laatz
2022-05-31  9:59   ` [PATCH v5 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-05-31  9:59   ` [PATCH v5 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-06-02 15:13 ` [PATCH v6 0/4] Add APIs for configurable power options Kevin Laatz
2022-06-02 15:13   ` [PATCH v6 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-06-02 15:13   ` [PATCH v6 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-06-02 15:13   ` [PATCH v6 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-06-02 15:13   ` [PATCH v6 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-06-04 20:43   ` [PATCH v6 0/4] Add APIs for configurable power options Thomas Monjalon

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=8cdc40ad-b53f-32f6-db3c-260829892837@intel.com \
    --to=kevin.laatz@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=mdr@ashroe.eu \
    /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).