Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Mar 2018 20:35:13 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r331581 - stable/11/sys/dev/mlx5/mlx5_core
Message-ID:  <201803262035.w2QKZD3r021637@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803262035.w2QKZD3r021637>