[ofa-general] userspace "deadlock" bug in libmlx4?

Jack Morgenstein jackm at dev.mellanox.co.il
Tue Sep 11 08:03:38 PDT 2007


Roland,

I noticed the following in libmlx4, when destroying a qp:

file verbs.c, procedure mlx4_destroy_qp:
	mlx4_lock_cqs(ibqp);
	mlx4_clear_qp(to_mctx(ibqp->context), ibqp->qp_num);
	mlx4_unlock_cqs(ibqp);

(and mlx4_lock_cqs() takes pthread spinlocks).

Now, in function mlx4_clear_qp() (file src/qp.c) , we see the following:
	pthread_mutex_lock(&ctx->qp_table_mutex);

	if (!--ctx->qp_table[tind].refcnt)
		free(ctx->qp_table[tind].table);
	else
		ctx->qp_table[tind].table[qpn & ctx->qp_table_mask] = NULL;

	pthread_mutex_unlock(&ctx->qp_table_mutex);

We're (potentially) waiting on a pthread mutex inside a pthread spinlock.
Is there a problem here?

- Jack



More information about the general mailing list