On 1/8/2020 2:32 AM, Jason Gunthorpe wrote: > On Thu, Dec 12, 2019 at 01:30:22PM +0200, Leon Romanovsky wrote: > >> @@ -2627,7 +2626,11 @@ struct ib_device { >> struct rcu_head rcu_head; >> >> struct list_head event_handler_list; >> - spinlock_t event_handler_lock; >> + /* Protects event_handler_list */ >> + struct rw_semaphore event_handler_rwsem; >> + >> + /* Protects QP's event_handler calls and open_qp list */ >> + spinlock_t event_handler_lock; > > This only protects the open_qp list really, the event handler call > doesn't need a spinlock. So lets name it properly. open_list_lock ? > Yes. it protects open_qp list and event handler is called for each list item. So it doesn't really need to protect event handler calls. > It is sort of weird that we globally serialize all the qp event > handlers? ie that this lock isn't in the ib_qp. > It probably isn't in each ib_qp because ib_qp is in hundred thousands and xrc qp events are not so frequent event that can get contented. So I think per device qp list lock seems fine.