diff options
author | Mohamad Haj Yahia <mohamad@mellanox.com> | 2016-10-25 18:36:33 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-10-29 12:00:39 -0400 |
commit | 05ac2c0b7438ea08c5d54b48797acf9b22cb2f6f (patch) | |
tree | e25e0ebfe1a447c0de7a32fea33212457debcb20 /include | |
parent | 2241007b3d783cbdbaa78c30bdb1994278b6f9b9 (diff) | |
download | linux-stable-05ac2c0b7438ea08c5d54b48797acf9b22cb2f6f.tar.gz linux-stable-05ac2c0b7438ea08c5d54b48797acf9b22cb2f6f.tar.bz2 linux-stable-05ac2c0b7438ea08c5d54b48797acf9b22cb2f6f.zip |
net/mlx5: Fix race between PCI error handlers and health work
Currently there is a race between the health care work and the kernel
pci error handlers because both of them detect the error, the first one
to be called will do the error handling.
There is a chance that health care will disable the pci after resuming
pci slot.
Also create a separate WQ because now we will have two types of health
works, one for the error detection and one for the recovery.
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mlx5/driver.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 5dbda60a09f4..7d9a5d08eb59 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h @@ -418,7 +418,10 @@ struct mlx5_core_health { u32 prev; int miss_counter; bool sick; + /* wq spinlock to synchronize draining */ + spinlock_t wq_lock; struct workqueue_struct *wq; + unsigned long flags; struct work_struct work; }; @@ -778,6 +781,7 @@ void mlx5_health_cleanup(struct mlx5_core_dev *dev); int mlx5_health_init(struct mlx5_core_dev *dev); void mlx5_start_health_poll(struct mlx5_core_dev *dev); void mlx5_stop_health_poll(struct mlx5_core_dev *dev); +void mlx5_drain_health_wq(struct mlx5_core_dev *dev); int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, struct mlx5_buf *buf, int node); int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, struct mlx5_buf *buf); |