From patchwork Wed Mar 4 10:14:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 45397 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E664C21486 for ; Wed, 4 Mar 2015 10:17:29 +0000 (UTC) Received: by wghb13 with SMTP id b13sf33028056wgh.2 for ; Wed, 04 Mar 2015 02:17:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=MI/jQ8SMWhC/tk/5gb0WOMvoojGuwze6krem9U3BG6A=; b=QDyHCcya7YDfD7AUp/isSg2Jpt4/63Q8wohP0JSo320zGV141uBrKI8AzY/vpxwRN7 /GPgcDiGGpmwUwwrH4Zplhomd7rtRfLGJe4HRLzlvyt8RM7vWJ/TGgZCb5VC6Jd7rJvq Wqw+aBuAel/5N97C8klOOOT2LP+pOc5outhPFtB1Pm8t4Jjk/rZpX4Lzf7OytWdYEtF7 UOH9tCJCcIKqtXyDj8HBLDLG+bOqSBnbF8RPtL/gx2pyjwsAKqpFBfpzB5XBcvVBqBEF I8crv/HQgGYnQRuZ5NWm6kgLKe6bmMW5tNbDXwWrMtr1peqfD/ueGAPCEL/gM3ApR9T0 jHoA== X-Gm-Message-State: ALoCoQmdsInR/DY/Y7yUITspWX8m4S8+tR+otcPSqqUswKZEgMIua31/2doi6Al89XEreNuxX1h6 X-Received: by 10.152.45.7 with SMTP id i7mr522137lam.9.1425464249259; Wed, 04 Mar 2015 02:17:29 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.104 with SMTP id ln8ls144113lac.94.gmail; Wed, 04 Mar 2015 02:17:29 -0800 (PST) X-Received: by 10.152.23.3 with SMTP id i3mr2506393laf.97.1425464249111; Wed, 04 Mar 2015 02:17:29 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id i6si2233939laf.48.2015.03.04.02.17.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Mar 2015 02:17:29 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by lbvp9 with SMTP id p9so20180881lbv.8 for ; Wed, 04 Mar 2015 02:17:29 -0800 (PST) X-Received: by 10.152.30.103 with SMTP id r7mr386248lah.76.1425464249032; Wed, 04 Mar 2015 02:17:29 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.35.133 with SMTP id h5csp1123020lbj; Wed, 4 Mar 2015 02:17:28 -0800 (PST) X-Received: by 10.194.134.68 with SMTP id pi4mr6171295wjb.101.1425464246103; Wed, 04 Mar 2015 02:17:26 -0800 (PST) Received: from mail-we0-f176.google.com (mail-we0-f176.google.com. [74.125.82.176]) by mx.google.com with ESMTPS id g13si7477098wiv.96.2015.03.04.02.17.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Mar 2015 02:17:26 -0800 (PST) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 74.125.82.176 as permitted sender) client-ip=74.125.82.176; Received: by wesw62 with SMTP id w62so45294509wes.9 for ; Wed, 04 Mar 2015 02:17:25 -0800 (PST) X-Received: by 10.194.121.136 with SMTP id lk8mr6004588wjb.49.1425464245804; Wed, 04 Mar 2015 02:17:25 -0800 (PST) Received: from gnx2579.gnb.st.com (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by mx.google.com with ESMTPSA id j7sm6415582wix.4.2015.03.04.02.17.23 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Mar 2015 02:17:24 -0800 (PST) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Cc: andre.przywara@arm.com, linux-kernel@vger.kernel.org, patches@linaro.org, gleb@kernel.org, pbonzini@redhat.com Subject: [PATCH v9 4/5] KVM: arm/arm64: remove coarse grain dist locking at kvm_vgic_sync_hwstate Date: Wed, 4 Mar 2015 11:14:35 +0100 Message-Id: <1425464076-20558-5-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1425464076-20558-1-git-send-email-eric.auger@linaro.org> References: <1425464076-20558-1-git-send-email-eric.auger@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , To prepare for irqfd addition, coarse grain locking is removed at kvm_vgic_sync_hwstate level and finer grain locking is introduced in vgic_process_maintenance only. Signed-off-by: Eric Auger Acked-by: Christoffer Dall --- virt/kvm/arm/vgic.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 0cc6ab6..4e9b6d3 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -1081,6 +1081,7 @@ epilog: static bool vgic_process_maintenance(struct kvm_vcpu *vcpu) { u32 status = vgic_get_interrupt_status(vcpu); + struct vgic_dist *dist = &vcpu->kvm->arch.vgic; bool level_pending = false; kvm_debug("STATUS = %08x\n", status); @@ -1098,6 +1099,7 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu) struct vgic_lr vlr = vgic_get_lr(vcpu, lr); WARN_ON(vgic_irq_is_edge(vcpu, vlr.irq)); + spin_lock(&dist->lock); vgic_irq_clear_queued(vcpu, vlr.irq); WARN_ON(vlr.state & LR_STATE_MASK); vlr.state = 0; @@ -1125,6 +1127,8 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu) vgic_cpu_irq_clear(vcpu, vlr.irq); } + spin_unlock(&dist->lock); + /* * Despite being EOIed, the LR may not have * been marked as empty. @@ -1139,10 +1143,7 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu) return level_pending; } -/* - * Sync back the VGIC state after a guest run. The distributor lock is - * needed so we don't get preempted in the middle of the state processing. - */ +/* Sync back the VGIC state after a guest run */ static void __kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) { struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; @@ -1189,14 +1190,10 @@ void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu) void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) { - struct vgic_dist *dist = &vcpu->kvm->arch.vgic; - if (!irqchip_in_kernel(vcpu->kvm)) return; - spin_lock(&dist->lock); __kvm_vgic_sync_hwstate(vcpu); - spin_unlock(&dist->lock); } int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu)