svn commit: r331581 - stable/11/sys/dev/mlx5/mlx5_core

Hans Petter Selasky hselasky at FreeBSD.org
Mon Mar 26 20:35:13 UTC 2018


Author: hselasky
Date: Mon Mar 26 20:35:12 2018
New Revision: 331581
URL: https://svnweb.freebsd.org/changeset/base/331581

Log:
  MFC r330645:
  Avoid calling sleeping function from the health poll thread in mlx5core.
  
  linux commit c1d4d2e92ad670168a17a57dfa182a5a5baa72d4
  
  Submitted by:	Matthew Finlay <matt at mellanox.com>
  Sponsored by:	Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c	Mon Mar 26 20:33:31 2018	(r331580)
+++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c	Mon Mar 26 20:35:12 2018	(r331581)
@@ -87,15 +87,23 @@ static int in_fatal(struct mlx5_core_dev *dev)
 
 void mlx5_enter_error_state(struct mlx5_core_dev *dev)
 {
-	if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
+	mutex_lock(&dev->intf_state_mutex);
+	if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
+		goto unlock;
 		return;
+	}
 
 	mlx5_core_err(dev, "start\n");
-	if (pci_channel_offline(dev->pdev) || in_fatal(dev))
+	if (pci_channel_offline(dev->pdev) || in_fatal(dev)) {
 		dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR;
+		mlx5_trigger_cmd_completions(dev);
+	}
 
 	mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 0);
 	mlx5_core_err(dev, "end\n");
+
+unlock:
+	mutex_unlock(&dev->intf_state_mutex);
 }
 
 static void mlx5_handle_bad_state(struct mlx5_core_dev *dev)
@@ -213,7 +221,6 @@ static void poll_health(unsigned long data)
 		return;
 
 	if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
-		mlx5_trigger_cmd_completions(dev);
 		mod_timer(&health->timer, get_next_poll_jiffies());
 		return;
 	}


More information about the svn-src-stable mailing list