Message ID | 20170717142718.13853-4-cdall@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org> 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 4B75E60386 for <patchwork-linux-arm@patchwork.kernel.org>; Mon, 17 Jul 2017 14:27:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BEDF28509 for <patchwork-linux-arm@patchwork.kernel.org>; Mon, 17 Jul 2017 14:27:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30D292851D; Mon, 17 Jul 2017 14:27:54 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID 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 A253B2851E for <patchwork-linux-arm@patchwork.kernel.org>; Mon, 17 Jul 2017 14:27:53 +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=mvqAuWoBtulvp27/+UaqU/COMn/3Az0rVVW+w82nP/U=; b=SoaE1reebN9J6lyUO11vgNeoy/ K7Rkb/zw4Je4RUpN8zEV2uI2qcP3ylOsJGGBrqBDFpqRAv/iGMRn8oUO7+3CIiaGSrgnIfnftI4TH auO0N7WLNDRHmemdxyZrlddXn/1CfbfJM8sRSw7FxhVoiTdnV+l9yaak9/PyLYgxPTV636MMdJUGd g+uYrRnwl9V9s1ttKE/G1rt8IeqX+eb/kn3+BFuH4iaeHo2mulvg5VVYZ4OrmFh3tJjv5gHrmWNf0 FwhX8eRSumAlQa6xVJ5k/4Y3GVngACGl+zxLZFplcZvYMtll0te/eMKts8kNLcc25y3jq6NVVpGey v0e076Wg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dX700-0001Nh-BQ; Mon, 17 Jul 2017 14:27:48 +0000 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dX6zw-0001Kq-Gw for linux-arm-kernel@lists.infradead.org; Mon, 17 Jul 2017 14:27:47 +0000 Received: by mail-wm0-x22d.google.com with SMTP id w126so77794139wme.0 for <linux-arm-kernel@lists.infradead.org>; Mon, 17 Jul 2017 07:27:29 -0700 (PDT) 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=5qNGftkjXx1lxoy9zQYVzPUA6cx2fHn2jZmgDxhBgEw=; b=EAkutlriR4Qt7sOT2yHs4D368UTdvhoZrmx2WXdYnhrOVNhdx+gtngXZaTLIzMApG+ BrphMwT/uRS2rnp64uVVLTHkyB85V982AUsKTY9YNGnsNZyRYVeQZJwkmb6thIDx2bdL CHj73qDqQ1wUVW01GF673IcQcDfsBMmujOn3s= 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=5qNGftkjXx1lxoy9zQYVzPUA6cx2fHn2jZmgDxhBgEw=; b=lLzNNjRZptBJ5ju+5JwW3dTO/6PABTgJ0lKv2Al71cX6NDygSLgvg95/hSI/Vc6bRi nh11wOomMOOAJCByBMVOd8+1Rk5yYpKgAXRr9sG2NOxqW/73GKgd6I6WpfSw5BcDS51y jqUw07EWj+A6MxglRLViIepokcReOSCr0XIarfPoIh2K52pbAhhTIvOO3ZvPBCnj9BNu SYTuXrY/7F4XdpdXMV0Aill0rKPQnD2JZnLxiSSyhYpROJE8Slj3JfYduMXcA4wlLGpj DlrkxphLSZbqW1tCka74p1gj6viFUckk4eFIA6NRlPJm78037kcIRjgjyYE+33DLE42D xKzg== X-Gm-Message-State: AIVw113ZauFDpodaMMnbsCGLJgPT1RGX/RGwno2rhJAxY1IH//C3JRAc 7jK8cCsc74QZbyEJmr4dhA== X-Received: by 10.80.138.34 with SMTP id i31mr17587640edi.119.1500301647572; Mon, 17 Jul 2017 07:27:27 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id b30sm9428952edd.6.2017.07.17.07.27.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jul 2017 07:27:26 -0700 (PDT) From: Christoffer Dall <cdall@linaro.org> To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH v2 03/19] KVM: arm/arm64: Guard kvm_vgic_map_is_active against !vgic_initialized Date: Mon, 17 Jul 2017 16:27:02 +0200 Message-Id: <20170717142718.13853-4-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170717142718.13853-1-cdall@linaro.org> References: <20170717142718.13853-1-cdall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170717_072745_669625_A12B5F52 X-CRM114-Status: GOOD ( 10.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Cc: Marc Zyngier <marc.zyngier@arm.com>, Christoffer Dall <cdall@linaro.org>, kvm@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c index fed717e..e1f7dbc 100644 --- a/virt/kvm/arm/vgic/vgic.c +++ b/virt/kvm/arm/vgic/vgic.c @@ -777,6 +777,9 @@ bool kvm_vgic_map_is_active(struct kvm_vcpu *vcpu, unsigned int virt_irq) struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, virt_irq); bool map_is_active; + if (!vgic_initialized(vcpu->kvm)) + return false; + spin_lock(&irq->irq_lock); map_is_active = irq->hw && irq->active; spin_unlock(&irq->irq_lock);
If the vgic is not initialized, don't try to grab its spinlocks or traverse its data structures. This is important because we soon have to start considering the active state of a virtual interrupts when doing vcpu_load, which may happen early on before the vgic is initialized. Signed-off-by: Christoffer Dall <cdall@linaro.org> --- virt/kvm/arm/vgic/vgic.c | 3 +++ 1 file changed, 3 insertions(+)