Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1554063

[RFC 25/55] KVM: arm/arm64: Let vcpu thread modify its own active state

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.unit0.net!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod
From Jintack Lim <jintack@cs.columbia.edu>
Newsgroups linux.kernel
Subject [RFC 25/55] KVM: arm/arm64: Let vcpu thread modify its own active state
Date Mon, 09 Jan 2017 07:30:02 +0100
Message-ID <sXBCW-wl-31@gated-at.bofh.it> (permalink)
References <sXBCV-wl-3@gated-at.bofh.it>
X-Original-To christoffer.dall@linaro.org, marc.zyngier@arm.com, pbonzini@redhat.com, rkrcmar@redhat.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, vladimir.murzin@arm.com, suzuki.poulose@arm.com, mark.rutland@arm.com, james.morse@arm.com, lorenzo.pieralisi@arm.com, kevin.brodsky@arm.com, wcohen@redhat.com, shankerd@codeaurora.org, geoff@infradead.org, andre.przywara@arm.com, eric.auger@redhat.com, anna-maria@linutronix.de, shihwei@cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org
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=z0+E5iGsb4QfhFl6mf5oMN70Y4Pe8e/EJMKhhTRekEc=; b=MN2bCPj8ncEDF0rArjKNsMIu1PXOQ+uQThScLpRoRxkC+OEyCEelTnFP6tgAFY39lA C8VzTFaxwMuWUA9XDPFAWhuu8i5hV/Akw3AQD2nVMcn+ugMwunKKAMvKQHwZ76sSgaFr bVjk19yNvq7ZsPPmfG/xW65AHuOPHzODNDCWYpXYZ1OA0GQxwoauatyNc0CGfC80y+3q p4s+U3RVvchjcn+98UjhgTvciOe8+WKafhTTuSIjhHis8HRv3FA461A9o4V2PxWgsPXH R+DJ6b/PwshX9HvrwfU0oQfWMYPXM0qFH8gWL6W/Rrc1Ky7ptRubBWMwYbf4lSu1lL+B TLjA==
X-Gm-Message-State AIkVDXLhcN++j6FgfvJVS167aADySaIztIF1jBwNlVaAgbTC9tY6PpxnjhZ41zTySniSbov++JLYKEdlVTWwl8euwjSXE3cJ0EP9pWKVDoeOX8yz1U1k2hfWHNaiXQZr75yuz2i7Gb5VNf+20KnlwJ6Q3go=
X-Received by 10.55.197.148 with SMTP id k20mr81528072qkl.34.1483943164538; Sun, 08 Jan 2017 22:26:04 -0800 (PST)
X-Received by 10.55.197.148 with SMTP id k20mr81528068qkl.34.1483943164394; Sun, 08 Jan 2017 22:26:04 -0800 (PST)
X-Mailer git-send-email 1.9.1
X-No-Spam-Score Local
X-Scanned-By MIMEDefang 2.78 on 128.59.72.13
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 36
Organization linux.* mail to news gateway
X-Original-Cc jintack@cs.columbia.edu
X-Original-Date Mon, 9 Jan 2017 01:24:21 -0500
X-Original-Message-ID <1483943091-1364-26-git-send-email-jintack@cs.columbia.edu>
X-Original-References <1483943091-1364-1-git-send-email-jintack@cs.columbia.edu>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1554063

Show key headers only | View raw


Currently, if a vcpu thread tries to change its own active state when
the irq is already in AP list, it'll loop forever. Since the VCPU thread
has already synced back LR state to the struct vgic_irq, let it modify
its own state safely.

Signed-off-by: Jintack Lim <jintack@cs.columbia.edu>
---
 virt/kvm/arm/vgic/vgic-mmio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/arm/vgic/vgic-mmio.c b/virt/kvm/arm/vgic/vgic-mmio.c
index ebe1b9f..049c570 100644
--- a/virt/kvm/arm/vgic/vgic-mmio.c
+++ b/virt/kvm/arm/vgic/vgic-mmio.c
@@ -192,9 +192,9 @@ static void vgic_mmio_change_active(struct kvm_vcpu *vcpu, struct vgic_irq *irq,
 	 * If this virtual IRQ was written into a list register, we
 	 * have to make sure the CPU that runs the VCPU thread has
 	 * synced back LR state to the struct vgic_irq.  We can only
-	 * know this for sure, when either this irq is not assigned to
+	 * know this for sure, when this irq is not assigned to
 	 * anyone's AP list anymore, or the VCPU thread is not
-	 * running on any CPUs.
+	 * running on any CPUs, or current thread is the VCPU thread.
 	 *
 	 * In the opposite case, we know the VCPU thread may be on its
 	 * way back from the guest and still has to sync back this
@@ -202,6 +202,7 @@ static void vgic_mmio_change_active(struct kvm_vcpu *vcpu, struct vgic_irq *irq,
 	 * other thread sync back the IRQ.
 	 */
 	while (irq->vcpu && /* IRQ may have state in an LR somewhere */
+	       irq->vcpu != vcpu && /* Current thread is not the VCPU thread */
 	       irq->vcpu->cpu != -1) /* VCPU thread is running */
 		cond_resched_lock(&irq->irq_lock);
 
-- 
1.9.1

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[RFC 25/55] KVM: arm/arm64: Let vcpu thread modify its own active state Jintack Lim <jintack@cs.columbia.edu> - 2017-01-09 07:30 +0100

csiph-web