From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 820B7C2BCA1 for ; Fri, 7 Jun 2019 12:12:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 50B6420B7C for ; Fri, 7 Jun 2019 12:12:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hHqKJpdh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 50B6420B7C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2chDvdu2tlXx2seYpDwb5aA4LefQYQkG2WPddXNqfow=; b=hHqKJpdhPMRvi+ qUIoRM01rRdqBOKnRiu1k13/JCWiz+BhvqE+CCcFiEglYenitHSTX7tvRAHLAvtwNtxi0Gyfh+sfH oIVUetPh2IBmG+UPK2fTDle0Zp4nIw/LGQluGnrLhT2YWyAlnfpen0Lu6cAjGBDLvojNjN4+nilbL 0J1p2B5R9aeP99FWzgTZ4Dv77NfAK78E1+A/mXNtSHDunuwm+NjqFfd2q+Bmb3TrBZh50udzB0F2c DBV8UGEXdKWUwcoYNdTESTo1CID17jHyaqm57LcMPizmsYTGdYqziWIBCSgd6NWCNdImUv0nvUwz7 rLz6piuqujriepp6dj3w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hZDjE-0008Qo-4k; Fri, 07 Jun 2019 12:12:16 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hZDjA-0008QQ-OB for linux-arm-kernel@lists.infradead.org; Fri, 07 Jun 2019 12:12:14 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B4B085376; Fri, 7 Jun 2019 12:11:58 +0000 (UTC) Received: from [10.36.116.67] (ovpn-116-67.ams2.redhat.com [10.36.116.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F2857D951; Fri, 7 Jun 2019 12:11:50 +0000 (UTC) Subject: Re: [PATCH 2/8] KVM: arm/arm64: vgic: Add __vgic_put_lpi_locked primitive To: Marc Zyngier , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org References: <20190606165455.162478-1-marc.zyngier@arm.com> <20190606165455.162478-3-marc.zyngier@arm.com> From: Auger Eric Message-ID: <8048ab7f-a429-df29-43da-05ef97c9dc7a@redhat.com> Date: Fri, 7 Jun 2019 14:11:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190606165455.162478-3-marc.zyngier@arm.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 07 Jun 2019 12:12:08 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190607_051212_823222_6D580A81 X-CRM114-Status: GOOD ( 20.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Suzuki K Poulose , "Raslan, KarimAllah" , Julien Thierry , Christoffer Dall , James Morse , Zenghui Yu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Marc, On 6/6/19 6:54 PM, Marc Zyngier wrote: > Our LPI translation cache needs to be able to drop the refcount > on an LPI whilst already holding the lpi_list_lock. > > Let's add a new primitive for this. > > Signed-off-by: Marc Zyngier Reviewed-by: Eric Auger Thanks Eric > --- > virt/kvm/arm/vgic/vgic.c | 26 +++++++++++++++++--------- > virt/kvm/arm/vgic/vgic.h | 1 + > 2 files changed, 18 insertions(+), 9 deletions(-) > > diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c > index 191deccf60bf..376a297e2169 100644 > --- a/virt/kvm/arm/vgic/vgic.c > +++ b/virt/kvm/arm/vgic/vgic.c > @@ -130,6 +130,22 @@ static void vgic_irq_release(struct kref *ref) > { > } > > +/* > + * Drop the refcount on the LPI. Must be called with lpi_list_lock held. > + */ > +void __vgic_put_lpi_locked(struct kvm *kvm, struct vgic_irq *irq) > +{ > + struct vgic_dist *dist = &kvm->arch.vgic; > + > + if (!kref_put(&irq->refcount, vgic_irq_release)) > + return; > + > + list_del(&irq->lpi_list); > + dist->lpi_list_count--; > + > + kfree(irq); > +} > + > void vgic_put_irq(struct kvm *kvm, struct vgic_irq *irq) > { > struct vgic_dist *dist = &kvm->arch.vgic; > @@ -139,16 +155,8 @@ void vgic_put_irq(struct kvm *kvm, struct vgic_irq *irq) > return; > > raw_spin_lock_irqsave(&dist->lpi_list_lock, flags); > - if (!kref_put(&irq->refcount, vgic_irq_release)) { > - raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags); > - return; > - }; > - > - list_del(&irq->lpi_list); > - dist->lpi_list_count--; > + __vgic_put_lpi_locked(kvm, irq); > raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags); > - > - kfree(irq); > } > > void vgic_flush_pending_lpis(struct kvm_vcpu *vcpu) > diff --git a/virt/kvm/arm/vgic/vgic.h b/virt/kvm/arm/vgic/vgic.h > index a58e1b263dca..80cd40575bc9 100644 > --- a/virt/kvm/arm/vgic/vgic.h > +++ b/virt/kvm/arm/vgic/vgic.h > @@ -172,6 +172,7 @@ vgic_get_mmio_region(struct kvm_vcpu *vcpu, struct vgic_io_device *iodev, > gpa_t addr, int len); > struct vgic_irq *vgic_get_irq(struct kvm *kvm, struct kvm_vcpu *vcpu, > u32 intid); > +void __vgic_put_lpi_locked(struct kvm *kvm, struct vgic_irq *irq); > void vgic_put_irq(struct kvm *kvm, struct vgic_irq *irq); > bool vgic_get_phys_line_level(struct vgic_irq *irq); > void vgic_irq_set_phys_pending(struct vgic_irq *irq, bool pending); > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel