[PATCH] mthca: initialize send and receive queue locks separately

mthca: initialize send and receive queue locks separately

lockdep identifies a lock by the call site of its initialization. By
initializing the send and receive queue locks in mthca_wq_init() we confuse
lockdep. It warns that that the ordered acquiry of both locks in
mthca_modify_qp() is recursive acquiry of one lock:

=============================================
[ INFO: possible recursive locking detected ]
---------------------------------------------
modprobe/1192 is trying to acquire lock:
(&wq->lock){....}, at: [<f892b4db>] mthca_modify_qp+0x60/0xa7b [ib_mthca]
but task is already holding lock:
(&wq->lock){....}, at: [<f892b4ce>] mthca_modify_qp+0x53/0xa7b [ib_mthca]

Initializing the locks separately in mthca_alloc_qp_common() stops the
warning and will let lockdep enforce proper ordering on paths that acquire
both locks.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
Cc: Roland Dreier <rolandd@cisco.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Zach Brown and committed by Linus Torvalds a46f9484 dd8041f1

+4 -1
+4 -1
drivers/infiniband/hw/mthca/mthca_qp.c
··· 224 224 225 225 static void mthca_wq_init(struct mthca_wq *wq) 226 226 { 227 - spin_lock_init(&wq->lock); 227 + /* mthca_alloc_qp_common() initializes the locks */ 228 228 wq->next_ind = 0; 229 229 wq->last_comp = wq->max - 1; 230 230 wq->head = 0; ··· 1114 1114 qp->sq_policy = send_policy; 1115 1115 mthca_wq_init(&qp->sq); 1116 1116 mthca_wq_init(&qp->rq); 1117 + /* these are initialized separately so lockdep can tell them apart */ 1118 + spin_lock_init(&qp->sq.lock); 1119 + spin_lock_init(&qp->rq.lock); 1117 1120 1118 1121 ret = mthca_map_memfree(dev, qp); 1119 1122 if (ret)