From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id D96291DB8 for ; Fri, 29 Mar 2019 06:10:17 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Mar 2019 22:10:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,283,1549958400"; d="scan'208";a="135802897" Received: from ultraviolet.igk.intel.com ([10.102.17.137]) by fmsmga008.fm.intel.com with ESMTP; 28 Mar 2019 22:10:13 -0700 From: Darek Stojaczyk To: dev@dpdk.org Cc: james.r.harris@intel.com, changpeng.liu@intel.com, Darek Stojaczyk , anatoly.burakov@intel.com, thomas@monjalon.net Date: Fri, 29 Mar 2019 06:09:51 +0100 Message-Id: <20190329050951.153202-1-dariusz.stojaczyk@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] fbarray: fix attach deadlock X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Mar 2019 05:10:18 -0000 rte_fbarray_attach() currently locks its internal spinlock, but never releases it. Secondary processes won't even start if there is more than one fbarray to be attached to - the second rte_fbarray_attach() would be just stuck. Fix it by releasing the lock at the end of rte_fbarray_attach(). I believe this was the original intention. Fixes: 5b61c62cfd76 ("fbarray: add internal tailq for mapped areas") Cc: anatoly.burakov@intel.com Cc: thomas@monjalon.net Signed-off-by: Darek Stojaczyk --- lib/librte_eal/common/eal_common_fbarray.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c index 0e7366e5e..5ca8d6f0e 100644 --- a/lib/librte_eal/common/eal_common_fbarray.c +++ b/lib/librte_eal/common/eal_common_fbarray.c @@ -906,6 +906,7 @@ rte_fbarray_attach(struct rte_fbarray *arr) /* we're done */ + rte_spinlock_unlock(&mem_area_lock); return 0; fail: if (data) @@ -913,6 +914,7 @@ rte_fbarray_attach(struct rte_fbarray *arr) if (fd >= 0) close(fd); free(ma); + rte_spinlock_unlock(&mem_area_lock); return -1; } -- 2.17.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 3B232A0679 for ; Fri, 29 Mar 2019 06:10:21 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 032532BD3; Fri, 29 Mar 2019 06:10:20 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id D96291DB8 for ; Fri, 29 Mar 2019 06:10:17 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Mar 2019 22:10:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,283,1549958400"; d="scan'208";a="135802897" Received: from ultraviolet.igk.intel.com ([10.102.17.137]) by fmsmga008.fm.intel.com with ESMTP; 28 Mar 2019 22:10:13 -0700 From: Darek Stojaczyk To: dev@dpdk.org Cc: james.r.harris@intel.com, changpeng.liu@intel.com, Darek Stojaczyk , anatoly.burakov@intel.com, thomas@monjalon.net Date: Fri, 29 Mar 2019 06:09:51 +0100 Message-Id: <20190329050951.153202-1-dariusz.stojaczyk@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] fbarray: fix attach deadlock X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190329050951.qROySBAjLUN0XQkYh8pZcsT6YT_nzk29WyISLe4lfUQ@z> rte_fbarray_attach() currently locks its internal spinlock, but never releases it. Secondary processes won't even start if there is more than one fbarray to be attached to - the second rte_fbarray_attach() would be just stuck. Fix it by releasing the lock at the end of rte_fbarray_attach(). I believe this was the original intention. Fixes: 5b61c62cfd76 ("fbarray: add internal tailq for mapped areas") Cc: anatoly.burakov@intel.com Cc: thomas@monjalon.net Signed-off-by: Darek Stojaczyk --- lib/librte_eal/common/eal_common_fbarray.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c index 0e7366e5e..5ca8d6f0e 100644 --- a/lib/librte_eal/common/eal_common_fbarray.c +++ b/lib/librte_eal/common/eal_common_fbarray.c @@ -906,6 +906,7 @@ rte_fbarray_attach(struct rte_fbarray *arr) /* we're done */ + rte_spinlock_unlock(&mem_area_lock); return 0; fail: if (data) @@ -913,6 +914,7 @@ rte_fbarray_attach(struct rte_fbarray *arr) if (fd >= 0) close(fd); free(ma); + rte_spinlock_unlock(&mem_area_lock); return -1; } -- 2.17.1