linux/drivers/infiniband/ulp/ipoib
Doug Ledford 0b39578bcd IB/ipoib: Use dedicated workqueues per interface
During my recent work on the rtnl lock deadlock in the IPoIB driver, I
saw that even once I fixed the apparent races for a single device, as
soon as that device had any children, new races popped up.  It turns
out that this is because no matter how well we protect against races
on a single device, the fact that all devices use the same workqueue,
and flush_workqueue() flushes *everything* from that workqueue means
that we would also have to prevent all races between different devices
(for instance, ipoib_mcast_restart_task on interface ib0 can race with
ipoib_mcast_flush_dev on interface ib0.8002, resulting in a deadlock on
the rtnl_lock).

There are several possible solutions to this problem:

Make carrier_on_task and mcast_restart_task try to take the rtnl for
some set period of time and if they fail, then bail.  This runs the
real risk of dropping work on the floor, which can end up being its
own separate kind of deadlock.

Set some global flag in the driver that says some device is in the
middle of going down, letting all tasks know to bail.  Again, this can
drop work on the floor.

Or the method this patch attempts to use, which is when we bring an
interface up, create a workqueue specifically for that interface, so
that when we take it back down, we are flushing only those tasks
associated with our interface.  In addition, keep the global
workqueue, but now limit it to only flush tasks.  In this way, the
flush tasks can always flush the device specific work queues without
having deadlock issues.

Signed-off-by: Doug Ledford <dledford@redhat.com>
2015-04-15 16:06:18 -04:00
..
ipoib_cm.c IB/ipoib: Use dedicated workqueues per interface 2015-04-15 16:06:18 -04:00
ipoib_ethtool.c net: get rid of SET_ETHTOOL_OPS 2014-05-13 17:43:20 -04:00
ipoib_fs.c IPoIB: Remove unnecessary test for NULL before debugfs_remove() 2014-08-12 21:59:54 -07:00
ipoib_ib.c IB/ipoib: Use dedicated workqueues per interface 2015-04-15 16:06:18 -04:00
ipoib_main.c IB/ipoib: Use dedicated workqueues per interface 2015-04-15 16:06:18 -04:00
ipoib_multicast.c IB/ipoib: Use dedicated workqueues per interface 2015-04-15 16:06:18 -04:00
ipoib_netlink.c infiniband: make sure the src net is infiniband when create new link 2014-01-03 20:38:56 -05:00
ipoib_verbs.c IB/ipoib: Use dedicated workqueues per interface 2015-04-15 16:06:18 -04:00
ipoib_vlan.c infiniband/ipoib: implement ndo_get_iflink 2015-04-02 14:05:01 -04:00
ipoib.h IB/ipoib: Use dedicated workqueues per interface 2015-04-15 16:06:18 -04:00
Kconfig kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT 2011-01-20 17:02:05 -08:00
Makefile IB/ipoib: Add rtnl_link_ops support 2012-09-20 16:49:17 -04:00