KVM: Disable pagefaults during copy_from_user_inatomic()
Andrea Arcangeli [Wed, 30 Jan 2008 18:57:35 +0000 (19:57 +0100)]
With CONFIG_PREEMPT=n, this is needed in order to disable the fault-in
code from sleeping.

Signed-off-by: Andrea Arcangeli <andrea@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>

virt/kvm/kvm_main.c

index 7972e3a..cf6df51 100644 (file)
@@ -554,7 +554,9 @@ int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data,
        addr = gfn_to_hva(kvm, gfn);
        if (kvm_is_error_hva(addr))
                return -EFAULT;
+       pagefault_disable();
        r = __copy_from_user_inatomic(data, (void __user *)addr + offset, len);
+       pagefault_enable();
        if (r)
                return -EFAULT;
        return 0;