We can do that, but I'm unhappy about this conditional in schedule(). So
I was asking for doing a simple KVM only solution first:
vcpu_run()
kvm_load_guest_fpu()
wrmsrl(XFD, guest_fpstate->xfd);
XRSTORS
do {
local_irq_disable();
if (test_thread_flag(TIF_NEED_FPU_LOAD))
switch_fpu_return()
wrmsrl(XFD, guest_fpstate->xfd);
do {
vmenter(); // Guest modifies XFD
} while (reenter);
update_xfd_state(); // Restore consistency
local_irq_enable();
and check how bad that is for KVM in terms of overhead on AMX systems.
local_irq_enable(); <- Problem starts here
preempt_enable(); <- Becomes wider here