Plumb in a @force param to __kvm_vcpu_kick() to force an IPI without checking kvm_arch_vcpu_should_kick(). The param will be used to drop kvm_arch_vcpu_should_kick() in favor of kvm_request_needs_ipi() without regressing PPC, which for unknown reasons unconditionally blasts an IPI in a variety of kvm_vcpu_kick() flows.
No functional change intended (nothing yet passes in @force=true). Signed-off-by: Sean Christopherson <[email protected]> --- include/linux/kvm_host.h | 6 +++--- virt/kvm/kvm_main.c | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index e7fc94e2910a..3b9844c3906d 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); +void __kvm_vcpu_kick(struct kvm_vcpu *vcpu, bool wait, bool force); static inline void kvm_vcpu_kick(struct kvm_vcpu *vcpu) { - __kvm_vcpu_kick(vcpu, false); + __kvm_vcpu_kick(vcpu, false, false); } #endif @@ -2315,7 +2315,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); + __kvm_vcpu_kick(vcpu, req & KVM_REQUEST_WAIT, false); } #endif diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index cf4cb586f140..67addb9e48a7 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -3908,7 +3908,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) +void __kvm_vcpu_kick(struct kvm_vcpu *vcpu, bool wait, bool force) { int me, cpu; @@ -3933,9 +3933,13 @@ void __kvm_vcpu_kick(struct kvm_vcpu *vcpu, bool wait) * after kvm_arch_vcpu_should_kick(), which could result in sending an * IPI to the previous pCPU. But, that's ok because the purpose of the * IPI is to force the vCPU to leave IN_GUEST_MODE, and migrating the - * vCPU also requires it to leave IN_GUEST_MODE. + * vCPU also requires it to leave IN_GUEST_MODE + * + * Note #2, do NOT check if an IPI is needed if @force is true, as the + * check also modifies vcpu->mode and KVM PPC needs to avoid that side + * effect for unknown historical reasons. */ - if (kvm_arch_vcpu_should_kick(vcpu)) { + if (force || kvm_arch_vcpu_should_kick(vcpu)) { cpu = READ_ONCE(vcpu->cpu); if (cpu != me && (unsigned int)cpu < nr_cpu_ids && cpu_online(cpu)) { /* -- 2.56.0.313.g2479322e68-goog
