lkml.org 
[lkml]   [2018]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4 1/2] x86/fpu: track AVX-512 usage of tasks
From
Date
 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);

?

\
 
 \ /
  Last update: 2018-12-11 18:21    [W:0.094 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site