Commit 9bd01506 authored by Rusty Russell's avatar Rusty Russell Committed by Avi Kivity

KVM: fx_init() needs preemption disabled while it plays with the FPU state

Now that kvm generally runs with preemption enabled, we need to protect
the fpu intialization sequence.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent 11ec2804
...@@ -693,10 +693,13 @@ void fx_init(struct kvm_vcpu *vcpu) ...@@ -693,10 +693,13 @@ void fx_init(struct kvm_vcpu *vcpu)
} *fx_image; } *fx_image;
/* Initialize guest FPU by resetting ours and saving into guest's */
preempt_disable();
fx_save(vcpu->host_fx_image); fx_save(vcpu->host_fx_image);
fpu_init(); fpu_init();
fx_save(vcpu->guest_fx_image); fx_save(vcpu->guest_fx_image);
fx_restore(vcpu->host_fx_image); fx_restore(vcpu->host_fx_image);
preempt_enable();
fx_image = (struct fx_image_s *)vcpu->guest_fx_image; fx_image = (struct fx_image_s *)vcpu->guest_fx_image;
fx_image->mxcsr = 0x1f80; fx_image->mxcsr = 0x1f80;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment