summaryrefslogtreecommitdiff
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-01-11 12:15:54 +0200
committerAvi Kivity <avi@redhat.com>2011-01-12 12:02:26 +0200
commite5c301428294cb8925667c9ee39f817c4ab1c2c9 (patch)
tree6630b1e95e38287bcda12e40fbbc2d25cf551496 /arch/x86/kvm/x86.c
parent444e863d13373b958ec6b133dcecf140d6c6c2ab (diff)
downloadlinux-3.10-e5c301428294cb8925667c9ee39f817c4ab1c2c9.tar.gz
linux-3.10-e5c301428294cb8925667c9ee39f817c4ab1c2c9.tar.bz2
linux-3.10-e5c301428294cb8925667c9ee39f817c4ab1c2c9.zip
KVM: Initialize fpu state in preemptible context
init_fpu() (which is indirectly called by the fpu switching code) assumes it is in process context. Rather than makeing init_fpu() use an atomic allocation, which can cause a task to be killed, make sure the fpu is already initialized when we enter the run loop. KVM-Stable-Tag. Reported-and-tested-by: Kirill A. Shutemov <kas@openvz.org> Acked-by: Pekka Enberg <penberg@kernel.org> Reviewed-by: Christoph Lameter <cl@linux.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index fa708c9a743..9dda70dffac 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5376,6 +5376,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
int r;
sigset_t sigsaved;
+ if (!tsk_used_math(current) && init_fpu(current))
+ return -ENOMEM;
+
if (vcpu->sigset_active)
sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);