linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Prashanth Prakash <pprakash@codeaurora.org>,
	Xiongfeng Wang <wangxiongfeng2@huawei.com>,
	"4 . 20+" <stable@vger.kernel.org>
Subject: Re: [PATCH 2/2] cpufreq: intel_pstate: Also use cppc nominal_perf for base_frequency
Date: Mon, 25 Mar 2019 13:04:41 +0100	[thread overview]
Message-ID: <CAJZ5v0ii-Q_w-6gPaz75+=7hKoZSv50gdCDk78DyA1BCwQ+jyA@mail.gmail.com> (raw)
In-Reply-To: <20190322224520.6740-3-srinivas.pandruvada@linux.intel.com>

On Fri, Mar 22, 2019 at 11:45 PM Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
>
> ACPI specifications stat that if the "Guaranteed Performance Register" is
> not implemented, OSPM assumes guaranteed performance is always equal to
> nominal performance. So for invalid and unimplemented guaranteed
> performance register, use nominal performance as guaranteed performance.
>
> This change will fallback to nominal_perf when guranteed_perf is invalid.
> If nominal_perf is also invalid, then fallback to existing implementation,
> which is to read from HWP Capabilities MSR.
>
> Fixes: 86d333a8cc7f ("cpufreq: intel_pstate: Add base_frequency attribute")
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: 4.20+ <stable@vger.kernel.org> # 4.20+
> ---
>  drivers/cpufreq/intel_pstate.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 7b4b0a7ac68b..e16dea241c55 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -385,6 +385,9 @@ static int intel_pstate_get_cppc_guranteed(int cpu)
>         if (ret)
>                 return ret;
>
> +       if (!cppc_perf.guaranteed_perf)
> +               return cppc_perf.nominal_perf;
> +
>         return cppc_perf.guaranteed_perf;
>  }

I would do this the other way around, that is

if (cppc_perf.guaranteed_perf)
        return cppc_perf.guaranteed_perf;

return cppc_perf.nominal_perf;

That is slightly easier to follow IMO.

      reply	other threads:[~2019-03-25 12:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-22 22:45 [PATCH 0/2] Correct the processing for base_frequency Srinivas Pandruvada
2019-03-22 22:45 ` [PATCH 1/2] ACPI / CPPC: Fix processing for guaranteed performance Srinivas Pandruvada
2019-03-25 11:49   ` Rafael J. Wysocki
2019-03-22 22:45 ` [PATCH 2/2] cpufreq: intel_pstate: Also use cppc nominal_perf for base_frequency Srinivas Pandruvada
2019-03-25 12:04   ` Rafael J. Wysocki [this message]

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='CAJZ5v0ii-Q_w-6gPaz75+=7hKoZSv50gdCDk78DyA1BCwQ+jyA@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pprakash@codeaurora.org \
    --cc=rjw@rjwysocki.net \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=stable@vger.kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=wangxiongfeng2@huawei.com \
    /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).