From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 6AB6E37A4 for ; Tue, 8 Mar 2016 18:09:09 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 08 Mar 2016 09:07:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,557,1449561600"; d="scan'208";a="932333717" Received: from sie-lab-212-120.ir.intel.com (HELO silpixa00394367.ir.intel.com) ([10.237.212.120]) by fmsmga002.fm.intel.com with ESMTP; 08 Mar 2016 09:07:30 -0800 From: Harry van Haaren To: david.marchand@6wind.com Date: Tue, 8 Mar 2016 17:07:04 +0000 Message-Id: <1457456825-28667-2-git-send-email-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1457456825-28667-1-git-send-email-harry.van.haaren@intel.com> References: <1457352177-12567-1-git-send-email-harry.van.haaren@intel.com> <1457456825-28667-1-git-send-email-harry.van.haaren@intel.com> Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH v7 1/2] eal: fix race-condition in pri/sec proc startup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Mar 2016 17:09:09 -0000 This patch fixes a race-condition when a primary and secondary process simultaneously probe PCI devices. This is implemented by moving the rte_eal_mcfg_complete() function call in rte_eal_init() until after rte_eal_pci_probe(). The end result is that the secondary process waits longer, until the primary has completed its PCI probing, and then notifies the secondary process. This race-condition became visible during the development of a function that allows a secondary process to be polling until a primary process exists. The secondary would then probe PCI devices at the same time, causing an error during rte_eal_init() Linux EAL: Fixes: 916e4f4f4e45 ("memory: fix for multi process support") BSD EAL: Fixes: 764bf26873b9 ("add FreeBSD support") Signed-off-by: Harry van Haaren --- lib/librte_eal/bsdapp/eal/eal.c | 6 +++--- lib/librte_eal/linuxapp/eal/eal.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index a34e61d..06bfd4e 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * Copyright(c) 2014 6WIND S.A. * All rights reserved. * @@ -569,8 +569,6 @@ rte_eal_init(int argc, char **argv) eal_check_mem_on_local_socket(); - rte_eal_mcfg_complete(); - if (eal_plugins_init() < 0) rte_panic("Cannot init plugins\n"); @@ -621,6 +619,8 @@ rte_eal_init(int argc, char **argv) if (rte_eal_pci_probe()) rte_panic("Cannot probe PCI\n"); + rte_eal_mcfg_complete(); + return fctret; } diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index ceac435..364f303 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * Copyright(c) 2012-2014 6WIND S.A. * All rights reserved. * @@ -821,8 +821,6 @@ rte_eal_init(int argc, char **argv) eal_check_mem_on_local_socket(); - rte_eal_mcfg_complete(); - if (eal_plugins_init() < 0) rte_panic("Cannot init plugins\n"); @@ -880,6 +878,8 @@ rte_eal_init(int argc, char **argv) if (rte_eal_pci_probe()) rte_panic("Cannot probe PCI\n"); + rte_eal_mcfg_complete(); + return fctret; } -- 2.5.0