]> 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)
commit53746778da424d86f0f37f5747a461038729a8ef
tree3d7396f283f4d903364c949a9d133dfda1c6aebf
parent26962db52962922fbfe92d6535bbe40fa4ab0ad9
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