aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2019-02-06 22:41:54 -0700
committerJason Gunthorpe <jgg@mellanox.com>2019-02-08 16:56:45 -0700
commit921eab1143aadf976a42cac4605b4d35159b355d (patch)
tree597549c34b64fee575f20db29f0b0ca8623a04b0 /include
parentRDMA/devices: Use xarray to store the client_data (diff)
downloadlinux-dev-921eab1143aadf976a42cac4605b4d35159b355d.tar.xz
linux-dev-921eab1143aadf976a42cac4605b4d35159b355d.zip
RDMA/devices: Re-organize device.c locking
The locking here started out with a single lock that covered everything and then has lately veered into crazy town. The fundamental problem is that several places need to iterate over a linked list, but also need to drop their locks to avoid deadlock during client callbacks. xarray's restartable iteration offers a simple solution to the problem. Once all the lists are xarrays we can drop locks in the places that need that and rely on xarray to provide consistency and locking for the data structure. The resulting simplification is that each of the three lists has a dedicated rwsem that must be held when working with the list it covers. One data structure is no longer covered by multiple locks. The sleeping semaphore is selected because the read side generally needs to be held over something sleeping, and using RCU reader locking in those cases is overkill. In the process this simplifies the entire registration/unregistration flow to be the expected list of setups and the reversed list of matching teardowns, and the registration lock 'refcount' can now be revised to be released after the ULPs are removed, providing a very sane semantic for this feature. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'include')
-rw-r--r--include/rdma/ib_verbs.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 8558f31ca46f..135fab2c016c 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2542,6 +2542,7 @@ struct ib_device {
struct list_head event_handler_list;
spinlock_t event_handler_lock;
+ struct rw_semaphore client_data_rwsem;
struct xarray client_data;
struct ib_cache cache;