]> git.baikalelectronics.ru Git - kernel.git/commit
IB: Improve uverbs_cleanup_ucontext algorithm
authorYishai Hadas <yishaih@mellanox.com>
Wed, 20 Jun 2018 14:11:39 +0000 (17:11 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 29 Jun 2018 20:35:46 +0000 (14:35 -0600)
commit372a6494fe688600b008def3a199c3668e9dd7d3
tree3d7396f283f4d903364c949a9d133dfda1c6aebf
parentbbf2aebf643207e2b8e25475b9df5ddf91b6ff29
IB: Improve uverbs_cleanup_ucontext algorithm

Improve uverbs_cleanup_ucontext algorithm to work properly when the
topology graph of the objects cannot be determined at compile time.  This
is the case with objects created via the devx interface in mlx5.

Typically uverbs objects must be created in a strict topologically sorted
order, so that LIFO ordering will generally cause them to be freed
properly. There are only a few cases (eg memory windows) where objects can
point to things out of the strict LIFO order.

Instead of using an explicit ordering scheme where the HW destroy is not
allowed to fail, go over the list multiple times and allow the destroy
function to fail. If progress halts then a final, desperate, cleanup is
done before leaking the memory. This indicates a driver bug.

Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
12 files changed:
drivers/infiniband/core/rdma_core.c
drivers/infiniband/core/uverbs.h
drivers/infiniband/core/uverbs_cmd.c
drivers/infiniband/core/uverbs_std_types.c
drivers/infiniband/core/uverbs_std_types_counters.c
drivers/infiniband/core/uverbs_std_types_cq.c
drivers/infiniband/core/uverbs_std_types_dm.c
drivers/infiniband/core/uverbs_std_types_flow_action.c
drivers/infiniband/core/uverbs_std_types_mr.c
drivers/infiniband/hw/mlx5/devx.c
include/rdma/ib_verbs.h
include/rdma/uverbs_types.h