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]
Message-ID: <53bce76c5c60463eba1372df426a64b9@amazon.co.uk>
Date:   Tue, 5 Dec 2023 09:00:57 +0000
From:   "Durrant, Paul" <pdurrant@...zon.co.uk>
To:     Dave Hansen <dave.hansen@...el.com>,
        "Allister, Jack" <jalliste@...zon.co.uk>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "bp@...en8.de" <bp@...en8.de>,
        "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
        "hpa@...or.com" <hpa@...or.com>,
        "rafael@...nel.org" <rafael@...nel.org>,
        "len.brown@...el.com" <len.brown@...el.com>
CC:     "Wang, Jue" <juew@...zon.com>,
        Usama Arif <usama.arif@...edance.com>,
        "x86@...nel.org" <x86@...nel.org>,
        Hans de Goede <hdegoede@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] x86: intel_epb: Add earlyparam option to keep bias at performance

> -----Original Message-----
> From: Dave Hansen <dave.hansen@...el.com>
> Sent: 04 December 2023 17:45
> To: Allister, Jack <jalliste@...zon.co.uk>; tglx@...utronix.de;
> mingo@...hat.com; bp@...en8.de; dave.hansen@...ux.intel.com;
> hpa@...or.com; rafael@...nel.org; len.brown@...el.com
> Cc: Durrant, Paul <pdurrant@...zon.co.uk>; Wang, Jue <juew@...zon.com>;
> Usama Arif <usama.arif@...edance.com>; x86@...nel.org; Hans de Goede
> <hdegoede@...hat.com>; Peter Zijlstra <peterz@...radead.org>; Rafael J.
> Wysocki <rafael.j.wysocki@...el.com>; linux-kernel@...r.kernel.org
> Subject: RE: [EXTERNAL] [PATCH] x86: intel_epb: Add earlyparam option to
> keep bias at performance
> 
> CAUTION: This email originated from outside of the organization. Do not
> click links or open attachments unless you can confirm the sender and know
> the content is safe.
> 
> 
> 
> On 12/4/23 09:28, Jack Allister wrote:
> > There are certain scenarios where it may be intentional that the EPB was
> > set at to 0/ENERGY_PERF_BIAS_PERFORMANCE on kernel boot. For example, in
> > data centers a kexec/live-update of the kernel may be performed
> regularly.
> >
> > Usually this live-update is time critical and defaulting of the bias
> back
> > to ENERGY_PERF_BIAS_NORMAL may actually be detrimental to the overall
> > update time if processors' time to ramp up/boost are affected.
> >
> > This patch introduces a kernel command line "intel_epb_keep_performance"
> > which will leave the EPB at performance if during the restoration code
> path
> > it is detected as such.
> 
> Folks, while I appreciate the effort to upstream thing that you have
> kept out of tree up until now, I don't think this is the right way.
> 
> In general new kernel command-line options are a last resort.
> 
> > diff --git a/arch/x86/kernel/cpu/intel_epb.c
> b/arch/x86/kernel/cpu/intel_epb.c
> > index e4c3ba91321c..0c7dd092f723 100644
> > --- a/arch/x86/kernel/cpu/intel_epb.c
> > +++ b/arch/x86/kernel/cpu/intel_epb.c
> > @@ -50,7 +50,8 @@
> >   * the OS will do that anyway.  That sometimes is problematic, as it
> may cause
> >   * the system battery to drain too fast, for example, so it is better
> to adjust
> >   * it on CPU bring-up and if the initial EPB value for a given CPU is
> 0, the
> > - * kernel changes it to 6 ('normal').
> > + * kernel changes it to 6 ('normal'). This however is overridable via
> > + * intel_epb_keep_performance if required.
> >   */
> >
> >  static DEFINE_PER_CPU(u8, saved_epb);
> > @@ -75,6 +76,8 @@ static u8 energ_perf_values[] = {
> >       [EPB_INDEX_POWERSAVE] = ENERGY_PERF_BIAS_POWERSAVE,
> >  };
> >
> > +static bool intel_epb_keep_performance __read_mostly;
> > +
> >  static int intel_epb_save(void)
> >  {
> >       u64 epb;
> > @@ -107,8 +110,12 @@ static void intel_epb_restore(void)
> >                */
> >               val = epb & EPB_MASK;
> >               if (val == ENERGY_PERF_BIAS_PERFORMANCE) {
> > -                     val = energ_perf_values[EPB_INDEX_NORMAL];
> > -                     pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal',
> was 'performance'\n");
> > +                     if (!intel_epb_keep_performance) {
> > +                             val = energ_perf_values[EPB_INDEX_NORMAL];
> > +                             pr_warn_once("ENERGY_PERF_BIAS: Set to
> 'normal', was 'performance'\n");
> > +                     } else {
> > +                             pr_warn_once("ENERGY_PERF_BIAS: Kept at
> 'performance', no change\n");
> > +                     }
> >               }
> 
> This is fundamentally a hack.
> 

Actually, it's working round a hack. The existing coment in the code just above that hunk is:

101                /*                                                                                                             
102                 * Because intel_epb_save() has not run for the current CPU yet,                                               
103                 * it is going online for the first time, so if its EPB value is                                               
104                 * 0 ('performance') at this point, assume that it has not been                                                
105                 * initialized by the platform firmware and set it to 6                                                        
106                 * ('normal').                                                                                                 
107                 */

> It sounds like you want the system default to be at
> ENERGY_PERF_BIAS_PERFORMANCE.  You also mentioned that this was done "on
> kernel boot".  How did you do that, exactly?  Shouldn't that "on kernel
> boot" action be reflected over here rather than introducing another
> command-line parameter?
> 

The problem is that this will take effect even on a kexec and hence it is throttling
a system that set ENERGY_PERF_BIAS_PERFORMANCE prior to the kexec.  We use kexec to
live update the host kernel of our systems whilst leaving virtual machines running.
This resetting of the perf bias is having a very detrimental effect on the downtime
of our systems across the live update - about a 7 fold increase.

  Paul

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ