[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z8gTj/9y2ovvN8Z1@intel.com>
Date: Wed, 5 Mar 2025 17:04:15 +0800
From: Chao Gao <chao.gao@...el.com>
To: Dave Hansen <dave.hansen@...el.com>
CC: <tglx@...utronix.de>, <x86@...nel.org>, <seanjc@...gle.com>,
<pbonzini@...hat.com>, <linux-kernel@...r.kernel.org>, <kvm@...r.kernel.org>,
<peterz@...radead.org>, <rick.p.edgecombe@...el.com>, <mlevitsk@...hat.com>,
<weijiang.yang@...el.com>, <john.allen@....com>
Subject: Re: [PATCH v2 5/6] x86/fpu/xstate: Create guest fpstate with guest
specific config
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@...el.com>
>>
>> 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.
Powered by blists - more mailing lists