From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933770AbdKGVG2 (ORCPT ); Tue, 7 Nov 2017 16:06:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49944 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751462AbdKGVG0 (ORCPT ); Tue, 7 Nov 2017 16:06:26 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9AA5C5D688 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=eric.auger@redhat.com From: Auger Eric Subject: Re: [PATCH v5 15/26] KVM: arm/arm64: GICv4: Handle MOVALL applied to a vPE To: Marc Zyngier , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20171027142855.21584-1-marc.zyngier@arm.com> <20171027142855.21584-16-marc.zyngier@arm.com> Cc: Mark Rutland , Andre Przywara , Shameerali Kolothum Thodi , Christoffer Dall , Shanker Donthineni Message-ID: Date: Tue, 7 Nov 2017 22:06:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20171027142855.21584-16-marc.zyngier@arm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 07 Nov 2017 21:06:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marc, On 27/10/2017 16:28, Marc Zyngier wrote: > The current implementation of MOVALL doesn't allow us to call > into the core ITS code as we hold a number of spinlocks. > > Let's try a method used in other parts of the code, were we copy nit: where > the intids of the candicate interrupts, and then do whatever candidate > we need to do with them outside of the critical section. > > This allows us to move the interrupts one by one, at the expense > of a bit of CPU time. Who cares? MOVALL is such a stupid command > anyway... > > Reviewed-by: Christoffer Dall > Signed-off-by: Marc Zyngier > --- > virt/kvm/arm/vgic/vgic-its.c | 19 ++++++++++--------- > 1 file changed, 10 insertions(+), 9 deletions(-) > > diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c > index 5778b50911e8..0b7e648e7a0c 100644 > --- a/virt/kvm/arm/vgic/vgic-its.c > +++ b/virt/kvm/arm/vgic/vgic-its.c > @@ -1148,11 +1148,12 @@ static int vgic_its_cmd_handle_invall(struct kvm *kvm, struct vgic_its *its, > static int vgic_its_cmd_handle_movall(struct kvm *kvm, struct vgic_its *its, > u64 *its_cmd) > { > - struct vgic_dist *dist = &kvm->arch.vgic; > u32 target1_addr = its_cmd_get_target_addr(its_cmd); > u32 target2_addr = its_cmd_mask_field(its_cmd, 3, 16, 32); > struct kvm_vcpu *vcpu1, *vcpu2; > struct vgic_irq *irq; > + u32 *intids; > + int irq_count, i; > > if (target1_addr >= atomic_read(&kvm->online_vcpus) || > target2_addr >= atomic_read(&kvm->online_vcpus)) > @@ -1164,19 +1165,19 @@ static int vgic_its_cmd_handle_movall(struct kvm *kvm, struct vgic_its *its, > vcpu1 = kvm_get_vcpu(kvm, target1_addr); > vcpu2 = kvm_get_vcpu(kvm, target2_addr); > > - spin_lock(&dist->lpi_list_lock); > + irq_count = vgic_copy_lpi_list(vcpu1, &intids); > + if (irq_count < 0) nit: <=? Reviewed-by: Eric Auger Eric > + return irq_count; > > - list_for_each_entry(irq, &dist->lpi_list_head, lpi_list) { > - spin_lock(&irq->irq_lock); > + for (i = 0; i < irq_count; i++) { > + irq = vgic_get_irq(kvm, NULL, intids[i]); > > - if (irq->target_vcpu == vcpu1) > - irq->target_vcpu = vcpu2; > + update_affinity(irq, vcpu2); > > - spin_unlock(&irq->irq_lock); > + vgic_put_irq(kvm, irq); > } > > - spin_unlock(&dist->lpi_list_lock); > - > + kfree(intids); > return 0; > } > >