Skip to contentSkip to conversation

iavf: Fix RTNL deadlock with new flag IAVF_FLAG_REINIT_MSIX_NEEDED

PATCH New Karen Sornek 2 participants 2 messages Sep 1, 2021 – Nov 4, 2021

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

PATCH 1/1 iavf: Fix RTNL deadlock with new flag IAVF_FLAG_REINIT_MSIX_NEEDED

The IAVF_FLAG_REINIT_ITR_NEEDED flag was being used for two different purposes. As originally written, it indicates to the ITR mechanism to update the interrupt registers to a new setting. Sometime later, it was overloaded to indicate that interrupts need to be completely reinitialized during reset. This causes problems when ethtool -C is used while a reset is in progress, and can lead to RTNL deadlocks.

To fix this, add a new flag IAVF_FLAG_REINIT_MSIX_NEEDED and use that to trigger MSI-X reinit.

Fixes 129cf89e5856 ("iavf: rename functions and structs to new name")
---
 drivers/net/ethernet/intel/iavf/iavf.h      | 1 +
 drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf.h +1 -0
index 21c957755..5a36af8b9 100644
@@ -272,6 +272,7 @@ struct iavf_adapter {
 #define IAVF_FLAG_LEGACY_RX			BIT(15)
 #define IAVF_FLAG_REINIT_ITR_NEEDED		BIT(16)
 #define IAVF_FLAG_QUEUES_DISABLED		BIT(17)
+#define IAVF_FLAG_REINIT_MSIX_NEEDED		BIT(20)
 /* duplicates for common code */
 #define IAVF_FLAG_DCB_ENABLED			0
 	/* flags for admin queue service task */
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
index 80437ef26..4b7a670de 100644
@@ -3556,7 +3556,7 @@ int iavf_process_config(struct iavf_adapter *adapter)
 			"Requested %d queues, but PF only gave us %d.\n",
 			num_req_queues,
 			adapter->vsi_res->num_queue_pairs);
-		adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED;
+		adapter->flags |= IAVF_FLAG_REINIT_MSIX_NEEDED;
 		adapter->num_req_queues = adapter->vsi_res->num_queue_pairs;
 		iavf_schedule_reset(adapter);
 		return -ENODEV;
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/1 iavf: Fix RTNL deadlock with new flag IAVF_FLAG_REINIT_MSIX_NEEDED

Quoted 20 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Karen Sornek
Sent: Wednesday, September 1, 2021 2:15 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Williams, Mitch A <[email protected]>; Sornek, Karen <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v1] iavf: Fix RTNL deadlock with new flag IAVF_FLAG_REINIT_MSIX_NEEDED

The IAVF_FLAG_REINIT_ITR_NEEDED flag was being used for two different purposes. As originally written, it indicates to the ITR mechanism to update the interrupt registers to a new setting. Sometime later, it was overloaded to indicate that interrupts need to be completely reinitialized during reset. This causes problems when ethtool -C is used while a reset is in progress, and can lead to RTNL deadlocks.

To fix this, add a new flag IAVF_FLAG_REINIT_MSIX_NEEDED and use that to trigger MSI-X reinit.

Quoted 8 lines
Fixes 129cf89e5856 ("iavf: rename functions and structs to new name")
---
 drivers/net/ethernet/intel/iavf/iavf.h      | 1 +
 drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)