Re: [PATCH v10 05/28] x86/fpu/xstate: Add a new variable to indicate dynamic user states

From: Thomas Gleixner
Date: Fri Oct 01 2021 - 09:16:49 EST


On Wed, Aug 25 2021 at 08:53, Chang S. Bae wrote:
> +/*
> + * This represents user xstates, a subset of xfeatures_mask_all, saved in a
> + * dynamic kernel XSAVE buffer.
> + */
> +u64 xfeatures_mask_user_dynamic __ro_after_init;
> +
> static unsigned int xstate_offsets[XFEATURE_MAX] __ro_after_init =
> { [ 0 ... XFEATURE_MAX - 1] = -1};
> static unsigned int xstate_sizes[XFEATURE_MAX] __ro_after_init =
> @@ -709,6 +715,7 @@ static int __init init_xstate_size(void)
> static void fpu__init_disable_system_xstate(void)
> {
> xfeatures_mask_all = 0;
> + xfeatures_mask_user_dynamic = 0;

It's zero at boot already, isn't it?

> cr4_clear_bits(X86_CR4_OSXSAVE);
> setup_clear_cpu_cap(X86_FEATURE_XSAVE);
> }
> @@ -780,6 +787,8 @@ void __init fpu__init_system_xstate(void)
>
> /* Store it for paranoia check at the end */
> xfeatures = xfeatures_mask_all;
> + /* Do not support the dynamically allocated buffer yet. */
> + xfeatures_mask_user_dynamic = 0;
>
> /* Enable xstate instructions to be able to continue with initialization: */
> fpu__init_cpu_xstate();