Re: [PATCH v2 1/2] x86/fpu: Add a helper to prepare AMX state for low-power CPU idle

From: Dave Hansen
Date: Wed Mar 09 2022 - 17:46:41 EST


On 3/9/22 14:34, Chang S. Bae wrote:
> +/*
> + * Initialize register state that may prevent from entering low-power idle.
> + * This function will be invoked from the cpuidle driver only when needed.
> + */
> +void fpu_idle_fpregs(void)
> +{
> + if (!fpu_state_size_dynamic())
> + return;

Is this check just an optimization? I'm having trouble imagining a
situation where we would have:

(xfeatures_in_use() & XFEATURE_MASK_XTILE) == true
but
fpu_state_size_dynamic() == false

> + if (xfeatures_in_use() & XFEATURE_MASK_XTILE) {
> + tile_release();
> + fpregs_deactivate(&current->thread.fpu);
> + }
> +}

xfeatures_in_use() isn't exactly expensive either.