• Wanpeng Li's avatar
    KVM: X86: Fix fpu state crash in kvm guest · e7517324
    Wanpeng Li authored
    The idea before commit 240c35a3 (which has just been reverted)
    was that we have the following FPU states:
    
                   userspace (QEMU)             guest
    ---------------------------------------------------------------------------
                   processor                    vcpu->arch.guest_fpu
    >>> KVM_RUN: kvm_load_guest_fpu
                   vcpu->arch.user_fpu          processor
    >>> preempt out
                   vcpu->arch.user_fpu          current->thread.fpu
    >>> preempt in
                   vcpu->arch.user_fpu          processor
    >>> back to userspace
    >>> kvm_put_guest_fpu
                   processor                    vcpu->arch.guest_fpu
    ---------------------------------------------------------------------------
    
    With the new lazy model we want to get the state back to the processor
    when schedule in from current->thread.fpu.
    Reported-by: default avatarThomas Lambertz <mail@thomaslambertz.de>
    Reported-by: default avataranthony <antdev66@gmail.com>
    Tested-by: default avataranthony <antdev66@gmail.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Radim Krčmář <rkrcmar@redhat.com>
    Cc: Thomas Lambertz <mail@thomaslambertz.de>
    Cc: anthony <antdev66@gmail.com>
    Cc: stable@vger.kernel.org
    Fixes: 5f409e20 (x86/fpu: Defer FPU state load until return to userspace)
    Signed-off-by: default avatarWanpeng Li <wanpengli@tencent.com>
    [Add a comment in front of the warning. - Paolo]
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    e7517324
x86.c 259 KB