Skip to contentSkip to conversation

net/mlx5: Avoid MMIO when the error is detected

PATCH In review Ganesh Goudar 2 participants 2 messages Aug 7, 2023 – Aug 21, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: Avoid MMIO when the error is detected

When the drivers are notfied about the pci error, All the IO to the card must be stopped, Else the recovery would fail, Avoid memory-mapped IO until the device recovers from pci error.

---
 drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +3 -0
index 932fbc843c69..010dee4eec14 100644
@@ -221,10 +221,13 @@ static void mlx5_timestamp_overflow(struct work_struct *work)
 	clock = container_of(timer, struct mlx5_clock, timer);
 	mdev = container_of(clock, struct mlx5_core_dev, clock);
 
+	if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
+		goto out;
 	write_seqlock_irqsave(&clock->lock, flags);
 	timecounter_read(&timer->tc);
 	mlx5_update_clock_info_page(mdev);
 	write_sequnlock_irqrestore(&clock->lock, flags);
+out:
 	schedule_delayed_work(&timer->overflow_work, timer->overflow_period);
 }
 
Signature · 1 line
2.40.1
#1 lore raw
Quoted 18 lines · Ganesh Goudar

When the drivers are notfied about the pci error, All the IO to the card must be stopped, Else the recovery would fail, Avoid memory-mapped IO until the device recovers from pci error.

---
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | 3 +++

1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +0 -0
index 932fbc843c69..010dee4eec14 100644
@@ -221,10 +221,13 @@ static void mlx5_timestamp_overflow(struct work_struct *work)
 	clock = container_of(timer, struct mlx5_clock, timer);
 	mdev = container_of(clock, struct mlx5_core_dev, clock);
 

drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c static void mlx5_timestamp_overflow(struct work_struct *work) · line 233

Quoted 10 lines
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +3 -0
+	if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
+		goto out;
 	write_seqlock_irqsave(&clock->lock, flags);
 	timecounter_read(&timer->tc);
 	mlx5_update_clock_info_page(mdev);
 	write_sequnlock_irqrestore(&clock->lock, flags);
+out:
 	schedule_delayed_work(&timer->overflow_work, timer->overflow_period);
 }
 

Another version of this fix was already submitted and accepted:

https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

Quoted 4 lines
Signature · 1 line
2.40.1