lkml.org 
[lkml]   [2008]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Sparse annotation for "context imbalance" false positives?
From
Date
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
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2008-05-15 10:59    [W:0.030 / U:0.584 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site