Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[linux-2.6-microblaze.git] / arch / x86 / kvm / x86.c
index dc43703..12ea77f 100644 (file)
@@ -56,6 +56,7 @@
 #include <linux/sched/stat.h>
 #include <linux/sched/isolation.h>
 #include <linux/mem_encrypt.h>
+#include <linux/entry-kvm.h>
 
 #include <trace/events/kvm.h>
 
@@ -1625,7 +1626,7 @@ EXPORT_SYMBOL_GPL(kvm_emulate_wrmsr);
 bool kvm_vcpu_exit_request(struct kvm_vcpu *vcpu)
 {
        return vcpu->mode == EXITING_GUEST_MODE || kvm_request_pending(vcpu) ||
-               need_resched() || signal_pending(current);
+               xfer_to_guest_mode_work_pending();
 }
 EXPORT_SYMBOL_GPL(kvm_vcpu_exit_request);
 
@@ -8722,15 +8723,11 @@ static int vcpu_run(struct kvm_vcpu *vcpu)
                        break;
                }
 
-               if (signal_pending(current)) {
-                       r = -EINTR;
-                       vcpu->run->exit_reason = KVM_EXIT_INTR;
-                       ++vcpu->stat.signal_exits;
-                       break;
-               }
-               if (need_resched()) {
+               if (__xfer_to_guest_mode_work_pending()) {
                        srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);
-                       cond_resched();
+                       r = xfer_to_guest_mode_handle_work(vcpu);
+                       if (r)
+                               return r;
                        vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
                }
        }
@@ -9972,7 +9969,7 @@ void kvm_arch_sync_events(struct kvm *kvm)
 int __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, u32 size)
 {
        int i, r;
-       unsigned long hva, uninitialized_var(old_npages);
+       unsigned long hva, old_npages;
        struct kvm_memslots *slots = kvm_memslots(kvm);
        struct kvm_memory_slot *slot;