linux/drivers/infiniband/hw/ocrdma
Devesh Sharma 3b1ea43009 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>
2016-01-19 14:00:47 -05:00
..
Kconfig
Makefile
ocrdma_abi.h RDMA/ocrdma: update ocrdma license to dual-license 2015-07-24 11:34:34 -04:00
ocrdma_ah.c IB/core: Validate route when we init ah 2015-12-23 10:35:12 -05:00
ocrdma_ah.h RDMA/ocrdma: update ocrdma license to dual-license 2015-07-24 11:34:34 -04:00
ocrdma_hw.c RDMA/ocrdma: Depend on async link events from CNA 2016-01-19 14:00:47 -05:00
ocrdma_hw.h RDMA/ocrdma: Depend on async link events from CNA 2016-01-19 14:00:47 -05:00
ocrdma_main.c RDMA/ocrdma: Depend on async link events from CNA 2016-01-19 14:00:47 -05:00
ocrdma_sli.h RDMA/ocrdma: Depend on async link events from CNA 2016-01-19 14:00:47 -05:00
ocrdma_stats.c RDMA/ocrdma: Avoid a possible crash in ocrdma_rem_port_stats 2015-10-21 17:28:19 -04:00
ocrdma_stats.h RDMA/ocrdma: update ocrdma license to dual-license 2015-07-24 11:34:34 -04:00
ocrdma_verbs.c RDMA/ocrdma: Depend on async link events from CNA 2016-01-19 14:00:47 -05:00
ocrdma_verbs.h IB: remove support for phys MRs 2015-12-23 14:29:04 -05:00
ocrdma.h RDMA/ocrdma: Depend on async link events from CNA 2016-01-19 14:00:47 -05:00