[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e51c6513-3b5d-972c-5d26-d20283057bb8@intel.com>
Date: Tue, 11 Dec 2018 09:20:56 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: Aubrey Li <aubrey.li@...el.com>, tglx@...utronix.de,
mingo@...hat.com, peterz@...radead.org, hpa@...or.com
Cc: ak@...ux.intel.com, tim.c.chen@...ux.intel.com,
arjan@...ux.intel.com, linux-kernel@...r.kernel.org,
Aubrey Li <aubrey.li@...ux.intel.com>
Subject: Re: [PATCH v4 1/2] x86/fpu: track AVX-512 usage of tasks
to update AVX512 state
> + */
> +static inline void update_avx512_state(struct fpu *fpu)
> +{
> + /*
> + * AVX512 state is tracked here because its use is known to slow
> + * the max clock speed of the core.
> + *
> + * However, AVX512-using tasks are expected to clear this state when
> + * not actively using these registers. Thus, this tracking mechanism
> + * can miss. To ensure that false-negatives do not immediately show
> + * up, decay the usage count over time.
> + */
> + if (fpu->state.xsave.header.xfeatures & XFEATURE_MASK_AVX512)
> + fpu->avx512_usage = AVX512_STATE_DECAY_COUNT;
> + else if (fpu->avx512_usage)
> + fpu->avx512_usage--;
> +}
> +
> /*
> * This function is called only during boot time when x86 caps are not set
> * up and alternative can not be used yet.
> @@ -411,6 +432,7 @@ static inline int copy_fpregs_to_fpstate(struct fpu *fpu)
> {
> if (likely(use_xsave())) {
> copy_xregs_to_kernel(&fpu->state.xsave);
> + update_avx512_state(fpu);
> return 1;
> }
Is there a reason we shouldn't do:
if (!cpu_feature_enabled(X86_FEATURE_AVX512F))
update_avx512_state(fpu);
?
Powered by blists - more mailing lists