From patchwork Tue Jan 30 12:42:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10191779 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B70A760375 for ; Tue, 30 Jan 2018 12:42:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A569020174 for ; Tue, 30 Jan 2018 12:42:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98A4928903; Tue, 30 Jan 2018 12:42:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C35320174 for ; Tue, 30 Jan 2018 12:42:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751897AbeA3MmU (ORCPT ); Tue, 30 Jan 2018 07:42:20 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:39466 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751828AbeA3MmR (ORCPT ); Tue, 30 Jan 2018 07:42:17 -0500 Received: by mail-wm0-f66.google.com with SMTP id b21so831946wme.4 for ; Tue, 30 Jan 2018 04:42:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iWLmSKjWhQcdjCXAyrJNuRrEfofK4iFwwqy5UJmJghY=; b=HyjLDvIaOrhk+ZNpXucbxzv2/wvLVaqd8xtNoMdJejTPEjFwurDnaCAX0F+WIbTm85 5g0jF/zgUrySrWWE3pYNOb1AqEE3LcyioOTSnLv4ouz3ZxjKxA47xVCWLEBz3rWAAzAr vln4/NhPFwLlRIPCYJ25OfPr6GoqFI6PGH+A8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iWLmSKjWhQcdjCXAyrJNuRrEfofK4iFwwqy5UJmJghY=; b=BOpU/rGHxN80oSe/NgktKcDDXKpu+CbQYTltJNij1UA6K5RVky4ewKZY3SYQrkLnvT Yrw4D6SsKY8enEHJbQdqXLelxkoXxEOJWdV17joj30Nv1hP8VGQKkDKqDnceoE5y4cTZ ZURVeYY1ph6nHAc+Iggzni63fJ7QFLBT42mtJoGeKDz97gaEXeX0shxF1X79/LmaFEug 7uX1ftev+7dozyqLDiLe7w8RrwzISUeWJ3VGdPJkL453liHS2F+KsXhHbC5mqcmXR2OC +lswz3JAoKwv2MIDKcp4C42IrWf3D8G/I/3OrdBO//i2GZCwDR7MaHh+sNunglcY1I2W n7WA== X-Gm-Message-State: AKwxytfp3A1XDegQtXR9bbW/eya1ENFTXPeANVItKfnMy8eGswwdrtma UX8Go6usdX3lXQJhsPWnYMZjag== X-Google-Smtp-Source: AH8x224BrcuWadb/Tl5erZpokIdNxkX4bBUWfT6KLDXgkenCxeE6HJP52EoohupQN9HUD619sH2EVw== X-Received: by 10.80.136.15 with SMTP id b15mr50925112edb.64.1517316136308; Tue, 30 Jan 2018 04:42:16 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id z7sm7990225edb.45.2018.01.30.04.42.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 Jan 2018 04:42:15 -0800 (PST) From: Christoffer Dall To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Cc: kvm@vger.kernel.org, Marc Zyngier , Christoffer Dall Subject: [PATCH 3/3] KVM: arm/arm64: Fixup userspace irqchip static key optimization Date: Tue, 30 Jan 2018 13:42:06 +0100 Message-Id: <20180130124206.12262-4-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180130124206.12262-1-christoffer.dall@linaro.org> References: <20180130124206.12262-1-christoffer.dall@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Fixes: c44c232ee2d3 ("KVM: arm/arm64: Avoid work when userspace iqchips are not used") Signed-off-by: Christoffer Dall Acked-by: Marc Zyngier --- 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,