From: Doug Smythies <dsmythies@telus.net>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <len.brown@intel.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux PM list <linux-pm@vger.kernel.org>,
dsmythies <dsmythies@telus.net>
Subject: Re: [PATCH] cpufreq: intel_pstate: Override parameters if HWP forced by BIOS
Date: Thu, 9 Sep 2021 06:30:23 -0700 [thread overview]
Message-ID: <CAAYoRsVX76Ey9FHhZXdwKWiMdmf0Oi6SKrP2J=XnNgB92sZW1A@mail.gmail.com> (raw)
In-Reply-To: <223a72d91cfda9b13230e4f8cd6a29f853535277.camel@linux.intel.com>
On Wed, Sep 8, 2021 at 11:33 PM Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
>
> On Wed, 2021-09-08 at 20:48 -0700, Doug Smythies wrote:
> > If HWP has been already been enabled by BIOS, it may be
> > necessary to override some kernel command line parameters.
> > Once it has been enabled it requires a reset to be disabled.
> >
> > Signed-off-by: Doug Smythies <dsmythies@telus.net>
> > ---
> > drivers/cpufreq/intel_pstate.c | 22 ++++++++++++++++------
> > 1 file changed, 16 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/cpufreq/intel_pstate.c
> > b/drivers/cpufreq/intel_pstate.c
> > index bb4549959b11..073bae5d4498 100644
> > --- a/drivers/cpufreq/intel_pstate.c
> > +++ b/drivers/cpufreq/intel_pstate.c
> > @@ -3267,7 +3267,7 @@ static int __init intel_pstate_init(void)
> > */
> > if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) ||
> > intel_pstate_hwp_is_enabled()) {
> > - hwp_active++;
> > + hwp_active = 1;
> Why this change?
It was just to keep it at 1, but I agree not absolutely needed.
>
> > hwp_mode_bdw = id->driver_data;
> > intel_pstate.attr = hwp_cpufreq_attrs;
> > intel_cpufreq.attr = hwp_cpufreq_attrs;
> > @@ -3347,17 +3347,27 @@ device_initcall(intel_pstate_init);
> >
> > static int __init intel_pstate_setup(char *str)
> > {
> > + /*
> > + * If BIOS is forcing HWP, then parameter
> > + * overrides might be needed. Only print
> > + * the message once, and regardless of
> > + * any overrides.
> > + */
> > + if(!hwp_active
> This part of code is from early_param, Is it possible that
> hwp_active is not 0?
Not at this point, in any testing I did.
But I do not know the authoritative answer
to your question.
>
> > && boot_cpu_has(X86_FEATURE_HWP))
> > + if(intel_pstate_hwp_is_enabled()){
> > + pr_info("HWP enabled by BIOS\n");
> > + hwp_active = 1;
> > + }
> > if (!str)
> > return -EINVAL;
> >
> > - if (!strcmp(str, "disable"))
> > + if (!strcmp(str, "disable") && !hwp_active)
> > no_load = 1;
> > - else if (!strcmp(str, "active"))
> > + if (!strcmp(str, "active"))
> > default_driver = &intel_pstate;
> > - else if (!strcmp(str, "passive"))
> > + if (!strcmp(str, "passive"))
> > default_driver = &intel_cpufreq;
>
> Why "else if" changed to "if" ?
Because it doesn't matter anyway and I would
have had to figure out another qualifier.
This way, and given that this executes once per
intel_pstate command line parameter, the code
executes the way it used to, overall.
>
>
> Thanks,
> Srinivas
>
> > -
> > - if (!strcmp(str, "no_hwp")) {
> > + if (!strcmp(str, "no_hwp") && !hwp_active) {
> > pr_info("HWP disabled\n");
> > no_hwp = 1;
> > }
>
>
next prev parent reply other threads:[~2021-09-09 14:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-09 3:48 [PATCH] cpufreq: intel_pstate: Override parameters if HWP forced by BIOS Doug Smythies
2021-09-09 6:33 ` Srinivas Pandruvada
2021-09-09 11:18 ` Rafael J. Wysocki
2021-09-09 13:20 ` Doug Smythies
2021-09-09 16:12 ` Rafael J. Wysocki
2021-09-09 17:22 ` Rafael J. Wysocki
2021-09-10 3:14 ` Doug Smythies
2021-09-10 11:18 ` Rafael J. Wysocki
2021-09-10 15:34 ` Doug Smythies
2021-09-10 15:45 ` Rafael J. Wysocki
2021-09-09 13:30 ` Doug Smythies [this message]
2021-09-09 14:52 ` Srinivas Pandruvada
2021-09-10 4:11 ` Doug Smythies
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='CAAYoRsVX76Ey9FHhZXdwKWiMdmf0Oi6SKrP2J=XnNgB92sZW1A@mail.gmail.com' \
--to=dsmythies@telus.net \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=srinivas.pandruvada@linux.intel.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).