From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B762C42D7E; Wed, 28 Jun 2023 11:12:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A3D2F40151; Wed, 28 Jun 2023 11:12:33 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 4A55E400EF; Wed, 28 Jun 2023 11:12:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687943552; x=1719479552; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Iul6MbfnEnWqwaK58IwT5UNz5tLNu7KeWCPzp0K81gw=; b=PZyUobacZcyW+4z/RFlyrBMDiDSt/xPvhB8WOe1MxjP8Me7sgQbwV3hn wZKRFF6RqBRxUeRIbis0RSSDq125XeWkTRnxtkzicAxVvBP/DA7I1J4aw XzskgpAuaZriLVLBM4mdVg8iysXk5QqD++9HU30DsSswDHJ3HJ/frNSD4 04shG/VOF2LDhOSaluu7WEnVa5AoXMYZmvGSyNmDdRLAywVXx1CgU+Yqx NJJYPNqWEjXFhzCz6FTj890B7QOcKLr9kJgHV3KYKqSfBqOGpDG5lnc0C dL9hbveVYd6+kZCESjclO2NsEBY0emaQiIcsCNDI4bhRSd/5xLV2hh8uZ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="448179250" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="448179250" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2023 02:12:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="806826490" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="806826490" Received: from dpdk-jf-ntb-one.sh.intel.com ([10.67.111.149]) by FMSMGA003.fm.intel.com with ESMTP; 28 Jun 2023 02:12:24 -0700 From: Junfeng Guo To: jingjing.wu@intel.com Cc: dev@dpdk.org, stable@dpdk.org, xingguang.he@intel.com, kevin.laatz@intel.com, Junfeng Guo Subject: [PATCH v2] raw/ntb: add check for disabling interrupt in dev close ops Date: Wed, 28 Jun 2023 17:12:18 +0800 Message-Id: <20230628091218.32292-1-junfeng.guo@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614051423.176572-1-junfeng.guo@intel.com> References: <20230614051423.176572-1-junfeng.guo@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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