Re: [PATCH v2 3/6] x86/fpu/xstate: Introduce XFEATURE_MASK_KERNEL_DYNAMIC xfeature set
From: Chao Gao
Date: Wed Mar 05 2025 - 03:44:24 EST
On Tue, Mar 04, 2025 at 02:37:00PM -0800, Dave Hansen wrote:
>Subjects should ideally be written without large identifiers:
>
> Subject: x86/fpu/xstate: Introduce dynamic kernel features
will do.
>
>On 11/26/24 02:17, Chao Gao wrote:
>> Remove the kernel dynamic feature from fpu_kernel_cfg.default_features
>> so that the bits in xstate_bv and xcomp_bv are cleared and xsaves/xrstors
>> can be optimized by HW for normal fpstate.
>
>I'm really confused why this changelog hunk is here.
>
>Right now, all kernel XSAVE buffers have the same supervisor xfeatures.
>This introduces the idea that they can have different xfeature sets.
>
>The _purpose_ of this is to save space when only some FPUs need a given
>feature. This saves space in 'struct fpu'. It probably doesn't actually
>make XSAVE/XRSTOR any faster because the init optimization is very
>likely to be in place for these features.
Thanks for the detailed explanation. You're absolutely right—this change
aims to reduce the size of struct fpu. I see now that implying a perf
improvement for XSAVE/XRSTOR was misleading, as the underlying optimization
is likely handled by the init optimization. I'll revise the changelog to
clarify this and incorporate your wording to avoid confusion.
>
>I'm not sure what point the changelog was trying to make about xstate_bv
>and xcomp_bv. xstate_bv[12] would have been 0 if the feature was in its
>init state.