Commit 40adf686 authored by Parav Pandit's avatar Parav Pandit Committed by Jason Gunthorpe

IB/core: Rename event_handler_lock to qp_open_list_lock

This lock is used to protect the qp->open_list linked list. As a side
effect it seems to also globally serialize the qp event_handler, but it
isn't clear if that is a deliberate design.

Link: https://lore.kernel.org/r/20191212113024.336702-5-leon@kernel.orgSigned-off-by: default avatarParav Pandit <parav@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 17e10646
...@@ -587,7 +587,7 @@ struct ib_device *_ib_alloc_device(size_t size) ...@@ -587,7 +587,7 @@ struct ib_device *_ib_alloc_device(size_t size)
rdma_init_coredev(&device->coredev, device, &init_net); rdma_init_coredev(&device->coredev, device, &init_net);
INIT_LIST_HEAD(&device->event_handler_list); INIT_LIST_HEAD(&device->event_handler_list);
spin_lock_init(&device->event_handler_lock); spin_lock_init(&device->qp_open_list_lock);
init_rwsem(&device->event_handler_rwsem); init_rwsem(&device->event_handler_rwsem);
mutex_init(&device->unregistration_lock); mutex_init(&device->unregistration_lock);
/* /*
......
...@@ -1056,11 +1056,11 @@ static void __ib_shared_qp_event_handler(struct ib_event *event, void *context) ...@@ -1056,11 +1056,11 @@ static void __ib_shared_qp_event_handler(struct ib_event *event, void *context)
struct ib_qp *qp = context; struct ib_qp *qp = context;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&qp->device->event_handler_lock, flags); spin_lock_irqsave(&qp->device->qp_open_list_lock, flags);
list_for_each_entry(event->element.qp, &qp->open_list, open_list) list_for_each_entry(event->element.qp, &qp->open_list, open_list)
if (event->element.qp->event_handler) if (event->element.qp->event_handler)
event->element.qp->event_handler(event, event->element.qp->qp_context); event->element.qp->event_handler(event, event->element.qp->qp_context);
spin_unlock_irqrestore(&qp->device->event_handler_lock, flags); spin_unlock_irqrestore(&qp->device->qp_open_list_lock, flags);
} }
static void __ib_insert_xrcd_qp(struct ib_xrcd *xrcd, struct ib_qp *qp) static void __ib_insert_xrcd_qp(struct ib_xrcd *xrcd, struct ib_qp *qp)
...@@ -1097,9 +1097,9 @@ static struct ib_qp *__ib_open_qp(struct ib_qp *real_qp, ...@@ -1097,9 +1097,9 @@ static struct ib_qp *__ib_open_qp(struct ib_qp *real_qp,
qp->qp_num = real_qp->qp_num; qp->qp_num = real_qp->qp_num;
qp->qp_type = real_qp->qp_type; qp->qp_type = real_qp->qp_type;
spin_lock_irqsave(&real_qp->device->event_handler_lock, flags); spin_lock_irqsave(&real_qp->device->qp_open_list_lock, flags);
list_add(&qp->open_list, &real_qp->open_list); list_add(&qp->open_list, &real_qp->open_list);
spin_unlock_irqrestore(&real_qp->device->event_handler_lock, flags); spin_unlock_irqrestore(&real_qp->device->qp_open_list_lock, flags);
return qp; return qp;
} }
...@@ -1827,9 +1827,9 @@ int ib_close_qp(struct ib_qp *qp) ...@@ -1827,9 +1827,9 @@ int ib_close_qp(struct ib_qp *qp)
if (real_qp == qp) if (real_qp == qp)
return -EINVAL; return -EINVAL;
spin_lock_irqsave(&real_qp->device->event_handler_lock, flags); spin_lock_irqsave(&real_qp->device->qp_open_list_lock, flags);
list_del(&qp->open_list); list_del(&qp->open_list);
spin_unlock_irqrestore(&real_qp->device->event_handler_lock, flags); spin_unlock_irqrestore(&real_qp->device->qp_open_list_lock, flags);
atomic_dec(&real_qp->usecnt); atomic_dec(&real_qp->usecnt);
if (qp->qp_sec) if (qp->qp_sec)
......
...@@ -2631,7 +2631,7 @@ struct ib_device { ...@@ -2631,7 +2631,7 @@ struct ib_device {
struct rw_semaphore event_handler_rwsem; struct rw_semaphore event_handler_rwsem;
/* Protects QP's event_handler calls and open_qp list */ /* Protects QP's event_handler calls and open_qp list */
spinlock_t event_handler_lock; spinlock_t qp_open_list_lock;
struct rw_semaphore client_data_rwsem; struct rw_semaphore client_data_rwsem;
struct xarray client_data; struct xarray client_data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment