On Tue, Mar 04, 2025 at 03:02:04PM -0800, Dave Hansen wrote: >On 11/26/24 02:17, Chao Gao wrote: >> From: Yang Weijiang <weijiang.yang@xxxxxxxxx> >> >> Use fpu_guest_cfg to calculate guest fpstate settings, open code for >> __fpstate_reset() to avoid using kernel FPU config. >> >> Below configuration steps are currently enforced to get guest fpstate: >> 1) Kernel sets up guest FPU settings in fpu__init_system_xstate(). >> 2) User space sets vCPU thread group xstate permits via arch_prctl(). >> 3) User space creates guest fpstate via __fpu_alloc_init_guest_fpstate() >> for vcpu thread. >> 4) User space enables guest dynamic xfeatures and re-allocate guest >> fpstate. >> >> By adding kernel dynamic xfeatures in above #1 and #2, guest xstate area >> size is expanded to hold (fpu_kernel_cfg.default_features | kernel dynamic >> xfeatures | user dynamic xfeatures), then host xsaves/xrstors can operate >> for all guest xfeatures. > >These changelogs have a lot of content, but they're honestly not helping >my along here very much. Will revise the changelog. [...] >> +bool fpu_alloc_guest_fpstate(struct fpu_guest *gfpu) >> +{ >> + if (!__fpu_alloc_init_guest_fpstate(gfpu)) >> + return false; >> >> /* >> * KVM sets the FP+SSE bits in the XSAVE header when copying FPU state > >This series is starting to look backward to me. > >The normal way you do these things is that you introduce new >abstractions and refactor the code. Then you go adding features. > >For instance, this series should spend a few patches introducing >'fpu_guest_cfg' and using it before ever introducing the concept of a >dynamic xfeature. This suggestion makes sense to me. Will do.