All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Roland Dreier <rdreier@cisco.com>
Cc: linux-kernel@vger.kernel.org, linux-sparse@vger.kernel.org,
	David Brownell <david-b@pacbell.net>
Subject: Re: Sparse annotation for "context imbalance" false positives?
Date: Thu, 15 May 2008 10:54:23 +0200	[thread overview]
Message-ID: <1210841663.4282.9.camel@johannes.berg> (raw)
In-Reply-To: <adaod78fe94.fsf@cisco.com> (sfid-20080515_051646_455778_42A2EDF3)

[-- Attachment #1: Type: text/plain, Size: 889 bytes --]

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 #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2008-05-15  8:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-15  3:16 Sparse annotation for "context imbalance" false positives? Roland Dreier
2008-05-15  8:54 ` Johannes Berg [this message]
2008-05-15 15:05   ` Roland Dreier
2008-05-15 15:20     ` Johannes Berg

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=1210841663.4282.9.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=david-b@pacbell.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=rdreier@cisco.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.