Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2459735imd; Fri, 2 Nov 2018 11:46:50 -0700 (PDT) X-Google-Smtp-Source: AJdET5eQNED503hKVK5IOdcPhVwkCbfSHrmhpQ21IEF6SFhWSPl/VO6lysB0Vv/e7eArJdjkKNlQ X-Received: by 2002:a62:1954:: with SMTP id 81-v6mr12771744pfz.237.1541184410767; Fri, 02 Nov 2018 11:46:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541184410; cv=none; d=google.com; s=arc-20160816; b=vTmAtBLjkrM9S1LiWjoYurfVPQJneRxpcjW6OX0trWRwwPm0tUsZN3nW6tmQcsh64d T/doa+U0Fbau/3ImUbuu1qmlsQnR2OrkP5I2ycQ8u1Gn2xyocMg4CTHAVYY0pIo8npKT jcgPMcIdvPbp0GqDFhVf2a2k+tpswxeOwaI8FgKjBaUvazvjpNrQLpXp1X3oFJrgsate 7woCFWU3rSBIF/uwfMWqiptwtVslPq+/ifV5YQkcdoyiG84HmBEmo6MUrphacFoDz1DG ELco9dE4UuR1w1PxbrMlevC0+DqSaFFUCTIm9TkuIMP0Daewynne5yrtPZNiVboTavM7 CpMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=9F5OiuIjv4ZTBOcVU7ztkI/LGUj0uTbZlA/IAAyZX8M=; b=qFvz4cyBL4iJMkpzAt1hEStZZZKMy65sqYmyNJTQ5OWvhyTK8oK9wzpNygFQJWkhQh gGTQtws1HDSKjj6HcWd91eWqPZXVmNUpj516B2V9IYhVh4BsR/XSZwnnlGJqxVQFIiUu hqAvszbCPgN3L77HM1feqMdPoCCB6CJgffFTgHuU0OEz6nJI43IdrCFqB3Dn9H0+gSRd xgAsymnFNYVXK/49VKe6PcgI/P5tdSN6f1i3FLBsmAlulZIaXjSz5tDCxHQBmWOgPoxy FzcTNMzdQ7jHmBMF50XslAOOfoNGc38l3tFqAHBhLQ212ak9N7FrCBGYtPAKpNv69jDF 5myg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l16-v6si34719281pfb.69.2018.11.02.11.46.36; Fri, 02 Nov 2018 11:46:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730245AbeKCDxt (ORCPT + 99 others); Fri, 2 Nov 2018 23:53:49 -0400 Received: from foss.arm.com ([217.140.101.70]:45396 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728986AbeKCDxs (ORCPT ); Fri, 2 Nov 2018 23:53:48 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D66E5A78; Fri, 2 Nov 2018 11:45:35 -0700 (PDT) Received: from localhost (e113682-lin.copenhagen.arm.com [10.32.144.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3DD2E3F71E; Fri, 2 Nov 2018 11:45:35 -0700 (PDT) Date: Fri, 2 Nov 2018 19:45:33 +0100 From: Christoffer Dall To: Lance Roy Cc: linux-kernel@vger.kernel.org, Marc Zyngier , Eric Auger , "Paul E. McKenney" , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 16/16] KVM: arm/arm64: vgic: Replace spin_is_locked() with lockdep Message-ID: <20181102184533.GA12057@e113682-lin.lund.arm.com> References: <20181003053902.6910-1-ldr709@gmail.com> <20181003053902.6910-17-ldr709@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181003053902.6910-17-ldr709@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 02, 2018 at 10:39:02PM -0700, Lance Roy wrote: > lockdep_assert_held() is better suited to checking locking requirements, > since it won't get confused when someone else holds the lock. This is > also a step towards possibly removing spin_is_locked(). > > Signed-off-by: Lance Roy > Cc: Christoffer Dall > Cc: Marc Zyngier > Cc: Eric Auger > Cc: linux-arm-kernel@lists.infradead.org > Cc: Acked-by: Christoffer Dall > --- > virt/kvm/arm/vgic/vgic.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c > index 7cfdfbc910e0..50e25438fb3c 100644 > --- a/virt/kvm/arm/vgic/vgic.c > +++ b/virt/kvm/arm/vgic/vgic.c > @@ -196,7 +196,7 @@ void vgic_irq_set_phys_active(struct vgic_irq *irq, bool active) > */ > static struct kvm_vcpu *vgic_target_oracle(struct vgic_irq *irq) > { > - DEBUG_SPINLOCK_BUG_ON(!spin_is_locked(&irq->irq_lock)); > + lockdep_assert_held(&irq->irq_lock); > > /* If the interrupt is active, it must stay on the current vcpu */ > if (irq->active) > @@ -273,7 +273,7 @@ static void vgic_sort_ap_list(struct kvm_vcpu *vcpu) > { > struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; > > - DEBUG_SPINLOCK_BUG_ON(!spin_is_locked(&vgic_cpu->ap_list_lock)); > + lockdep_assert_held(&vgic_cpu->ap_list_lock); > > list_sort(NULL, &vgic_cpu->ap_list_head, vgic_irq_cmp); > } > @@ -311,7 +311,7 @@ bool vgic_queue_irq_unlock(struct kvm *kvm, struct vgic_irq *irq, > { > struct kvm_vcpu *vcpu; > > - DEBUG_SPINLOCK_BUG_ON(!spin_is_locked(&irq->irq_lock)); > + lockdep_assert_held(&irq->irq_lock); > > retry: > vcpu = vgic_target_oracle(irq); > @@ -702,7 +702,7 @@ static inline void vgic_fold_lr_state(struct kvm_vcpu *vcpu) > static inline void vgic_populate_lr(struct kvm_vcpu *vcpu, > struct vgic_irq *irq, int lr) > { > - DEBUG_SPINLOCK_BUG_ON(!spin_is_locked(&irq->irq_lock)); > + lockdep_assert_held(&irq->irq_lock); > > if (kvm_vgic_global_state.type == VGIC_V2) > vgic_v2_populate_lr(vcpu, irq, lr); > @@ -736,7 +736,7 @@ static int compute_ap_list_depth(struct kvm_vcpu *vcpu, > > *multi_sgi = false; > > - DEBUG_SPINLOCK_BUG_ON(!spin_is_locked(&vgic_cpu->ap_list_lock)); > + lockdep_assert_held(&vgic_cpu->ap_list_lock); > > list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list) { > int w; > @@ -761,7 +761,7 @@ static void vgic_flush_lr_state(struct kvm_vcpu *vcpu) > bool multi_sgi; > u8 prio = 0xff; > > - DEBUG_SPINLOCK_BUG_ON(!spin_is_locked(&vgic_cpu->ap_list_lock)); > + lockdep_assert_held(&vgic_cpu->ap_list_lock); > > count = compute_ap_list_depth(vcpu, &multi_sgi); > if (count > kvm_vgic_global_state.nr_lr || multi_sgi) > -- > 2.19.0 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel