[ofa-general] [PATCH] IB/mlx4 mlx4_core: fix qp free sync

Eli Cohen eli at mellanox.co.il
Tue May 8 02:37:22 PDT 2007


fix missing initialization of free object for qp and use logic
similar to cq when closing the qp. The problem first shows when
using qp events when complete attempts to acquire a none initialized
spinlock.

Signed-off-by: Eli Cohen <eli at mellanox.co.il>

---

Index: connectx_kernel/drivers/net/mlx4/qp.c
===================================================================
--- connectx_kernel.orig/drivers/net/mlx4/qp.c	2007-05-07 17:48:17.000000000 +0300
+++ connectx_kernel/drivers/net/mlx4/qp.c	2007-05-08 12:07:33.000000000 +0300
@@ -185,6 +185,9 @@ int mlx4_qp_alloc(struct mlx4_dev *dev, 
 	if (err)
 		goto err_put_cmpt;
 
+	atomic_set(&qp->refcount, 1);
+	init_completion(&qp->free);
+
 	return 0;
 
 err_put_cmpt:
@@ -225,6 +228,10 @@ void mlx4_qp_free(struct mlx4_dev *dev, 
 {
 	struct mlx4_qp_table *qp_table = &mlx4_priv(dev)->qp_table;
 
+	if (atomic_dec_and_test(&qp->refcount))
+		complete(&qp->free);
+	wait_for_completion(&qp->free);
+
 	mlx4_table_put(dev, &qp_table->cmpt_table, qp->qpn);
 	mlx4_table_put(dev, &qp_table->rdmarc_table, qp->qpn);
 	mlx4_table_put(dev, &qp_table->altc_table, qp->qpn);




More information about the general mailing list