KVM: arm/arm64: Fixup userspace irqchip static key optimization

"Linux Kernel Mailing List" <[email protected]> Sat, 10 Feb 2018 22:00:24 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/cd15d2050c044ca9525ba165e9073ac8e036b8d0
Commit:     cd15d2050c044ca9525ba165e9073ac8e036b8d0
Parent:     f1d7231cede93a42d75b6d3c5ca599e94a273e89
Refname:    refs/heads/master
Author:     Christoffer Dall <[email protected]>
AuthorDate: Fri Jan 26 16:20:22 2018 +0100
Committer:  Christoffer Dall <[email protected]>
CommitDate: Wed Jan 31 10:10:49 2018 +0100

    KVM: arm/arm64: Fixup userspace irqchip static key optimization
    
    When I introduced a static key to avoid work in the critical path for
    userspace irqchips which is very rarely used, I accidentally messed up
    my logic and used && where I should have used ||, because the point was
    to short-circuit the evaluation in case userspace irqchips weren't even
    in use.
    
    This fixes an issue when running in-kernel irqchip VMs alongside
    userspace irqchip VMs.
    
    Acked-by: Marc Zyngier <[email protected]>
    Fixes: c44c232ee2d3 ("KVM: arm/arm64: Avoid work when userspace iqchips are not used")
    Signed-off-by: Christoffer Dall <[email protected]>
---
 virt/kvm/arm/arch_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index 63cf828f3c4f..fb6bd9b9845e 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -286,7 +286,7 @@ static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level,
 	trace_kvm_timer_update_irq(vcpu->vcpu_id, timer_ctx->irq.irq,
 				   timer_ctx->irq.level);
 
-	if (!static_branch_unlikely(&userspace_irqchip_in_use) &&
+	if (!static_branch_unlikely(&userspace_irqchip_in_use) ||
 	    likely(irqchip_in_kernel(vcpu->kvm))) {
 		ret = kvm_vgic_inject_irq(vcpu->kvm, vcpu->vcpu_id,
 					  timer_ctx->irq.irq,
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html