lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 9 Sep 2021 06:20:45 -0700
From:   Doug Smythies <dsmythies@...us.net>
To:     "Rafael J. Wysocki" <rafael@...nel.org>
Cc:     Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
        Len Brown <len.brown@...el.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        dsmythies <dsmythies@...us.net>
Subject: Re: [PATCH] cpufreq: intel_pstate: Override parameters if HWP forced
 by BIOS

On Thu, Sep 9, 2021 at 4:18 AM Rafael J. Wysocki <rafael@...nel.org> wrote:
>
> On Thu, Sep 9, 2021 at 8:52 AM Srinivas Pandruvada
> <srinivas.pandruvada@...ux.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@...us.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?
>
> I think hwp_active can be changed to bool and then it would make sense
> to update this line.
>
> > >                         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?
>
> Well, it wouldn't matter even if it were nonzero.  This check is just
> pointless anyway.
>
> > > && boot_cpu_has(X86_FEATURE_HWP))
> > > +               if(intel_pstate_hwp_is_enabled()){
>
> This should be
>
> if (boot_cpu_has(X86_FEATURE_HWP) && intel_pstate_hwp_is_enabled()) {

Disagree.
This routine gets executed once per intel_pstate related grub command
line entry. The purpose of the "if(!hwp_active" part is to prevent the
printing of the message to the logs multiple times.

>
> > > +                       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" ?
> >
> > > -
> > > -       if (!strcmp(str, "no_hwp")) {
> > > +       if (!strcmp(str, "no_hwp") && !hwp_active) {
> > >                 pr_info("HWP disabled\n");
> > >                 no_hwp = 1;
> > >         }
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ