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: 10191785 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 E342760375 for ; Tue, 30 Jan 2018 12:42:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D40FE20174 for ; Tue, 30 Jan 2018 12:42:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C804022701; Tue, 30 Jan 2018 12:42:49 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5EE5F20174 for ; Tue, 30 Jan 2018 12:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=lPEKYlOF6voYgJFYYXI3vctuPpF/KM96Rf4PxGhcZMQ=; b=ia9812NnMHlGyBu0I4RD76uh4b P3YvaVsqUIfRfx23RZUU2F9iu4sTvIoo6av+UXe4zEf2/mDx27NycFJclq5Zi4rJuDqKRhOJV9rit MZennCD6+btocBPAq7d0mEXMYcAxve4amToPmUMrRg4gnQhC4XJhL1IN1uYf8fWHvk10T7kMsCnSn 4EhSMzBzOCkemE9l9mvnYPcUlPP84xCgGRLB5dgsYPj85CM4L7XsX7wvVKz/4x9Ur/2nVINTaY0di E1oz8IDGoZJtLMkBewzmhJlBjL5HQLqCQZ78f7224X/lUePvyM/Az08msDb27CxpdRv2K1Pv99D+K MrdOfctw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1egVFP-0007aw-AB; Tue, 30 Jan 2018 12:42:47 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1egVF3-0007GT-DN for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2018 12:42:29 +0000 Received: by mail-wm0-x244.google.com with SMTP id f3so867463wmc.1 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=Pv2kz2MVdUHi3XgjXRcttDKylJqTx9leqgS2A1MZgj74/19Rjpv9lVknTXkaiC0/ni /m8sxtbnAtQl7skVf4MkryRZz49OSTsIp9Ibs32z/UTE4nDFA4/nSl0pac7HmKe+/Z0J uXt7E9aL+GtM7hnwAWO5P7pzM3zq7ZaMugsm/r68ABCKkwNCXV3cwuuJTBCP233DsbUQ Bed2gL6BjYfRn6pfjUyFDGHj4qAyL1j0okWIMEGFex15f7OhXDIxkaz3raghbSuwG0Op PkJ89/38XDUqhivnEpEQ3qA21P7rT2qL7pb7FpaZdk3Tm4Mey+AzCELinM2CltY2kI/N 57Bw== X-Gm-Message-State: AKwxytd6TXRUZtz0iZgD5uGzIoXcdO6c3/nV/MZa8UqD7B6RDn3ua4OZ ySw9F8Qceur4FEKBldmeeAvX5hLXTJw= 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 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> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Christoffer Dall , kvm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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,