RDMA/mlx5: Use different doorbell memory for different processes
authorMark Zhang <markzhang@nvidia.com>
Thu, 3 Jun 2021 13:18:03 +0000 (16:18 +0300)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 3 Jun 2021 17:19:53 +0000 (14:19 -0300)
commita0ffb4c12f7fa89163e228e6f27df09b46631db1
tree6b491664cf556a62801f3d0f18a3cae8e6fc27d2
parenta3e74fb9247cd530dca246699d5eb5a691884d32
RDMA/mlx5: Use different doorbell memory for different processes

In a fork scenario, the parent and child can have same virtual address and
also share the uverbs fd.  That causes to the list_for_each_entry search
return same doorbell physical page for all processes, even though that
page has been COW' or copied.

This patch takes the mm_struct into consideration during search, to make
sure that VA's belonging to different processes are not intermixed.

Resolves the malfunction of uverbs after fork in some specific cases.

Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
Link: https://lore.kernel.org/r/feacc23fe0bc6e1088c6824d5583798745e72405.1622726212.git.leonro@nvidia.com
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Mark Zhang <markzhang@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/mlx5/doorbell.c