net/mlx5: Avoid calling sleeping function by the health poll thread
authorMohamad Haj Yahia <mohamad@mellanox.com>
Thu, 30 Jun 2016 14:34:39 +0000 (17:34 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Jul 2016 10:12:03 +0000 (06:12 -0400)
commitc1d4d2e92ad670168a17a57dfa182a5a5baa72d4
treeecc0bfd7ef8dd8216f3f8b6488b2af8d06e3763a
parent0d834442cc247c7b3f3bd6019512ae03e96dd99a
net/mlx5: Avoid calling sleeping function by the health poll thread

In internal error state the health poll thread will eventually call
synchronize_irq() (to safely trigger command completions) which might
sleep, so we are calling sleeping function from atomic context which is
invalid.
Here we move trigger_cmd_completions(dev) to enter error state which is
the earliest stage in error state handling.
This way we won't need to wait for next health poll to trigger command
completions and will solve the scheduling while atomic issue.
mlx5_enter_error_state can be called from two contexts, protect it with
dev->intf_state_lock

Fixes: 89d44f0a6c73 ('net/mlx5_core: Add pci error handlers to mlx5_core driver')
Signed-off-by: Mohamad Haj Yahia <mohamad@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/health.c