Plumb the full request instead of just a "wait" boolean into
__kvm_vcpu_kick() so that it can use kvm_request_needs_ipi() instead of
the flawed kvm_vcpu_should_kick().

No functional change intended.

Signed-off-by: Sean Christopherson <[email protected]>
---
 arch/powerpc/include/asm/kvm_ppc.h |  2 +-
 include/linux/kvm_host.h           |  6 +++---
 virt/kvm/kvm_main.c                | 17 +++++++++--------
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_ppc.h 
b/arch/powerpc/include/asm/kvm_ppc.h
index bbe7378ad0ef..011dc422af78 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -38,7 +38,7 @@
  */
 static inline void kvmppc_vcpu_kick(struct kvm_vcpu *vcpu)
 {
-       __kvm_vcpu_kick(vcpu, false, true);
+       __kvm_vcpu_kick(vcpu, 0, true);
 }
 
 /*
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 9db42f58c561..035b1bdd8c09 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -1570,11 +1570,11 @@ void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu);
 bool kvm_vcpu_wake_up(struct kvm_vcpu *vcpu);
 
 #ifndef CONFIG_S390
-void __kvm_vcpu_kick(struct kvm_vcpu *vcpu, bool wait, bool force);
+void __kvm_vcpu_kick(struct kvm_vcpu *vcpu, int request, bool force);
 
 static inline void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
 {
-       __kvm_vcpu_kick(vcpu, false, false);
+       __kvm_vcpu_kick(vcpu, 0, false);
 }
 #endif
 
@@ -2314,7 +2314,7 @@ static __always_inline void kvm_make_request(int req, 
struct kvm_vcpu *vcpu)
 static inline void kvm_make_request_and_kick(int req, struct kvm_vcpu *vcpu)
 {
        kvm_make_request(req, vcpu);
-       __kvm_vcpu_kick(vcpu, req & KVM_REQUEST_WAIT, false);
+       __kvm_vcpu_kick(vcpu, req, false);
 }
 #endif
 
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e1a9da8b43d7..f1792256576b 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -3913,7 +3913,7 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_vcpu_wake_up);
 /*
  * Kick a sleeping VCPU, or a guest VCPU in guest mode, into host kernel mode.
  */
-void __kvm_vcpu_kick(struct kvm_vcpu *vcpu, bool wait, bool force)
+void __kvm_vcpu_kick(struct kvm_vcpu *vcpu, int req, bool force)
 {
        int me, cpu;
 
@@ -3948,14 +3948,15 @@ void __kvm_vcpu_kick(struct kvm_vcpu *vcpu, bool wait, 
bool force)
                cpu = READ_ONCE(vcpu->cpu);
                if (cpu != me && (unsigned int)cpu < nr_cpu_ids && 
cpu_online(cpu)) {
                        /*
-                        * Use a reschedule IPI to kick the vCPU if the caller
-                        * doesn't need to wait for a response, as KVM allows
-                        * kicking vCPUs while IRQs are disabled, but using the
-                        * SMP function call framework with IRQs disabled can
-                        * deadlock due to taking cross-CPU locks.
+                        * Use a reschedule IPI to kick the vCPU if the request
+                        * doesn't need to wait for a response (or there is no
+                        * request), as KVM allows kicking vCPUs while IRQs are
+                        * disabled, but using the SMP function call framework
+                        * with IRQs disabled can deadlock due to taking cross-
+                        * CPU locks.
                         */
-                       if (wait)
-                               smp_call_function_single(cpu, ack_kick, NULL, 
wait);
+                       if (req & KVM_REQUEST_WAIT)
+                               smp_call_function_single(cpu, ack_kick, NULL, 
true);
                        else
                                smp_send_reschedule(cpu);
                }
-- 
2.56.0.313.g2479322e68-goog


Reply via email to