Jack Morgenstein a7e1f04905 net/mlx4_core: Fix deadlock when switching between polling and event fw commands
When switching from polling-based fw commands to event-based fw
commands, there is a race condition which could cause a fw command
in another task to hang: that task will keep waiting for the polling
sempahore, but may never be able to acquire it. This is due to
mlx4_cmd_use_events, which "down"s the sempahore back to 0.

During driver initialization, this is not a problem, since no other
tasks which invoke FW commands are active.

However, there is a problem if the driver switches to polling mode
and then back to event mode during normal operation.

The "test_interrupts" feature does exactly that.
Running "ethtool -t <eth device> offline" causes the PF driver to
temporarily switch to polling mode, and then back to event mode.
(Note that for VF drivers, such switching is not performed).

Fix this by adding a read-write semaphore for protection when
switching between modes.

Fixes: 225c7b1feef1 ("IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters")
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-09-21 21:52:43 -04:00
..
2016-09-06 11:02:36 -07:00
2016-09-07 21:24:42 -07:00
2016-09-09 14:52:05 -07:00
2016-07-30 21:01:36 -07:00
2016-09-03 10:40:57 -07:00
2016-07-30 21:01:36 -07:00
2016-08-04 09:59:37 -04:00
2016-08-01 18:36:01 -04:00
2016-07-20 23:39:36 -07:00
2016-09-11 14:41:49 -07:00
2016-09-03 11:38:43 -07:00
2016-08-12 14:59:10 +05:30
2016-09-06 16:57:02 -07:00
2016-08-06 00:01:33 -04:00
2016-08-05 09:48:22 -04:00
2016-08-01 18:36:01 -04:00
2016-09-09 15:11:35 +02:00
2016-08-02 19:35:40 -04:00
2016-08-06 09:20:13 -04:00