[ofa-general] Re: Race condition in userspace libraries with create/destroy qp

Jack Morgenstein jackm at dev.mellanox.co.il
Thu Nov 20 23:02:01 PST 2008


On Friday 21 November 2008 00:50, Roland Dreier wrote:
> > 2. Create a mutex for this purpose, and use it to force the create and destroy qp operations
>  >    to be atomic WRT  the ibv_cmd_xxx_qp operations and the store/clear qp operations.
> 
> This looks like the best solution.
> 
> I wonder if we should just add this synchronization in libibverbs rather
> than individual drivers?  I notice that libcxgb3 seems to have the same
> bug AFAICS.  But maybe it's better to just keep the simple rule that
> driver libraries are responsible for locking their own data structures.
> 
Thanks for responding so quickly!

I prefer to keep the rule that low-level driver libraries are responsible.
Its not clear that all low-level drivers necessarily have this issue.

BTW, I notice that there is a ctx->qp_table_mutex (used only in file
libmlx4/src/qp.c). What if I steal that and move its use upwards into
procedures mlx4_create_qp/mlx4_destroy_qp? (a bit cheesy, but it saves
creating yet another mutex in the mlx4 user context).

- Jack



More information about the general mailing list