[ofa-general] [PATCH 0 of 2] Fix race condition in userspace libraries in create/destroy qp

Jack Morgenstein jackm at dev.mellanox.co.il
Sat Nov 22 01:53:34 PST 2008


The two patches in this series fix a race condition between
create_qp and destroy_qp which results in a newly-created QP not
being found by xxx_find_qp during CQ polling.

The low-level create_qp and destroy_qp functions are not atomic
WRT each other. If one thread is destroying a QP while another is
creating a qp, there is a race hole.  The destroying thread can lose
its timesice after it has deleted the QP from kernel space, but before
it has cleared it from userspace store (xxx_clear_qp).

If the other thread creates a qp during this break, it gets the same
QP base number and overwrites the destroyed QPs entry with xxx_store_qp().

When destroy_qp then deletes the qp number from the userspace store it
deletes the newly-created qp number, resulting in that QP not being found
in poll_cq.

This patch series fixes Bugzilla 1389 for the libmlx4 and libmthca libraries.

- Jack



More information about the general mailing list