All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoffer Dall <christoffer.dall@arm.com>
To: Lance Roy <ldr709@gmail.com>
Cc: linux-kernel@vger.kernel.org, Marc Zyngier <marc.zyngier@arm.com>,
	Eric Auger <eric.auger@redhat.com>,
	"Paul E. McKenney" <paulmck@linux.ibm.com>,
	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
Date: Fri, 2 Nov 2018 19:45:33 +0100	[thread overview]
Message-ID: <20181102184533.GA12057@e113682-lin.lund.arm.com> (raw)
In-Reply-To: <20181003053902.6910-17-ldr709@gmail.com>

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 <ldr709@gmail.com>
> Cc: Christoffer Dall <christoffer.dall@arm.com>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Eric Auger <eric.auger@redhat.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: <kvmarm@lists.cs.columbia.edu>

Acked-by: Christoffer Dall <christoffer.dall@arm.com>

> ---
>  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

WARNING: multiple messages have this Message-ID (diff)
From: christoffer.dall@arm.com (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 16/16] KVM: arm/arm64: vgic: Replace spin_is_locked() with lockdep
Date: Fri, 2 Nov 2018 19:45:33 +0100	[thread overview]
Message-ID: <20181102184533.GA12057@e113682-lin.lund.arm.com> (raw)
In-Reply-To: <20181003053902.6910-17-ldr709@gmail.com>

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 <ldr709@gmail.com>
> Cc: Christoffer Dall <christoffer.dall@arm.com>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Eric Auger <eric.auger@redhat.com>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: <kvmarm@lists.cs.columbia.edu>

Acked-by: Christoffer Dall <christoffer.dall@arm.com>

> ---
>  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 at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2018-11-02 18:45 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-03  5:38 Using lockdep instead of spin_is_locked() Lance Roy
2018-10-03  5:38 ` [PATCH 01/16] x86/PCI: Replace spin_is_locked() with lockdep Lance Roy
2018-10-03 16:00   ` Bjorn Helgaas
2018-10-04  6:50     ` Lance Roy
2018-10-03  5:38 ` [PATCH 02/16] hv_balloon: " Lance Roy
2018-10-03 13:20   ` Vitaly Kuznetsov
2018-10-03  5:38 ` [PATCH 03/16] sgi-xp: " Lance Roy
2018-10-03  5:38 ` [PATCH 04/16] i40e: " Lance Roy
2018-10-03  5:38   ` [Intel-wired-lan] " Lance Roy
2018-10-04 18:24   ` Bowers, AndrewX
2018-10-04 18:56   ` Bowers, AndrewX
2018-10-03  5:38 ` [PATCH 05/16] igbvf: " Lance Roy
2018-10-03  5:38   ` [Intel-wired-lan] " Lance Roy
2018-10-13  0:11   ` Brown, Aaron F
2018-10-13  0:11     ` [Intel-wired-lan] " Brown, Aaron F
2018-10-03  5:38 ` [PATCH 06/16] sfc: " Lance Roy
2018-10-03  5:38 ` [PATCH 07/16] smsc: " Lance Roy
2018-10-03  5:38 ` [PATCH 08/16] wireless: " Lance Roy
2018-10-03  9:06   ` Kalle Valo
2018-10-04  6:57     ` Lance Roy
2018-10-04 10:05       ` Kalle Valo
2018-10-05  8:35   ` [PATCH 08/16] zd1211rw: " Kalle Valo
2018-10-03  5:38 ` [PATCH 09/16] scsi: " Lance Roy
2018-10-03 13:53   ` Bart Van Assche
2018-10-11  2:37   ` Martin K. Petersen
2018-10-03  5:38 ` [PATCH 10/16] userfaultfd: " Lance Roy
2018-10-03  5:38 ` [PATCH 11/16] futex: " Lance Roy
2018-10-09 11:21   ` [tip:locking/core] " tip-bot for Lance Roy
2018-10-03  5:38 ` [PATCH 12/16] locking/mutex: " Lance Roy
2018-10-09 12:18   ` Will Deacon
2018-10-09 13:36     ` Paul E. McKenney
2018-10-03  5:38 ` [PATCH 13/16] mm: " Lance Roy
2018-10-03  7:37   ` Vlastimil Babka
2018-10-03  5:39 ` [PATCH 14/16] netfilter: " Lance Roy
2018-10-03  8:29   ` Jozsef Kadlecsik
2018-10-03  5:39 ` [PATCH 15/16] apparmor: " Lance Roy
2018-10-03  5:56   ` John Johansen
2018-10-03  5:39 ` [PATCH 16/16] KVM: arm/arm64: vgic: " Lance Roy
2018-10-03  5:39   ` Lance Roy
2018-11-02 18:45   ` Christoffer Dall [this message]
2018-11-02 18:45     ` Christoffer Dall
2018-11-02 19:42     ` Paul E. McKenney
2018-11-02 19:42       ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181102184533.GA12057@e113682-lin.lund.arm.com \
    --to=christoffer.dall@arm.com \
    --cc=eric.auger@redhat.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=ldr709@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=paulmck@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.