From patchwork Mon Jan 19 16:43:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 43328 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1D52A2034D for ; Mon, 19 Jan 2015 16:45:36 +0000 (UTC) Received: by mail-we0-f200.google.com with SMTP id u56sf17445165wes.3 for ; Mon, 19 Jan 2015 08:45:35 -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=cIFPn0l+jXHieaYj7bcj3kJYl2PsGyZgiRMWWdAj1T0=; b=fmLoKSw2PTB3bxu6zA11oG8AzxGTsDlp1zDIbwKsT1344tMIejl4ZR61MkFB5H/cib lse4i7Bh2F7M1+/GNhh0h8+w8MsUNHC0zdm09+heaY/bpmyZG/ESFQu7CS1O/L0HbS+c gc3bDdlMntjNCmRlmJ+d28B1ddnM3vXXZCKIQzWQLk4G1Q1ClON9vfTlpLYW6FKR3aeF N8P5fc0bqYPbRJq29dgRYSLjgmmsXFRiNJaeFCnJJfPHoZikdzSFXXO6V2GTw0KvSMAW CD00r/wjLFfK8ChUk0mRAbrng4hyny6Bjdbf6lASRD+bUQddSlSwn2Vml/eUZkBzCckS 62RQ== X-Gm-Message-State: ALoCoQku3qdtjeI3l8MylO0M2dgXtdxom/OqUu/amhkYvKN2E8h6fpu5xU6F6y5QBncOPaN9rkL3 X-Received: by 10.180.228.38 with SMTP id sf6mr2197046wic.5.1421685935422; Mon, 19 Jan 2015 08:45:35 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.9 with SMTP id t9ls449574laz.107.gmail; Mon, 19 Jan 2015 08:45:35 -0800 (PST) X-Received: by 10.112.180.135 with SMTP id do7mr32215765lbc.23.1421685935265; Mon, 19 Jan 2015 08:45:35 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id ay3si12542635lbc.17.2015.01.19.08.45.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Jan 2015 08:45:34 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id pn19so29738816lab.9 for ; Mon, 19 Jan 2015 08:45:34 -0800 (PST) X-Received: by 10.152.43.103 with SMTP id v7mr32818671lal.29.1421685934832; Mon, 19 Jan 2015 08:45:34 -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.9.200 with SMTP id c8csp1148347lbb; Mon, 19 Jan 2015 08:45:34 -0800 (PST) X-Received: by 10.52.66.200 with SMTP id h8mr12382649vdt.97.1421685933335; Mon, 19 Jan 2015 08:45:33 -0800 (PST) Received: from mail-we0-f172.google.com (mail-we0-f172.google.com. [74.125.82.172]) by mx.google.com with ESMTPS id n8si22738389wiz.43.2015.01.19.08.45.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Jan 2015 08:45:33 -0800 (PST) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 74.125.82.172 as permitted sender) client-ip=74.125.82.172; Received: by mail-we0-f172.google.com with SMTP id k11so32418416wes.3 for ; Mon, 19 Jan 2015 08:45:32 -0800 (PST) X-Received: by 10.194.184.140 with SMTP id eu12mr3559722wjc.25.1421685932715; Mon, 19 Jan 2015 08:45:32 -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 dp8sm14812495wib.20.2015.01.19.08.45.30 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Jan 2015 08:45:31 -0800 (PST) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, andre.przywara@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, gleb@kernel.org, pbonzini@redhat.com Cc: linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH v8 4/5] KVM: arm/arm64: remove coarse grain dist locking at kvm_vgic_sync_hwstate Date: Mon, 19 Jan 2015 17:43:12 +0100 Message-Id: <1421685793-3547-5-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1421685793-3547-1-git-send-email-eric.auger@linaro.org> References: <1421685793-3547-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.215.50 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 c84f53df..18060ea 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -1447,6 +1447,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); @@ -1464,6 +1465,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; @@ -1491,6 +1493,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. @@ -1505,10 +1509,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; @@ -1555,14 +1556,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)