DPDK patches and discussions
 help / color / mirror / Atom feed
From: Junfeng Guo <junfeng.guo@intel.com>
To: jingjing.wu@intel.com
Cc: dev@dpdk.org, stable@dpdk.org, xingguang.he@intel.com,
	kevin.laatz@intel.com, Junfeng Guo <junfeng.guo@intel.com>
Subject: [PATCH v2] raw/ntb: add check for disabling interrupt in dev close ops
Date: Wed, 28 Jun 2023 17:12:18 +0800	[thread overview]
Message-ID: <20230628091218.32292-1-junfeng.guo@intel.com> (raw)
In-Reply-To: <20230614051423.176572-1-junfeng.guo@intel.com>

During EAL cleanup stage, all bus devices are cleaned up properly.
In the meantime, the ntb example app will also do the device cleanup
process, which may call the dev ops '*dev->dev_ops->dev_close' twice.

If this dev ops for ntb was called twice, the interrupt handle for
EAL will be disabled twice and will lead to error for the seconde
time. Like this: "EAL: Error disabling MSI-X interrupts for fd xx"

Thus, this patch added the check process for disabling interrupt in
dev_close ops, to ensure that interrupt only be disabled once.

Fixes: 1cab1a40ea9b ("bus: cleanup devices on shutdown")
Cc: stable@dpdk.org

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
---
 drivers/raw/ntb/ntb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c
index 76e98fe515..0ed4c14592 100644
--- a/drivers/raw/ntb/ntb.c
+++ b/drivers/raw/ntb/ntb.c
@@ -1045,6 +1045,11 @@ ntb_dev_close(struct rte_rawdev *dev)
 	hw->queue_pairs = 0;
 
 	intr_handle = hw->pci_dev->intr_handle;
+	/* Disable interrupt only once */
+	if (!rte_intr_nb_efd_get(intr_handle) &&
+	    !rte_intr_max_intr_get(intr_handle))
+		return 0;
+
 	/* Clean datapath event and vec mapping */
 	rte_intr_efd_disable(intr_handle);
 	rte_intr_vec_list_free(intr_handle);
-- 
2.34.1


  parent reply	other threads:[~2023-06-28  9:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-14  5:14 [PATCH] examples/ntb: remove redundant logic for dev close Junfeng Guo
2023-06-15  8:28 ` Ling, WeiX
2023-06-28  0:12 ` Thomas Monjalon
2023-06-28  2:19   ` Guo, Junfeng
2023-06-28  2:37     ` Guo, Junfeng
2023-06-28  7:53       ` Thomas Monjalon
2023-06-28  8:08         ` Guo, Junfeng
2023-06-28  9:12 ` Junfeng Guo [this message]
2023-06-29  8:03   ` [PATCH v2] raw/ntb: add check for disabling interrupt in dev close ops Ling, WeiX
2023-07-03  6:53   ` Wu, Jingjing
2023-07-03 15:44     ` Thomas Monjalon

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=20230628091218.32292-1-junfeng.guo@intel.com \
    --to=junfeng.guo@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=kevin.laatz@intel.com \
    --cc=stable@dpdk.org \
    --cc=xingguang.he@intel.com \
    /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).