[v3] net/ice: fix ice_interrupt_handler panic when stop

Message ID 20221114070329.989070-1-frank.du@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series [v3] net/ice: fix ice_interrupt_handler panic when stop |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/github-robot: build fail github build: failed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/loongarch-compilation warning apply patch failure

Commit Message

Frank Du Nov. 14, 2022, 7:03 a.m. UTC
  rte_intr_callback_unregister may fail when irq cb is in handling,
use sync version to make sure unregister successfully.

Signed-off-by: Du, Frank <frank.du@intel.com>
---
v3:
* Move rte_intr_callback_unregister_sync to right after irq disable

---
 drivers/net/ice/ice_ethdev.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
  

Comments

Qi Zhang Nov. 14, 2022, 10:20 a.m. UTC | #1
> -----Original Message-----
> From: Du, Frank <frank.du@intel.com>
> Sent: Monday, November 14, 2022 3:03 PM
> To: dev@dpdk.org
> Subject: [PATCH v3] net/ice: fix ice_interrupt_handler panic when stop
> 
> rte_intr_callback_unregister may fail when irq cb is in handling, use sync
> version to make sure unregister successfully.

Added:

Fixes: cf911d90e366 ("net/ice: support link update")
Cc: stable@dpdk.org

> 
> Signed-off-by: Du, Frank <frank.du@intel.com>

Corrected:

s/Du, Frank/Frank Du

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 7294f38edc..0bc739daf0 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2555,12 +2555,17 @@  ice_dev_close(struct rte_eth_dev *dev)
 		return 0;
 
 	/* Since stop will make link down, then the link event will be
-	 * triggered, disable the irq firstly to avoid the port_infoe etc
-	 * resources deallocation causing the interrupt service thread
-	 * crash.
+	 * triggered, disable the irq firstly.
 	 */
 	ice_pf_disable_irq0(hw);
 
+	/* Unregister callback func from eal lib, use sync version to
+	 * make sure all active interrupt callbacks is done, then it's
+	 * safe to free all resources.
+	 */
+	rte_intr_callback_unregister_sync(intr_handle,
+					  ice_interrupt_handler, dev);
+
 	ret = ice_dev_stop(dev);
 
 	if (!ad->is_safe_mode)
@@ -2595,10 +2600,6 @@  ice_dev_close(struct rte_eth_dev *dev)
 	/* disable uio intr before callback unregister */
 	rte_intr_disable(intr_handle);
 
-	/* unregister callback func from eal lib */
-	rte_intr_callback_unregister(intr_handle,
-				     ice_interrupt_handler, dev);
-
 	return ret;
 }