DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: David Hunt <david.hunt@intel.com>
Subject: Re: [dpdk-dev] [PATCH 3/3] power: do not skip saving original pstate governor
Date: Tue, 30 Mar 2021 17:52:21 +0100	[thread overview]
Message-ID: <26de9fbf-8470-6ee8-58a6-db47e23ec00f@intel.com> (raw)
In-Reply-To: <33bdcdb912b4a2e3e9cb743dd93385fad78ece86.1617113740.git.anatoly.burakov@intel.com>

On 30-Mar-21 3:15 PM, Anatoly Burakov wrote:
> Currently, when we set the pstate governor to "performance", we check if
> it is already set to this value, and if it is, we skip setting it.
> 
> However, we never save this value anywhere, so that next time we come
> back and request the governor to be set to its original value, the
> original value is empty.
> 
> Fix it by saving the original pstate governor first. While we're at it,
> replace `strlcpy` with `strscpy`.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>   lib/librte_power/power_pstate_cpufreq.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_power/power_pstate_cpufreq.c b/lib/librte_power/power_pstate_cpufreq.c
> index 7ea1bf677a..a7a44df23f 100644
> --- a/lib/librte_power/power_pstate_cpufreq.c
> +++ b/lib/librte_power/power_pstate_cpufreq.c
> @@ -450,6 +450,9 @@ power_set_governor_performance(struct pstate_power_info *pi)
>   	ret = read_core_sysfs_s(f_governor, buf, sizeof(buf));
>   	FOPS_OR_ERR_GOTO(ret, out);
>   
> +	/* Save the original governor */
> +	strscpy(pi->governor_ori, buf, sizeof(pi->governor_ori));
> +
>   	/* Check if current governor is performance */
>   	if (strncmp(buf, POWER_GOVERNOR_PERF,
>   			sizeof(POWER_GOVERNOR_PERF)) == 0) {
> @@ -458,8 +461,6 @@ power_set_governor_performance(struct pstate_power_info *pi)
>   				"already performance\n", pi->lcore_id);
>   		goto out;
>   	}
> -	/* Save the original governor */
> -	strlcpy(pi->governor_ori, buf, sizeof(pi->governor_ori));
>   
>   	/* Write 'performance' to the governor */
>   	ret = write_core_sysfs_s(f_governor, POWER_GOVERNOR_PERF);
> 

Forgot rte_ with strscpy...

-- 
Thanks,
Anatoly

  reply	other threads:[~2021-03-30 16:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 14:15 [dpdk-dev] [PATCH 1/3] power: refactor base frequency detection Anatoly Burakov
2021-03-30 14:15 ` [dpdk-dev] [PATCH 2/3] power: refactor pstate sysfs handling Anatoly Burakov
2021-03-30 14:15 ` [dpdk-dev] [PATCH 3/3] power: do not skip saving original pstate governor Anatoly Burakov
2021-03-30 16:52   ` Burakov, Anatoly [this message]
2021-03-30 14:25 ` [dpdk-dev] [PATCH v2 1/3] power: refactor base frequency detection Anatoly Burakov
2021-04-01 15:04   ` [dpdk-dev] [PATCH v2 1/2] power: fix pstate base frequency handling Anatoly Burakov
2021-04-01 15:05   ` [dpdk-dev] [PATCH v2 2/2] power: do not skip saving original pstate governor Anatoly Burakov
2021-04-01 15:06   ` [dpdk-dev] [PATCH v3 1/2] power: fix pstate base frequency handling Anatoly Burakov
2021-04-02  9:26     ` [dpdk-dev] [PATCH v4 " Anatoly Burakov
2021-04-02  9:35       ` Burakov, Anatoly
2021-04-02 11:12         ` Pattan, Reshma
2021-04-02  9:26     ` [dpdk-dev] [PATCH v4 2/2] power: do not skip saving original pstate governor Anatoly Burakov
2021-04-02  9:34       ` Burakov, Anatoly
2021-04-02 11:12         ` Pattan, Reshma
2021-04-06  8:38           ` Thomas Monjalon
2021-04-01 15:06   ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
2021-03-30 14:25 ` [dpdk-dev] [PATCH v2 2/3] power: refactor pstate sysfs handling Anatoly Burakov
2021-03-30 14:25 ` [dpdk-dev] [PATCH v2 3/3] power: do not skip saving original pstate governor Anatoly Burakov
2021-03-30 16:51   ` Burakov, Anatoly

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=26de9fbf-8470-6ee8-58a6-db47e23ec00f@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.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).