Re: [patch 13/31] x86/fpu: Move KVMs FPU swapping to FPU core

Paolo Bonzini
2021-10-13T15:05:55Z

On 13/10/21 16:59, Andy Lutomirski wrote:
>>
>> Thinking more about it, #NM only has to be trapped if XCR0 enables
>> a dynamic feature. In other words, the guest value of XFD can be
>> limited to (host_XFD|guest_XFD) & guest_XCR0. This avoids that
>> KVM unnecessarily traps for old guests that use CR0.TS.
>>
> You could simplify this by allocating the state the first time XCR0
> enables the feature in question.
>
> (This is how regular non-virt userspace*should* work too, but it
> looks like I’ve probably been outvoted on that front…)

Good point, you could do that too and do the work on the XCR0 vmexit
instead of #NM.

Paolo