aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2016-12-17 12:43:52 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2016-12-19 09:45:14 -0500
commit931f261b42f10c8c8c9ab53f5ceb47ce51af7cf5 (patch)
tree1c9dd7e4ee202ecb6d7aef52c4e25c8d2a0c3f76
parent3f5ad8be3713572f3946b69eb376206153d0ea2d (diff)
kvm: fix schedule in atomic in kvm_steal_time_set_preempted()
kvm_steal_time_set_preempted() isn't disabling the pagefaults before calling __copy_to_user and the kernel debug notices. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/x86/kvm/x86.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 49da1064ef50..8ce1139a08b5 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2844,7 +2844,17 @@ static void kvm_steal_time_set_preempted(struct kvm_vcpu *vcpu)
2844 2844
2845void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) 2845void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
2846{ 2846{
2847 /*
2848 * Disable page faults because we're in atomic context here.
2849 * kvm_write_guest_offset_cached() would call might_fault()
2850 * that relies on pagefault_disable() to tell if there's a
2851 * bug. NOTE: the write to guest memory may not go through if
2852 * during postcopy live migration or if there's heavy guest
2853 * paging.
2854 */
2855 pagefault_disable();
2847 kvm_steal_time_set_preempted(vcpu); 2856 kvm_steal_time_set_preempted(vcpu);
2857 pagefault_enable();
2848 kvm_x86_ops->vcpu_put(vcpu); 2858 kvm_x86_ops->vcpu_put(vcpu);
2849 kvm_put_guest_fpu(vcpu); 2859 kvm_put_guest_fpu(vcpu);
2850 vcpu->arch.last_host_tsc = rdtsc(); 2860 vcpu->arch.last_host_tsc = rdtsc();