Re: [PATCH 02/19] x86/fpu: Prepare KVM for dynamically enabled states

From: Thomas Gleixner
Date: Mon Dec 13 2021 - 07:00:40 EST


On Mon, Dec 13 2021 at 10:12, Paolo Bonzini wrote:
> On 12/8/21 01:03, Yang Zhong wrote:
>> - user_xfeatures
>>
>> Track which features are currently enabled for the vCPU
>
> Please rename to alloc_xfeatures

That name makes no sense at all. This has nothing to do with alloc.

>> - user_perm
>>
>> Copied from guest_perm of the group leader thread. The first
>> vCPU which does the copy locks the guest_perm
>
> Please rename to perm_xfeatures.

All of that is following the naming conventions in the FPU code related
to permissions etc.

>> - realloc_request
>>
>> KVM sets this field to request dynamically-enabled features
>> which require reallocation of @fpstate
>
> This field should be in vcpu->arch, and there is no need for
> fpu_guest_realloc_fpstate. Rename __xfd_enable_feature to
> fpu_enable_xfd_feature and add it to the public API, then just do
>
> if (unlikely(vcpu->arch.xfd_realloc_request)) {
> u64 request = vcpu->arch.xfd_realloc_request;
> ret = fpu_enable_xfd(request, enter_guest);
> }
>
> to kvm_put_guest_fpu.

Why? Yet another export of FPU internals just because?

Also what clears the reallocation request and what is the @enter_guest
argument supposed to help with?

I have no idea what you are trying to achieve.

Thanks,

tglx