From: Rusty Russell Date: Mon, 30 Jul 2007 06:29:56 +0000 (+1000) Subject: KVM: fx_init() needs preemption disabled while it plays with the FPU state X-Git-Tag: v2.6.24-rc1~1365^2~75 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bd01506ee551689b90ba5822c28ef55207146af;p=linux-2.6 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: Rusty Russell Signed-off-by: Avi Kivity --- diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 7aeaaba79c..5b42731beb 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c @@ -693,10 +693,13 @@ void fx_init(struct kvm_vcpu *vcpu) } *fx_image; + /* Initialize guest FPU by resetting ours and saving into guest's */ + preempt_disable(); fx_save(vcpu->host_fx_image); fpu_init(); fx_save(vcpu->guest_fx_image); fx_restore(vcpu->host_fx_image); + preempt_enable(); fx_image = (struct fx_image_s *)vcpu->guest_fx_image; fx_image->mxcsr = 0x1f80;