From patchwork Wed Jan 31 09:35:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10193679 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 23882603EE for ; Wed, 31 Jan 2018 09:40:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02593201BC for ; Wed, 31 Jan 2018 09:40:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EAD7E285FC; Wed, 31 Jan 2018 09:40:10 +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 747E3201BC for ; Wed, 31 Jan 2018 09:40:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753761AbeAaJjI (ORCPT ); Wed, 31 Jan 2018 04:39:08 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:52888 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753770AbeAaJfy (ORCPT ); Wed, 31 Jan 2018 04:35:54 -0500 Received: by mail-wm0-f68.google.com with SMTP id g1so6682338wmg.2 for ; Wed, 31 Jan 2018 01:35:53 -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=DwAszTehtrUbwU5lPqdoDg6Kv9w31M9/4mAbHMnmpBw=; b=GkfpR/v9WQ5grvZEd/fGApfK1GJr1VRKK1T1ANQGycyfVOJnR2y+h5ynK+NhSJJKNF O4LHFF/N0091AVJPAVMe9z+c5GaargmiaJj16ukXkCIf0vnMgmT34NaLee2VuUfF0N0R yVpHvGHw5lDc2kwkx31/10e1kwrzfUoNg3Tmo= 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=DwAszTehtrUbwU5lPqdoDg6Kv9w31M9/4mAbHMnmpBw=; b=b/s2elQtEur/poboRoaa9W6W/S1gPpHMwOuqCKvLMzMcp7iIgN6EuGupZtmsx3dquF N+Ir+rDoGnrv2SihEMVIjDCeIKN+ISa2YTmoHiAVrs8iIFGdv/ftN3jF++K7SFOn7zNs XQgHaIIqV7iWASKp4H0j/KSkiM3vrhdV8XaStzyG1MBXdHX5QwodcmHkuIiYWQeBfU2q dIujq6lb2Qzu3ZzkQoV/mH79a7LNzbupJAUHGmtn6aC1+8uUxiWIrgWCV0yaRoQZG802 tO9irwd5SEcB9FKMFmV2+6xbc35zPOR9TuPJv9i5JEvTaOPrZA02x8pRUfP1hXXaIiXa xO9Q== X-Gm-Message-State: AKwxytdAA08kW/c8ktwUmKAkaHgiuL4c6BZn94lLdTma8T5iewZxDXYX 37cl9TLl5iZENsQcdUc2vWG/wQ== X-Google-Smtp-Source: AH8x224MYnbcwgOyUwVNUJdQTOwV88QXg+mDV7J1sumT0KpXL+tDNZ5DEDq1MWia8XscgkIV2MvWRg== X-Received: by 10.80.150.33 with SMTP id y30mr34588765eda.114.1517391352895; Wed, 31 Jan 2018 01:35:52 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id z2sm10247837edc.50.2018.01.31.01.35.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Jan 2018 01:35:52 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Marc Zyngier , Christoffer Dall Subject: [PULL 28/28] KVM: arm/arm64: Fixup userspace irqchip static key optimization Date: Wed, 31 Jan 2018 10:35:07 +0100 Message-Id: <20180131093507.22219-29-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180131093507.22219-1-christoffer.dall@linaro.org> References: <20180131093507.22219-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. Acked-by: Marc Zyngier Fixes: c44c232ee2d3 ("KVM: arm/arm64: Avoid work when userspace iqchips are not used") Signed-off-by: Christoffer Dall --- 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,