[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240927103323.1897094-1-huangjunxian6@hisilicon.com>
Date: Fri, 27 Sep 2024 18:33:21 +0800
From: Junxian Huang <huangjunxian6@...ilicon.com>
To: <jgg@...pe.ca>, <leon@...nel.org>
CC: <linux-rdma@...r.kernel.org>, <linuxarm@...wei.com>,
<linux-kernel@...r.kernel.org>, <tangchengchang@...wei.com>,
<huangjunxian6@...ilicon.com>
Subject: [PATCH v6 for-next 0/2] RDMA: Provide an API for drivers to disassociate mmap pages
Provide an API rdma_user_mmap_disassociate() for drivers to disassociate
mmap pages. Use this API in hns to prevent userspace from ringing doorbell
when HW is reset.
v5 -> v6:
* Fix build warning of unused label in patch #1
* inline the call to rdma_user_mmap_disassociate() in patch #2
v4 -> v5:
* Remove 'disassociated' from core.
* Remove lockdep in uverbs_user_mmap_disassociate() since we have
a new disassociation_lock and don't need to hold hw_destroy_rwsem
in the newly introduced api.
* Use hr_dev->dis_db to prevent new mmaps once the device is reset.
v3 -> v4:
* Add the newly introduced disassociation_lock to ib_uverbs_mmap()
and rdma_umap_open() to prevent concurrency with
rdma_user_mmap_disassociate().
* Change the disassociated flag from atomic_t to bool.
v2 -> v3:
* Walk all ufiles of a device in rdma_user_mmap_disassociate() as Jason
commented, so drivers don't need to maintain their own list of ucontexts.
* Add a disassociation_lock in uverbs_user_mmap_disassociate() as Jason
commented to avoid racing between different threads.
* Add a disassociated flag indicating whether mmaps have been disabled
to prevent new mmap after the disassociation.
v1 -> v2:
* Keep uverbs_user_mmap_disassociate() in uverbs_main.c. The new api
rdma_user_mmap_disassociate() is also moved to this file.
* Add "#if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)" to hns's
rdma_user_mmap_disassociate() call.
Chengchang Tang (2):
RDMA/core: Provide rdma_user_mmap_disassociate() to disassociate mmap
pages
RDMA/hns: Disassociate mmap pages for all uctx when HW is being reset
drivers/infiniband/core/uverbs.h | 2 +
drivers/infiniband/core/uverbs_main.c | 43 +++++++++++++++++++++-
drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 ++
drivers/infiniband/hw/hns/hns_roce_main.c | 5 +++
include/rdma/ib_verbs.h | 8 ++++
5 files changed, 60 insertions(+), 2 deletions(-)
--
2.33.0
Powered by blists - more mailing lists