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: <CAFUsyfLte2vkHxe3yt9Srw0RhcANMWK=_cAWrHt2xazM_z5N3w@mail.gmail.com>
Date:   Tue, 26 Oct 2021 18:15:22 -0500
From:   Noah Goldstein <goldstein.w.n@...il.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     tglx@...utronix.de, mingo@...hat.com,
        Borislav Petkov <bp@...en8.de>, X86 ML <x86@...nel.org>,
        hpa@...or.com, Andy Lutomirski <luto@...nel.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/2] x86/fpu: Add helper function for tracking AVX512 status

On Fri, Oct 15, 2021 at 3:57 PM Noah Goldstein <goldstein.w.n@...il.com> wrote:
>
> This commit adds a new helper function 'fpu_update_avx_timestamp' to
> perform the logic from tracking AVX512 feature use.
>
> Signed-off-by: Noah Goldstein <goldstein.w.n@...il.com>
> ---
> Since Borislav Petkov is concerned about adding more macro masks and
> inlining the AVX512 status this patch adds a new helper function. This
> patch does not change the behavior of the current AVX512 status.
>
>  arch/x86/include/asm/fpu/xstate.h |  1 +
>  arch/x86/kernel/fpu/core.c        |  6 ++----
>  arch/x86/kernel/fpu/xstate.c      | 13 +++++++++++++
>  3 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/include/asm/fpu/xstate.h b/arch/x86/include/asm/fpu/xstate.h
> index 109dfcc75299..fe84ac5fb039 100644
> --- a/arch/x86/include/asm/fpu/xstate.h
> +++ b/arch/x86/include/asm/fpu/xstate.h
> @@ -134,6 +134,7 @@ extern u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS];
>  extern void __init update_regset_xstate_info(unsigned int size,
>                                              u64 xstate_mask);
>
> +void fpu_update_avx_timestamp(struct fpu *fpu);
>  void *get_xsave_addr(struct xregs_state *xsave, int xfeature_nr);
>  int xfeature_size(int xfeature_nr);
>  int copy_uabi_from_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf);
> diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
> index 7ada7bd03a32..6dbf3ee642f9 100644
> --- a/arch/x86/kernel/fpu/core.c
> +++ b/arch/x86/kernel/fpu/core.c
> @@ -102,11 +102,9 @@ void save_fpregs_to_fpstate(struct fpu *fpu)
>                 os_xsave(&fpu->state.xsave);
>
>                 /*
> -                * AVX512 state is tracked here because its use is
> -                * known to slow the max clock speed of the core.
> +                * Track of the state of desired avx related xfeatures.
>                  */
> -               if (fpu->state.xsave.header.xfeatures & XFEATURE_MASK_AVX512)
> -                       fpu->avx512_timestamp = jiffies;
> +               fpu_update_avx_timestamp(fpu);
>                 return;
>         }
>
> diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
> index c8def1b7f8fb..00b495914be2 100644
> --- a/arch/x86/kernel/fpu/xstate.c
> +++ b/arch/x86/kernel/fpu/xstate.c
> @@ -1245,6 +1245,19 @@ void xrstors(struct xregs_state *xstate, u64 mask)
>         WARN_ON_ONCE(err);
>  }
>
> +/*
> + * Track of the state of desired avx architecture features.
> + */
> +void fpu_update_avx_timestamp(struct fpu *fpu)
> +{
> +       /*
> +        * AVX512 state is tracked here because its use is known to slow
> +        * the max clock speed of the core.
> +        */
> +       if (fpu->state.xsave.header.xfeatures & XFEATURE_MASK_AVX512)
> +               fpu->avx512_timestamp = jiffies;
> +}
> +
>  #ifdef CONFIG_PROC_PID_ARCH_STATUS
>  /*
>   * Report the amount of time elapsed in millisecond since last AVX512
> --
> 2.25.1
>

Ping.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ