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 37DBDA050A; Thu, 14 Apr 2022 11:34:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C064540041; Thu, 14 Apr 2022 11:34:36 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id EBB684003F for ; Thu, 14 Apr 2022 11:34:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649928875; x=1681464875; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NIbtj1dxeo8gxv8mNDXj+26PsPf8tRReBHDnG6jlhOg=; b=HGaQeUA5RSk5YKcM1BtHdRGGJDe3xlthrt0o1RuwgA3OcXedaqUyccEi oOQkfet1hJY10HKQDQUeQu3VHQPwo7Jn2iD+u8posNjlbQK3feLZTOYaX GFTPmjm50tiu9oFCd+fEOzjhmKz/dn75nspgg0b5p0Avf2ahT1QtGmNEK eEww1cSf1mAhpfyOTgnDBwjHFkRmNvGUBqns//gLKFmew7Lo/QKJx54eW k/V2X6oqIVbrYatoFIH27ORZM4rptjUGwhFbi8j+qFsmVlq5HTYggU2X8 Qp86QC0c+qCJFo+mJaPNnF2cdiImHHFOMXGzY0//yoGfQF/EGd+XVy5FE w==; X-IronPort-AV: E=McAfee;i="6400,9594,10316"; a="323335513" X-IronPort-AV: E=Sophos;i="5.90,259,1643702400"; d="scan'208";a="323335513" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2022 02:34:34 -0700 X-IronPort-AV: E=Sophos;i="5.90,259,1643702400"; d="scan'208";a="552606129" Received: from unknown (HELO localhost.localdomain) ([10.239.251.104]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2022 02:34:32 -0700 From: Ke Zhang To: xiaoyun.li@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com, dev@dpdk.org Cc: Ke Zhang Subject: [PATCH v2] net/iavf: fix iavf crashed on dev_stop when running in multi-process mode Date: Thu, 14 Apr 2022 09:29:02 +0000 Message-Id: <20220414092902.176462-1-ke1x.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220402095120.637740-1-ke1x.zhang@intel.com> References: <20220402095120.637740-1-ke1x.zhang@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 In the multi process environment, the sub process operates on the shared memory and changes the function pointer of the main process, resulting in the failure to find the address of the function when main process releasing, resulting in crash. Signed-off-by: Ke Zhang --- drivers/net/iavf/iavf_rxtx.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 16e8d021f9..1cef985fcc 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -2822,12 +2822,12 @@ iavf_set_rx_function(struct rte_eth_dev *dev) if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC) use_flex = true; - - for (i = 0; i < dev->data->nb_rx_queues; i++) { - rxq = dev->data->rx_queues[i]; - (void)iavf_rxq_vec_setup(rxq); + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + (void)iavf_rxq_vec_setup(rxq); + } } - if (dev->data->scattered_rx) { if (!use_avx512) { PMD_DRV_LOG(DEBUG, @@ -3002,20 +3002,21 @@ iavf_set_tx_function(struct rte_eth_dev *dev) } #endif - for (i = 0; i < dev->data->nb_tx_queues; i++) { - txq = dev->data->tx_queues[i]; - if (!txq) - continue; + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + for (i = 0; i < dev->data->nb_tx_queues; i++) { + txq = dev->data->tx_queues[i]; + if (!txq) + continue; #ifdef CC_AVX512_SUPPORT - if (use_avx512) - iavf_txq_vec_setup_avx512(txq); - else - iavf_txq_vec_setup(txq); + if (use_avx512) + iavf_txq_vec_setup_avx512(txq); + else + iavf_txq_vec_setup(txq); #else - iavf_txq_vec_setup(txq); + iavf_txq_vec_setup(txq); #endif + } } - return; } -- 2.25.1