All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoffer Dall <christoffer.dall@linaro.org>
To: kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org
Cc: Marc Zyngier <marc.zyngier@arm.com>
Subject: [RFC PATCH 7/7] KVM: arm/arm64: Guard kvm_vgic_map_is_active against !vgic_initialized
Date: Sat, 10 Dec 2016 21:47:12 +0100	[thread overview]
Message-ID: <20161210204712.21830-8-christoffer.dall@linaro.org> (raw)
In-Reply-To: <20161210204712.21830-1-christoffer.dall@linaro.org>

If the vgic is not initialized, don't try to grab its spinlocks or
traverse its data structures.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 virt/kvm/arm/vgic/vgic.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
index 67d231d..a53e215 100644
--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
@@ -733,6 +733,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;
+
 	DEBUG_SPINLOCK_BUG_ON(!irqs_disabled());
 
 	spin_lock(&irq->irq_lock);
-- 
2.9.0

WARNING: multiple messages have this Message-ID (diff)
From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 7/7] KVM: arm/arm64: Guard kvm_vgic_map_is_active against !vgic_initialized
Date: Sat, 10 Dec 2016 21:47:12 +0100	[thread overview]
Message-ID: <20161210204712.21830-8-christoffer.dall@linaro.org> (raw)
In-Reply-To: <20161210204712.21830-1-christoffer.dall@linaro.org>

If the vgic is not initialized, don't try to grab its spinlocks or
traverse its data structures.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 virt/kvm/arm/vgic/vgic.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
index 67d231d..a53e215 100644
--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
@@ -733,6 +733,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;
+
 	DEBUG_SPINLOCK_BUG_ON(!irqs_disabled());
 
 	spin_lock(&irq->irq_lock);
-- 
2.9.0

  parent reply	other threads:[~2016-12-10 20:47 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-10 20:47 [RFC PATCH 0/7] KVM: arm/arm64: Optimize arch timer register handling Christoffer Dall
2016-12-10 20:47 ` Christoffer Dall
2016-12-10 20:47 ` [RFC PATCH 1/7] arm64: Use physical counter for in-kernel reads Christoffer Dall
2016-12-10 20:47   ` Christoffer Dall
2017-01-05 18:11   ` Marc Zyngier
2017-01-05 18:11     ` Marc Zyngier
2017-01-06 10:00     ` Christoffer Dall
2017-01-06 10:00       ` Christoffer Dall
2017-01-06 10:38       ` Marc Zyngier
2017-01-06 10:38         ` Marc Zyngier
2017-01-06 10:53         ` Christoffer Dall
2017-01-06 10:53           ` Christoffer Dall
2017-01-06 15:16           ` Marc Zyngier
2017-01-06 15:16             ` Marc Zyngier
2017-01-09 11:29             ` Christoffer Dall
2017-01-09 11:29               ` Christoffer Dall
2016-12-10 20:47 ` [RFC PATCH 2/7] KVM: arm/arm64: Move kvm_vgic_flush_hwstate under disabled irq Christoffer Dall
2016-12-10 20:47   ` Christoffer Dall
2016-12-10 20:47 ` [RFC PATCH 3/7] KVM: arm/arm64: Support calling vgic_update_irq_pending from irq context Christoffer Dall
2016-12-10 20:47   ` Christoffer Dall
2016-12-10 20:47 ` [RFC PATCH 4/7] KVM: arm/arm64: Check that system supports split eoi/deactivate Christoffer Dall
2016-12-10 20:47   ` Christoffer Dall
2017-01-05 17:40   ` Marc Zyngier
2017-01-05 17:40     ` Marc Zyngier
2017-01-06 10:02     ` Christoffer Dall
2017-01-06 10:02       ` Christoffer Dall
2017-01-06 10:24       ` Marc Zyngier
2017-01-06 10:24         ` Marc Zyngier
2017-01-06 10:53         ` Christoffer Dall
2017-01-06 10:53           ` Christoffer Dall
2016-12-10 20:47 ` [RFC PATCH 5/7] KVM: arm/arm64: Move timer save/restore out of hyp code where possible Christoffer Dall
2016-12-10 20:47   ` Christoffer Dall
2016-12-10 20:47 ` [RFC PATCH 6/7] KVM: arm/arm64: Remove unnecessary timer BUG_ON operations Christoffer Dall
2016-12-10 20:47   ` Christoffer Dall
2016-12-10 20:47 ` Christoffer Dall [this message]
2016-12-10 20:47   ` [RFC PATCH 7/7] KVM: arm/arm64: Guard kvm_vgic_map_is_active against !vgic_initialized Christoffer Dall
2017-01-06 10:01 ` [RFC PATCH 0/7] KVM: arm/arm64: Optimize arch timer register handling Christoffer Dall
2017-01-06 10:01   ` Christoffer Dall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161210204712.21830-8-christoffer.dall@linaro.org \
    --to=christoffer.dall@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.