DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Du, Frank" <frank.du@intel.com>
To: dev@dpdk.org
Subject: [PATCH v3] net/ice: fix ice_interrupt_handler panic when stop
Date: Mon, 14 Nov 2022 15:03:29 +0800	[thread overview]
Message-ID: <20221114070329.989070-1-frank.du@intel.com> (raw)
In-Reply-To: <20221111062219.874370-1-frank.du@intel.com>

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(-)

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;
 }
 
-- 
2.34.1


  parent reply	other threads:[~2022-11-14  7:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-11  6:22 [PATCH] " Du, Frank
2022-11-11  6:37 ` [PATCH v2] " Du, Frank
2022-11-14  7:03 ` Du, Frank [this message]
2022-11-14 10:20   ` [PATCH v3] " Zhang, Qi Z

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221114070329.989070-1-frank.du@intel.com \
    --to=frank.du@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).