Web lists-archives.org

Re: Sparse annotation for "context imbalance" false positives?




You could, for example, insert this:

> 	static void mlx4_ib_lock_cqs(struct mlx4_ib_cq *send_cq, struct mlx4_ib_cq *recv_cq)
> 	{
> 		if (send_cq == recv_cq)
		{
> 			spin_lock_irq(&send_cq->lock);
			 /* pretend to have acquired both for sparse */	
			__acquire(&recv_cq->lock);
		}
> 		else if (send_cq->mcq.cqn < recv_cq->mcq.cqn) {
> 			spin_lock_irq(&send_cq->lock);
> 			spin_lock_nested(&recv_cq->lock, SINGLE_DEPTH_NESTING);
> 		} else {
> 			spin_lock_irq(&recv_cq->lock);
> 			spin_lock_nested(&send_cq->lock, SINGLE_DEPTH_NESTING);
> 		}
> 	}

and then declare that you take "both" locks. Not sure if that will bite
you in the callers again though.

The exact syntax is still a bit under discussion though, whether to use
&recv_cq->lock or leave out the "&" there, I'm favouring the approach
with & but the kernel uses no & in some places.

johannes

Attachment: signature.asc
Description: This is a digitally signed message part