linux-sg2042/drivers/infiniband/hw
Devesh Sharma 10a214dc99 RDMA/ocrdma: Depend on async link events from CNA
Recently Dough Ledford reported a deadlock happening
between ocrdma-load sequence and NetworkManager service
issuing "open" on be2net interface.

The deadlock happens when any be2net hook (e.g. open/close) is called
in parallel to insmod ocrdma.ko.

A. be2net is sending administrative open/close event to ocrdma holding
   device_list_mutex. It does this from ndo_open/ndo_stop hooks of be2net.
   So sequence of locks is rtnl_lock---> device_list lock

B.  When new ocrdma roce device gets registered, infiniband stack now
    takes rtnl_lock in ib_register_device() in GID initialization routines.
    So sequence of locks in this path is device_list lock ---> rtnl_lock.

This improper locking sequence causes deadlock.

With this patch we stop using administrative open and close events
injected by be2net driver. These events were used to dispatch PORT_ACTIVE
and PORT_ERROR events to the IB-stack. This patch implements a logic
to receive async-link-events generated from CNA whenever link-state-change
is detected. Now on, these async-events will be used to dispatch
PORT_ACTIVE and PORT_ERROR events to IB-stack.

Depending on async-events from CNA removes the need to hold device-list-mutex
and thus breaks the busy-wait scenario.

Reported-by: Doug Ledford <dledford@redhat.com>
CC: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@avagotech.com>
Signed-off-by: Selvin Xavier <selvin.xavier@avagotech.com>
Signed-off-by: Devesh Sharma <devesh.sharma@avagotech.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2015-12-28 11:45:54 -05:00
..
cxgb3 RDMA/cxgb3: Remove old FRWR API 2015-10-28 22:27:19 -04:00
cxgb4 iw_cxgb4: Remove old FRWR API 2015-10-28 22:32:29 -04:00
mlx4 IB/mlx4: Replace kfree with kvfree in mlx4_ib_destroy_srq 2015-12-22 23:23:34 -05:00
mlx5 IB/mlx5: Postpone remove_keys under knowledge of coming preemption 2015-12-08 16:55:31 -05:00
mthca Merge branch 'wr-cleanup' into k.o/for-4.4 2015-10-28 22:23:34 -04:00
nes Initial 4.4 merge window submission 2015-11-07 13:33:07 -08:00
ocrdma RDMA/ocrdma: Depend on async link events from CNA 2015-12-28 11:45:54 -05:00
qib IB/qib: Minor fixes to qib per SFF 8636 2015-12-07 16:36:00 -05:00
usnic usnic: correctly handle kzalloc return value 2015-10-21 16:41:19 -04:00
Makefile IB/ehca: Deprecate driver, move to staging, schedule deletion 2015-09-11 18:13:35 -04:00