[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1210841663.4282.9.camel@johannes.berg>
Date: Thu, 15 May 2008 10:54:23 +0200
From: Johannes Berg <johannes@...solutions.net>
To: Roland Dreier <rdreier@...co.com>
Cc: linux-kernel@...r.kernel.org, linux-sparse@...r.kernel.org,
David Brownell <david-b@...bell.net>
Subject: 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
Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)
Powered by blists - more mailing lists