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

Paolo Bonzini
2021-12-13T09:12:29Z

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

> - 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.

> - 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.

Paolo