From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Hanson Subject: Re: [PATCH v2 26/54] KVM: arm/arm64: vgic-new: Add ACTIVE registers handlers Date: Thu, 5 May 2016 10:48:49 -0600 Message-ID: <572B7971.1060702@linaro.org> References: <1461861973-26464-1-git-send-email-andre.przywara@arm.com> <1461861973-26464-27-git-send-email-andre.przywara@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: Eric Auger , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org To: Andre Przywara , Marc Zyngier , Christoffer Dall Return-path: Received: from mail-pf0-f171.google.com ([209.85.192.171]:33937 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757371AbcEEQs4 (ORCPT ); Thu, 5 May 2016 12:48:56 -0400 Received: by mail-pf0-f171.google.com with SMTP id y69so39236734pfb.1 for ; Thu, 05 May 2016 09:48:56 -0700 (PDT) In-Reply-To: <1461861973-26464-27-git-send-email-andre.przywara@arm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 04/28/2016 10:45 AM, Andre Przywara wrote: ... > +void vgic_mmio_write_sactive(struct kvm_vcpu *vcpu, > + gpa_t addr, unsigned int len, > + unsigned long val) ... > + spin_lock(&vcpu->arch.vgic_cpu.ap_list_lock); > + spin_lock(&irq->irq_lock); If using the suggested higher level function from patch 14 this could be: vgic_lock_aplist_irq(&vcpu->arch.vgic_cpu.ap_list_lock, &irq->irq_lock); > + > + /* > + * Recheck after dropping the IRQ lock to see if we should > + * still care about queueing it. > + */ > + if (irq->active || irq->vcpu) { > + irq->active = true; > + > + spin_unlock(&irq->irq_lock); > + spin_unlock(&vcpu->arch.vgic_cpu.ap_list_lock); And this could be: vgic_unlock_aplist_irq(&vcpu->arch.vgic_cpu.ap_list_lock, &irq->irq_lock); > + > + continue; > + } > + > + /* Did the target VCPU change while we had the lock dropped? */ > + if (vcpu != irq->target_vcpu) { > + spin_unlock(&irq->irq_lock); > + spin_unlock(&vcpu->arch.vgic_cpu.ap_list_lock); And this could be: vgic_unlock_aplist_irq(&vcpu->arch.vgic_cpu.ap_list_lock, &irq->irq_lock); > + > + goto retry; > + } > + > + /* Now queue the IRQ to the VCPU's ap_list. */ > + list_add_tail(&irq->ap_list, &vcpu->arch.vgic_cpu.ap_list_head); > + irq->vcpu = vcpu; > + > + irq->active = true; > + > + spin_unlock(&irq->irq_lock); > + spin_unlock(&vcpu->arch.vgic_cpu.ap_list_lock); And this could be: vgic_unlock_aplist_irq(&vcpu->arch.vgic_cpu.ap_list_lock, &irq->irq_lock); > + > + kvm_vcpu_kick(vcpu); > + } > +} > +