From patchwork Thu Mar 7 07:01:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artemy Kovalyov X-Patchwork-Id: 138082 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 03A8C43B6C; Thu, 7 Mar 2024 08:01:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C347C42DFC; Thu, 7 Mar 2024 08:01:36 +0100 (CET) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2066.outbound.protection.outlook.com [40.107.212.66]) by mails.dpdk.org (Postfix) with ESMTP id E4832402F2 for ; Thu, 7 Mar 2024 08:01:34 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SFl8fcx3sb+75HRhR+S/fFE7nOoUYKDvFzEDyDiHFnV6vFWwjqJ98TycYoPLWontYKIL6etRvzs9v6uMULpkbAjVp4lP90+DCczdDIGKqF+cpdtfoADxEUZEcY5VsdVsFwKYPkbsXsBp7+SXCrznHMfKjw1Knhm8hiy5+s7c3Q8ovu+lJ1Cp9J1SaVXgOmGUUKaikCSkbq2jwErBOWWjWQGRoTyv0ULh52z8TKqIrB9OgGjJ/4D0kp35XZwvKfMzaTlCsSy+kSBeJ5/WqF44f1alMw5tuSXVSuwRgUV53lbb4DxGPQ5Oq4cfnTPWCzSrI5ujVf9w5qW/T1FQmYWo2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=39LIJPcEqqrykURY33B7sIf19sDQ7Am4K69OUzShWr4=; b=T9X7iH66ERnX2zay8zydRBjYmhyKLaYtWS8awx/cObJwDLiReNymvQRkWEyeqLqA6wCScBfWiMTlme8qhfMlmLfIPA4b5oYsVi750PdxirtVLLUz7RbarjUHv/0/6ro4ILkwW1N4k760VTd2+F1gFiy+uqnSwaI8jjV6b9SGbR8av4vLvzIFdxzjg1SwFP+sD/3zNa7R/X8RCAjPX0zOwHdfxpKXFB27gT91q7+7DUyiX9SrqQ3sSe20g0xvBKExRlBo6HUYPxmFM+2qZ4AI0clC89npjzCcou/G4QdzB/quteWuKeDflk52mk6U6QU+ylaz35iE3rPVv0ZnNfBecg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=39LIJPcEqqrykURY33B7sIf19sDQ7Am4K69OUzShWr4=; b=DgPlM0oQzVGm+msFja35vgQxc117sULTV3nLtvudF82AZ8yxZmMY0Br4N8kQFZl/mlC3WjLJS+fBxlqm2EgQP9V2wsz2/tj4tIZ/W1YOshmTWyl6v0vANe85GZqaHNJbqJfkXivHGne9kjyRtwwh8un2VeWvnfkJSabQ///AB4UZsd2x2+XAKinvaCwkt4o6gnrZmk97U7w6uV6dWj5y7/RUP+A7XGJfXhAAsiWz0W/NRjnQ37IPh+A0XVvwStRzYaU0+Hp9q5QsTUnUgvVD4DxFQpK56YSmEcEpgFxw90kYPE39n4osszgloVjAxCeUu0IfuL5ctQA2DUGhk1KTiA== Received: from MW4PR04CA0189.namprd04.prod.outlook.com (2603:10b6:303:86::14) by CH0PR12MB8505.namprd12.prod.outlook.com (2603:10b6:610:193::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.41; Thu, 7 Mar 2024 07:01:32 +0000 Received: from CO1PEPF000044FC.namprd21.prod.outlook.com (2603:10b6:303:86:cafe::77) by MW4PR04CA0189.outlook.office365.com (2603:10b6:303:86::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.26 via Frontend Transport; Thu, 7 Mar 2024 07:01:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000044FC.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.0 via Frontend Transport; Thu, 7 Mar 2024 07:01:32 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 6 Mar 2024 23:01:18 -0800 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Wed, 6 Mar 2024 23:01:18 -0800 Received: from nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12 via Frontend Transport; Wed, 6 Mar 2024 23:01:17 -0800 From: Artemy Kovalyov To: CC: Thomas Monjalon , Anatoly Burakov Subject: [PATCH v2 1/5] app/test-mp: add multiprocess test Date: Thu, 7 Mar 2024 07:01:09 +0000 Message-ID: <20240307070113.29580-2-artemyko@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240307070113.29580-1-artemyko@nvidia.com> References: <20231212042517.164353-2-artemyko@nvidia.com> <20240307070113.29580-1-artemyko@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FC:EE_|CH0PR12MB8505:EE_ X-MS-Office365-Filtering-Correlation-Id: 917d0a1f-80a7-48f6-0a7d-08dc3e746bed X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j4+NAibP3nRsdBvu4qJ212fXuRAqbYveZbkH0H7/IsDNeb+BabyUvM9/JgXDBin5OjbFRBipnNeRzCwc34Ub0tGyjHmQuumwx9bPK1V4veG3oG8K9mjBTnJHjXBeRShURIdTRmtdzDPiiweHztFFwWseE3Tcj0jKLpAAhZX7GPIEZxWnRRUKkvDxjlvt7r9WQUXa+jdNkNgRcEoyYnSq0aMmhbjwk8p+K9YOPFJLNeKE/H0gS/TkML8wIjgbvpiIZFjBL7RylJbteDjzMeVlPuXB8qXmd1l/rNxSAbeJY1vwBl68FeFhuci0pW+HEwXmibxAjCP7EgXXZGc3lKwLhUnibg81iUEG5+F+xgxDLn1AKrD/1Hy3IQkYXRYirCau+3+NUEGIeg+wlSLC3GK/NrJq7SwSHxWR+/Y2tglbU7+cwo49TiyrQlVXzI44g2Y4VvnsbJl4f9e0Q/QV8xnxjOyjaG89XDDJ9v4Jj3eAgq9nZP1NInHIm6pofxyIUrfIplrVnFCNSirCmQ/KqqVfI/+e/XWKS+lA3E4ltjr4V2mPAj8wD5s5GCbkCfddhJp5LRGwmhf3XnTXHqwSoPW0u+Ls4q2gVNs3986D8LRw+oWUO6/CrL9F9Uf/edxLHwezbwJV3EkCg9ynlLaJQBLW/pQ8oCcKNPSbP5GkIEukPPv4g6Mock2JUvgwF2tl3G8N/LITAfnDZSsftO3USbXmsXu+23sP/c/8LlMVrsIg6buflGTxqsaYJzFylXqNsarP X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(376005)(82310400014)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2024 07:01:32.6030 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 917d0a1f-80a7-48f6-0a7d-08dc3e746bed X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044FC.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB8505 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 This commit adds a test scenario that initiates multiple processes concurrently. These processes attach to the same shared heap, with an automatic detection mechanism to identify the primary process. Signed-off-by: Artemy Kovalyov Acked-by: Anatoly Burakov --- app/meson.build | 1 + app/test-mp/main.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ app/test-mp/meson.build | 8 ++++++++ app/test-mp/run.sh | 40 +++++++++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 app/test-mp/main.c create mode 100644 app/test-mp/meson.build create mode 100755 app/test-mp/run.sh diff --git a/app/meson.build b/app/meson.build index 8aaed59..1b80091 100644 --- a/app/meson.build +++ b/app/meson.build @@ -30,6 +30,7 @@ apps = [ 'test-flow-perf', 'test-gpudev', 'test-mldev', + 'test-mp', 'test-pipeline', 'test-pmd', 'test-regex', diff --git a/app/test-mp/main.c b/app/test-mp/main.c new file mode 100644 index 0000000..c2f309e --- /dev/null +++ b/app/test-mp/main.c @@ -0,0 +1,52 @@ +#include +#include +#include + +#include +#include +#include +#include +#include + +static rte_atomic32_t g_count; + +static int +done(const struct rte_mp_msg *msg __rte_unused, const void *arg __rte_unused) +{ + rte_atomic32_dec(&g_count); + return 0; +} + +int +main(int argc, char **argv) +{ + void *p; + int ret; + + ret = rte_eal_init(argc, argv); + RTE_TEST_ASSERT(ret >= 0, "init failed\n"); + + rte_atomic32_set(&g_count, atoi(argv[++ret])); + + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + ret = rte_mp_action_register("done", done); + RTE_TEST_ASSERT_SUCCESS(ret, "register action failed\n"); + } + + p = rte_malloc(NULL, 0x1000000, 0x1000); + RTE_TEST_ASSERT_NOT_NULL(p, "allocation failed\n"); + + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + uint64_t timeout = rte_rdtsc() + 5 * rte_get_tsc_hz(); + + while (rte_atomic32_read(&g_count) > 0) + RTE_TEST_ASSERT(rte_rdtsc() < timeout, "timeout\n"); + } else { + struct rte_mp_msg msg = { .name = "done" }; + + rte_mp_sendmsg(&msg); + } + + rte_eal_cleanup(); + return 0; +} diff --git a/app/test-mp/meson.build b/app/test-mp/meson.build new file mode 100644 index 0000000..99de379 --- /dev/null +++ b/app/test-mp/meson.build @@ -0,0 +1,8 @@ +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + +sources = files('main.c') +deps = ['eal'] diff --git a/app/test-mp/run.sh b/app/test-mp/run.sh new file mode 100755 index 0000000..03a71c7 --- /dev/null +++ b/app/test-mp/run.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +logdir=/tmp/dpdk_test_mp +repeat=1 +lastcore=$(($(nproc) - 1)) +log=1 + +while getopts p:r:lL:d op; do case $op in + p) lastcore=$OPTARG ;; + r) repeat=$OPTARG ;; + L) logdir=$OPTARG ;; + l) log=0 ;; + d) debug=1 ;; +esac done +shift $((OPTIND-1)) + +test=$1 +logpath=$logdir/$(date +%y%m%d-%H%M%S) + +rm -f core.* +pkill dpdk-test-mp + +for j in $(seq $repeat) ; do + [ $log ] && mkdir -p $logpath/$j + pids=() + for i in $(seq 0 $lastcore) ; do + args="-l $i --file-prefix=dpdk1 --proc-type=auto" + if [ $debug ] ; then + args="$args --log-level=lib.eal:8" + fi + if [ $log ] ; then + $test $args $lastcore >$logpath/$j/$i.log 2>&1 & + else + $test $args $lastcore & + fi + pids+=($!) + done + wait ${pids[@]} || { echo iteration $j failed ; break ; } + echo iteration $j passed +done From patchwork Thu Mar 7 07:01:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artemy Kovalyov X-Patchwork-Id: 138083 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C152C43B74; Thu, 7 Mar 2024 08:01:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3134C42E3C; Thu, 7 Mar 2024 08:01:45 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id 16B4242E39; Thu, 7 Mar 2024 08:01:43 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZEKfYso2J7aMn3TvmoidiTDRej4uPLDy1MEr6fK/UrAWkkepdAvbXLQeiUosSSYSaH6Eza1D25kIuXJ4TEOHk42oX/gOGEkMxq/5/8ZA9zQd+pQDT+D2O4aCS9vT2gxoWq90xTY9Q2g6yEcAEkpWznCZyRah6/i+htNgMhd6d/y5X79umxSkU/GtUqDfo/j+7BP3D7Bzg7S7kpWC9W1HMNuHpKK6m4+69h0FJ166DZA0NVK0mmwoQKOC1RnYk4BrszoiGuam1MZNlqpYtUTmI/rsyjp2Xc2pWreSnXtyDAYxjUSu+0n0bRLwc9mEa3Dta87FN42gM1+8xjjpz/bIpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uXP/xKI+n5XBgy8wU7yetcK2IcXDzDrBbsKvPujH7yQ=; b=cblMIb6Ntruwxj6gtqfiqr4uGuYyFIwRGJufDuOP3hNQehdMpJ002gkK/LFRX0aQ1+kH6q1PAvJK86+pBwpyInfmK1/yNfsdxQ7t8ImIusMOsVLmLgy7mHSjggNVBmN+iMOJWifZ/4/bBnCCgnMy3xJyCUZIPm8lyO+LdtIZrvAjw9SmnWPDR7/cAkv1h3fxaVr7schBVByVkwEI1zkgQ54UsZhxtSeaLg+/fXSXLpJvovFIuwU6FJabk0SzwgPl4vF9GgfKaKo6N1KRU/QJ7xc9E12/zXEUlHRcS6WlvZftuSLa4IxVaC37F2NKAEcwc3KmCRMnPHKumRIdTO4jCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uXP/xKI+n5XBgy8wU7yetcK2IcXDzDrBbsKvPujH7yQ=; b=XRioJeqJ9AAvpP5e5wVkftOTdGo7RJ2bmK5B9h+imttMSZrCnYMlLeQFbH4/1l7V42pJP0zOFeDpvDz+c3RZc+ogg2tzP+T5SGX5/jnk7TKj7pyq89xW75+NMAd9TPYpwFudfdDKiVHYUDblsu20Mk3DlRLkiNHkUJwOjq+ecZFtpwgdNUH2owQVNyKfKVEC053R0fSuDSJgE9Vd2CE2U19QFuZyK36N1pImmNopR/YtF8OqWwLyu5yiVx635cb+zmADeq+dbNBC5V1dh5DzTsDMJN+RBfVo15ttiuD3TJnuniKbpOHlCWfap+uNc0pdQPZAOTIR440usOvbTOTrCQ== Received: from MW4PR04CA0271.namprd04.prod.outlook.com (2603:10b6:303:89::6) by SJ0PR12MB6943.namprd12.prod.outlook.com (2603:10b6:a03:44b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.24; Thu, 7 Mar 2024 07:01:40 +0000 Received: from CO1PEPF000044FD.namprd21.prod.outlook.com (2603:10b6:303:89:cafe::5a) by MW4PR04CA0271.outlook.office365.com (2603:10b6:303:89::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.26 via Frontend Transport; Thu, 7 Mar 2024 07:01:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000044FD.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.0 via Frontend Transport; Thu, 7 Mar 2024 07:01:40 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 6 Mar 2024 23:01:23 -0800 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Wed, 6 Mar 2024 23:01:22 -0800 Received: from nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12 via Frontend Transport; Wed, 6 Mar 2024 23:01:21 -0800 From: Artemy Kovalyov To: CC: Thomas Monjalon , , Qi Zhang , Anatoly Burakov Subject: [PATCH v2 2/5] eal: fix multiprocess hotplug race Date: Thu, 7 Mar 2024 07:01:10 +0000 Message-ID: <20240307070113.29580-3-artemyko@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240307070113.29580-1-artemyko@nvidia.com> References: <20231212042517.164353-2-artemyko@nvidia.com> <20240307070113.29580-1-artemyko@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FD:EE_|SJ0PR12MB6943:EE_ X-MS-Office365-Filtering-Correlation-Id: b9cb9508-f4dd-417d-6b28-08dc3e747093 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IYCRoFQvg0QqLu54Wz/c6jPdkK2yvV0IjCBPj6JUtYseqptGBB3Juqdl0qnN8VTjeqtCqbVF13z0lebAh+4RAxZk0lT8X160uJaP+RMz2SdhsVDPIy/3xB+Nzv1d5u0f+RxkCwlq0Qc266SgQhSN507QdUDh6+1v8aVi8zp1EH6RLlCFgIADzgDQCYyYBav9enz2fZm1GC41JUbuTNdgWP7aAdZfXwJjFG5zMh5tCuny7qLQXZor4fYxcBytRuGvC7Li0OXsKLU7EHIpOyndpAMBdn1ENXC625WoA8EjmNpFF1u5bxfheTNBVOe2K6luCdRM5FTJHBPyeORuedbF3oFbOR3in21A3iIkJQ29cnyDu8jhIMuLF9CoMoayXX96lCqNcE/++mfbi+HzPUQnTruqPqtNadS8hAdDNohGRMBu3BHHvgYOCYthMj1aURMpNRHQtxMWbT/ROaX6YFimWQHa+TZGevP/6FMhH119iPdL8A57vXqEcpcig74pdJVxZIYbbLyGzN/CQ/w0+fnvxt1O87B6ECD/ttYP3Ulvw9VDoxjRhgDdvjk3/vmWcvE7XnrP6AILQzx6qdHMIvNMqWN/jz2bHbWoYr1xwytwVL4tHGkXWi7rWEicI9v1sWIahQFpNlEUH6v9qJCVrTv0ls2NezWLPWP56tutzCoztb/coJKU36+Fs0fokTt/LToytsvHc8D3TzcU7NkbWdQurW/bIyAWsoxY2QvCm52p9DIoEAdXb3/v6TZl0feb3nuG X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(376005)(82310400014)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2024 07:01:40.4199 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b9cb9508-f4dd-417d-6b28-08dc3e747093 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044FD.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6943 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 There exists a time gap between the creation of the multiprocess channel and the registration of request action handlers. Within this window, a secondary process that receives an eal_dev_mp_request broadcast notification might respond with ENOTSUP. This, in turn, causes the rte_dev_probe() operation to fail in another secondary process. To avoid this, disregarding ENOTSUP responses to attach notifications. Fixes: 244d5130719c ("eal: enable hotplug on multi-process") Cc: stable@dpdk.org Signed-off-by: Artemy Kovalyov Acked-by: Anatoly Burakov --- lib/eal/common/hotplug_mp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c index 6027819..e6a3f6b 100644 --- a/lib/eal/common/hotplug_mp.c +++ b/lib/eal/common/hotplug_mp.c @@ -428,6 +428,9 @@ int eal_dev_hotplug_request_to_secondary(struct eal_dev_mp_req *req) if (req->t == EAL_DEV_REQ_TYPE_ATTACH && resp->result == -EEXIST) continue; + if (req->t == EAL_DEV_REQ_TYPE_ATTACH && + resp->result == -ENOTSUP) + continue; if (req->t == EAL_DEV_REQ_TYPE_DETACH && resp->result == -ENOENT) continue; From patchwork Thu Mar 7 07:01:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artemy Kovalyov X-Patchwork-Id: 138084 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3083243B6C; Thu, 7 Mar 2024 08:01:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 65CE142E90; Thu, 7 Mar 2024 08:01:51 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2085.outbound.protection.outlook.com [40.107.220.85]) by mails.dpdk.org (Postfix) with ESMTP id 7F3CD42E39; Thu, 7 Mar 2024 08:01:49 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=leDy2/PVsjUJwfyTrNQxxayi9WCT8WoeB2vk9YmmpHy78SI83I5AbpO5ZgutkJs8GAXyg8rAR3Xxdk70xjTlliQpzVumachtH9mtMTfssZBkaHTFYPMNRQHVjPpbukrkNvZBOBhwMVVfCObERwTyXyGirpuw9qRLCHA3rCa9QyEREXBNc6K2IcfAy88b5/JOyuWKWPNne1c51fX77/ywS/OpLwCjxVwSSHHkfjQObL2sqny11C/gQHWqyBHE6UZAfX0jGkEdky6Zlf+iWUVRGehFNBr1dwiOey/Oq9EDTLWpWa9Oy7Ob748cHaq3Ns1mhz9UxNnDlxJyDRHJUDyZfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=efO8i5/RvUD6prZ3xBDdEXD6A+w8LJbcPFsSfgbxYrk=; b=TdMUYjaJdZdV4Of5fpX17ZyQmglf3FVGHmD8RHHXOdRXOM58nBJo7bDi7f7FbMrr2qyzum/Pb8ELqhogFyBKQF8cn3upnuEmGEPQRo/pnKxZFwMkJLV2aAk2EFg3yQRtuc6h5ZAsvlasAg/fp40putdFOseucAQKuxHA5CRMrF0nmHCZHHkCijOI79EhGnsw9PnfOcL/VP4Ma7d/YnADLfJ7AgO70Xs0doc4LRbfhokkTLH+/gU5pasfeweMApuId1HEozL25DU2moEMTL0ZPWv8o5LFU8BAiQMdV+z8Yr5u5tyhfLAq6LNwWkkv6QvUH3fTmdRhUB6+efeNCN9h/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=efO8i5/RvUD6prZ3xBDdEXD6A+w8LJbcPFsSfgbxYrk=; b=MfxGtwoubNR79tkLrFKEC8UHTuFYd96DczGljiJKeeIr5qyVoNJiUomy6JKRelqGe9t8rs1J/yo7XJYtf3ddUeDnyjMhNcqUl02ISAxrMBcUDvI4eZzHH/bdDYwEvxz/eOGUpfQadnboVEI4AjHrErmyDt7EZMvMk7cL/yVdMPOnynrKYUTAL2J6wZ12plUgsbgWkwyJ6UtqANl0xx1bGSfqf7u7rz6L/MzXBDsyVZZxQVm3tYOwfwNvhkT8ouczKARrZ1cY1rINpYUrry2voLTlMy8q4Ipyw5DDlGohgPd4oAF939/o5gq9WCjhVLZOjH8Hm2zIOSAjFpZBQCEKrA== Received: from CH0PR04CA0012.namprd04.prod.outlook.com (2603:10b6:610:76::17) by DS0PR12MB8343.namprd12.prod.outlook.com (2603:10b6:8:fd::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Thu, 7 Mar 2024 07:01:46 +0000 Received: from CH1PEPF0000AD7F.namprd04.prod.outlook.com (2603:10b6:610:76:cafe::4) by CH0PR04CA0012.outlook.office365.com (2603:10b6:610:76::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.27 via Frontend Transport; Thu, 7 Mar 2024 07:01:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH1PEPF0000AD7F.mail.protection.outlook.com (10.167.244.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.11 via Frontend Transport; Thu, 7 Mar 2024 07:01:46 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 6 Mar 2024 23:01:26 -0800 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Wed, 6 Mar 2024 23:01:25 -0800 Received: from nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12 via Frontend Transport; Wed, 6 Mar 2024 23:01:23 -0800 From: Artemy Kovalyov To: CC: Thomas Monjalon , , Anatoly Burakov , David Marchand , Maxime Coquelin Subject: [PATCH v2 3/5] ipc: fix mp channel closure to prevent message loss Date: Thu, 7 Mar 2024 07:01:11 +0000 Message-ID: <20240307070113.29580-4-artemyko@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240307070113.29580-1-artemyko@nvidia.com> References: <20231212042517.164353-2-artemyko@nvidia.com> <20240307070113.29580-1-artemyko@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD7F:EE_|DS0PR12MB8343:EE_ X-MS-Office365-Filtering-Correlation-Id: caeba04d-a7ca-4f88-75d0-08dc3e74742d X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SDFgjMhZbXATjGItPTMzaTGl2S+/7tmeQ2W7FRfvMRAnXLagv0z1c5X6qXPhJDrWENgqcKL7VYxj4ivTazbOfoLG6cJgZkO90I6oXywHWyGEdB0OT8JppEa3vjFDsVo8/b14teR/9H7FAidb+NIHOPdCfzgve9mawUPrqTO4YV9E3AiT0W8mm6JM3b0kpc0VnHPpRgVYYe1pjRL2Qc8Wzg94itrbvY3ZSDPXx3rIp2H7TUvjA8pQBy02bypu6t9BpJwEyBfTyRXfpUhmVegDrgAA5V0WHJG9/Mn5IIpaL2BmpsLob9hapHbp9EFZldNk66EFf4yxqo5D8Uj3pRpa+wIU+89t3QNuLWRPEGBqEs2cvELDfmkwKjCSjWe7oUu0sDc0bFQ5YH4HDqYl1gRYM72mn8kV9oVEB3AdRwPzM2ZnzhrYzPa5zSAQ7ucDePKoQX8HP9IlezR7ViQVdMNpuju/EkBksCTlT8lG9JXKQTpJQz6hgHkywERbTiAnGpnLsEt7nQhJZa1WJjFEo3DB3hpKtqqPVBu5xPCEhjQqNbRbJdiWZxORyJDrGQ56tTj4nhs4KL/jsjJ6mbQ59mnnp2joBJSdfl+6o7lqWIGsn9qlmNZvSK5SrgJctdiPDotwIY7otG3vegdsPuZFQP5QnEXLgrIC5J+LRfmiGy+pvun1OT5ouCW5w4yIOGz5g/Qujng2efL2EuZgFOvR2/dC4RpOW5U5ienD4yseelwU8SwD2Y4HTk2XQ7Wv/DAf/5im X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(36860700004)(376005)(82310400014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2024 07:01:46.4313 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: caeba04d-a7ca-4f88-75d0-08dc3e74742d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000AD7F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8343 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 This commit addresses an issue related to the cleanup of the multiprocess channel. Previously, when closing the channel, there was a risk of losing trailing messages. This issue was particularly noticeable when broadcast message from primary to secondary processes was sent while a secondary process was closing it's mp channel. In this fix, we delete mp socket file before stopping mp receive thread. Fixes: e7885281ded1 ("ipc: stop mp control thread on cleanup") Cc: stable@dpdk.org Signed-off-by: Artemy Kovalyov Acked-by: Anatoly Burakov --- lib/eal/common/eal_common_proc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c index 728815c..d34fdda 100644 --- a/lib/eal/common/eal_common_proc.c +++ b/lib/eal/common/eal_common_proc.c @@ -593,7 +593,7 @@ enum async_action { } static void -close_socket_fd(int fd) +remove_socket_fd(int fd) { char path[PATH_MAX]; @@ -672,9 +672,9 @@ enum async_action { if (fd < 0) return; + remove_socket_fd(fd); pthread_cancel((pthread_t)mp_handle_tid.opaque_id); rte_thread_join(mp_handle_tid, NULL); - close_socket_fd(fd); } /** From patchwork Thu Mar 7 07:01:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artemy Kovalyov X-Patchwork-Id: 138086 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AD1AD43B6C; Thu, 7 Mar 2024 08:02:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3247A42E82; Thu, 7 Mar 2024 08:01:57 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2061.outbound.protection.outlook.com [40.107.244.61]) by mails.dpdk.org (Postfix) with ESMTP id 7C39742E94; Thu, 7 Mar 2024 08:01:53 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jswb97msk91n+08AMUA54UbD84OuegpJQH2XOSnp+p4IbX+823On8jQxA8pKSiwoPJ0rv4kyJrxjkGk4OPUsqP/UTzyd4GD+PJ4plhh+2N6pDS6C3eySNhDkUEew7haJkenzay6QoxROI71gkcepyWnQxRst7FDFLDvx6tLi4S2NVi2YZlx+htStdKjaqtnaFGIkAgF8bB4RW6F0lkQirl4ejzLFTMqNnq4RVVFOqa3WbSUrtjxRwqmd4DvzWhK+IGkwe8pcmFKsA0YC6DEphsTH9z0nFNkiPyPTz3UQkyfEdUxzD4IZ4eJTvlxMPRLs1slkYkm1MZiQFb/GeL8sBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BRe2Bi1f/4Zz0mqYB/6kBl84T8JJ/Ma2hR8DDRJGVow=; b=F7hzuxJSAUygsGFFpbuIqyi4eUrUL2vxW/y3D255uB1HSFFSrZqdZur5L3cg6Bm9oQXNFZaWmZecutCKDASTm8obBPLey7tY45TuzCGmxQ69Gt/bGb+htqtgS3RXsSOTZDMQbx+hJXNDRXXqjg9vg8yyANWqVNQUct4FXeeV+H/VQqJqlzcxgVLoMynsZAn/AG74RkOy4In4+zLhrEaXbHs0+p7Yws6u6ebKKWmxOl3ITJpAekA3/NfNyicKiSHnvpQVZBDCR8BaWk9+KrnlCHedQ7/3/kNms5Ia1BhuiW3FKii2CFQ/fQwaxEcwJaDTy1kREDednr1p/9R6o96YTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BRe2Bi1f/4Zz0mqYB/6kBl84T8JJ/Ma2hR8DDRJGVow=; b=X0tYslezMYXhTkXSkY0AAm73UeDwkwvqvicG8kPN1jrZvWTGTDFZ/+8+jEY/GlSVfsELE43a62pD18v7XZwRi30w93bB5JYAIGrPEESy1PAHtefiqbrJtX8pHNp5me3DUMuI/xK2gofjfHYAqXkfsNuFFIoswBSBlMKwQmsoJgxS28lEWBQzxoegqnokvMO/syserB89PbhUKxT7N/ePC5XkMdgfZtkCPf3XIsjMptIRYrwiTh1pqmjWkcIkjBzcACwykjrSoGC1Oi+JiXqY2mMmOTWGhdpuKBqT5qlPANmXrfcnPmydyCZYNWwAi/6hxJ89xp9K5u5izIQ40sv1IQ== Received: from CH0PR04CA0026.namprd04.prod.outlook.com (2603:10b6:610:76::31) by DS7PR12MB8419.namprd12.prod.outlook.com (2603:10b6:8:e9::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Thu, 7 Mar 2024 07:01:51 +0000 Received: from CH1PEPF0000AD7F.namprd04.prod.outlook.com (2603:10b6:610:76:cafe::55) by CH0PR04CA0026.outlook.office365.com (2603:10b6:610:76::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.24 via Frontend Transport; Thu, 7 Mar 2024 07:01:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH1PEPF0000AD7F.mail.protection.outlook.com (10.167.244.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.11 via Frontend Transport; Thu, 7 Mar 2024 07:01:50 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 6 Mar 2024 23:01:32 -0800 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Wed, 6 Mar 2024 23:01:31 -0800 Received: from nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12 via Frontend Transport; Wed, 6 Mar 2024 23:01:30 -0800 From: Artemy Kovalyov To: CC: Thomas Monjalon , Subject: [PATCH v2 4/5] eal: fix first time primary autodetect Date: Thu, 7 Mar 2024 07:01:12 +0000 Message-ID: <20240307070113.29580-5-artemyko@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240307070113.29580-1-artemyko@nvidia.com> References: <20231212042517.164353-2-artemyko@nvidia.com> <20240307070113.29580-1-artemyko@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD7F:EE_|DS7PR12MB8419:EE_ X-MS-Office365-Filtering-Correlation-Id: 4bb95190-8625-43c0-7f91-08dc3e7476bf X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2QbuQy4mC6VhQtkoYAkFKNQDBWpP1JqKJwKBzEsuXlQi0ILar710+9IEYM+4X0lh7auuIOz/MiGo1ojNvnKHa7+pBP8wqrlfo/41o9XwMpuJ8ARQqcl8AeVdxaXT0S6O6k5whZ5gJo8Nw6SAJ28cTTsQ/f1+AhUWA6p2kQUKs3pYcKIApfO920GpQVioGOrDZa51ZQaUs9DwpTE81BTBWTQtKLT/1CexNdyVSEl89o0V50rQ/9Xyonj64MfYpYT7HvkGO+WqUt0FrGMOkUbYB4owG5AktsFQECxX31z0ZClCEREgEC/uY47WHOspkRxQaUOcC6oal1uV6h62AJTO3Jeh2EHi+VqrsIPMU1GkqW55vKd+RpX8VB0+U7gGSdHLvADztO6VGUWYZWnQkh1xZ802klGNAzCwSfq+riWv/qrBLV7DYkTnPEsHy5xWmRL7bhqcnsDgJ1R14kt5BZT0JAmLtl5w95T4y7sojwVpIsrYXtE7K8dV33Y9xxcPmbhbjDgfviQnB1ITRfkt3tvQRsE8Xe9kmCG/qKXjdiv30LDcqOjAodB7OKRBxK05m0oPGzuu3swh5gV8jNzhCk6F3PZTKqCppSlrP7PEHF8YkrNQLfS4zu99F98buklX4FemffZE52H4o09maM0s3L+57P8qMxvuUlO+NZc290dklS5W0cCtm0FwYKQ1FQR8Jz3DguFxsS4vHdNs0fBNUleV7w4/JLaa9C7jrd/YHy1pEk2dsRcaf1NeBA8xqJsAKF9l X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(36860700004)(376005)(82310400014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2024 07:01:50.7439 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4bb95190-8625-43c0-7f91-08dc3e7476bf X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000AD7F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8419 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 If the configuration file is absent, the autodetection function should generate and secure it. Otherwise, multiple simultaneous openings could erroneously identify themselves as primary instances. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Artemy Kovalyov Acked-by: Anatoly Burakov --- lib/eal/linux/eal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index 57da058..9b59cec 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -360,7 +360,7 @@ enum rte_proc_type_t * keep that open and don't close it to prevent a race condition * between multiple opens. */ - if (((mem_cfg_fd = open(pathname, O_RDWR)) >= 0) && + if (((mem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0600)) >= 0) && (fcntl(mem_cfg_fd, F_SETLK, &wr_lock) < 0)) ptype = RTE_PROC_SECONDARY; } From patchwork Thu Mar 7 07:01:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artemy Kovalyov X-Patchwork-Id: 138085 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 36F1F43B6C; Thu, 7 Mar 2024 08:02:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 71B9E42E9F; Thu, 7 Mar 2024 08:01:55 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2076.outbound.protection.outlook.com [40.107.237.76]) by mails.dpdk.org (Postfix) with ESMTP id B341B42E39; Thu, 7 Mar 2024 08:01:52 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GUmjGm8syZHkGb+x8dCkPwcUErOuq1VNtGa0QQN3t7KTitW6D6Uqu8M2qJ8ZF+M7qOpVkDSzm3hXoRIVMnppQU8oEwecpyn67PXBzlvGudW99Rl8zvLj3N+TNZuoMLAllwCAUusbg5L55TDUE2rtybx6oqql2Fu5awMzjqDth/AXBptIiVvpczR1iA3I7v+2lYN+A/UcCcQnrydT30/G5axrHs4Npo4HQExbrf8/AeOI1vTMp5Cjv0A0aGhbi95K6bPnjD6HMBEwTuQ56BVzWaUyE8oZ7ynSW9mrgbToSjg+fbuDoQ031fgZl5m6hHOX9CusOiYQU2kOcCC26NOXDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hPncIhh389T5CImwB8mRjza68jNeLrk+md45s5u3sL8=; b=a1FZBTfASiLOCG0QbAmjLgT14CmDaPr/FgLFM8IygDyYBWGbD7MLU1Z/Y1v87GbMloiRBySDxMmkXhs591FTsCt8mnbFnBFbv1SpD5QjQvzxq9dM2+QJ9NvWjsa24N/t8C1MNGAOru2k9GSi5ZZEs4ehAZtbCrJW4PWv6UAWeNt2y/4sl0vQTI3pW06dJUxcbndgCGVXVMa4EkS3/SbsT4Oz+vNOB95Mkyze461oDvmH0Tszt7T6pvQSQgwjpqOO9ah3tkYX6ectoI7wanu5tr6abcq1yqvDaPl3xRNhGMgyb+E6garIlZdcfXDUEHYrwy8MaCUBwWOXab/8VCwNug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hPncIhh389T5CImwB8mRjza68jNeLrk+md45s5u3sL8=; b=eX/coM1di9GdUps0bCZahYxlGBWtQ1nXt6TJjYPM67/X9WAFwFrE3hbIR/SfXbZ2DjztQUb+NLpbTbfEhUEAeowjFUY14UNTWDJ0/b8ed8YxvII+VlJ65Au++jvdRmlsNxH0qVhT8XRqm8xkjQhI/qXxLT9ZTW6Xbv6sOTYGU6RW3GqWpKSu4/vc4TIdojCAEVJf5b7wUtJvNhTxnjtXd++javoONlvNgD5HnGOQYmJ8xITVv+onPn3DUGQyph0PJ1/4oz3CDrVhd7SGc5UgpsJh1eSWsGO8WbViUhayMLp0nmqPSlFOoyKCA/eJQs2KlS+nNeemYBscf5ZhkqgwZA== Received: from MW4PR04CA0191.namprd04.prod.outlook.com (2603:10b6:303:86::16) by BY5PR12MB4067.namprd12.prod.outlook.com (2603:10b6:a03:212::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.27; Thu, 7 Mar 2024 07:01:50 +0000 Received: from CO1PEPF000044FC.namprd21.prod.outlook.com (2603:10b6:303:86:cafe::d3) by MW4PR04CA0191.outlook.office365.com (2603:10b6:303:86::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.26 via Frontend Transport; Thu, 7 Mar 2024 07:01:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000044FC.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.0 via Frontend Transport; Thu, 7 Mar 2024 07:01:49 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 6 Mar 2024 23:01:34 -0800 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Wed, 6 Mar 2024 23:01:33 -0800 Received: from nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12 via Frontend Transport; Wed, 6 Mar 2024 23:01:32 -0800 From: Artemy Kovalyov To: CC: Thomas Monjalon , , Anatoly Burakov Subject: [PATCH v2 5/5] eal: fix memzone fbarray cleanup Date: Thu, 7 Mar 2024 07:01:13 +0000 Message-ID: <20240307070113.29580-6-artemyko@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240307070113.29580-1-artemyko@nvidia.com> References: <20231212042517.164353-2-artemyko@nvidia.com> <20240307070113.29580-1-artemyko@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FC:EE_|BY5PR12MB4067:EE_ X-MS-Office365-Filtering-Correlation-Id: 375094a6-b0ec-4ea1-6386-08dc3e747630 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QC5zE8ht/IJGef7me8DFwDsVrp8JhZSW3ShMyCM6GuAGGLhbwLeUxiZgCcw6GdXai/JHICafF3mp10R01LM7TTWc2zXbTOtWPZltq/t2jm5v1tCb6mkMSQLP5TICUFd6vZvYzItcUT+294/YQhakYMLebkizlM7xC/TJwTLviO+BM0xxP8BChOCEFTCSNZ/gkagDMiJvVbd/PhsBFMscUhn0Kmt3oG+m6oDFquI4yli2aUGziFuCbOW3VrBNUOAF9Y+WEangc4bAUccOLxtXtk8EuGnqHC3miKtm+jaQO0kSL/Sa8eIU/U/uvYu/DbTnea6ByftNQn2Nm0imphJ+g+Ilos6TGRCwLHl8TD4qBzSC4Mk2mjgRTpbKbDx+l7R1bPO42tSPCcqzXa5PbdgAGub9KQ6kTxwR/L4K/dlYISNvN8RkcvGkCwrK/2qPqRSGzskdc8CKImxW5l1W5o5KpIu+3lrDXdkth1rIogRCIeIc38Fan4abbGi0gKnAdDZLoufPsiPdZuFdt46Vil+8TxWdOWa46oywpWX50t/zpsBisfnLoKbnx+fxKL708ySijxFRS4L5wH0S8dScSLXKtk9l1+TFV5clMZ5SQQRoNQheBnnTWY/AvWnxHoLrKA/w3hF8UuuwUBtGx69B34RtdCVZTN5UksFilac0Pr0Gee+YUxumm1+rwMN32PeDdfutn+lJAKpyIIivD2VIZDH2zGoUGD71W/bNHc8cP8XIrmv6myL9BbRCcLYgDfxnKRj+ X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(36860700004)(376005)(82310400014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2024 07:01:49.8372 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 375094a6-b0ec-4ea1-6386-08dc3e747630 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044FC.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4067 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 The initialization of the Memzone file-backed array ensures its uniqueness by employing an exclusive lock. This is crucial because only one primary process can exist per specific shm_id, which is further protected by the exclusive EAL runtime configuration lock. However, during the process closure, the exclusive lock on both the fbarray and the configuration is not explicitly released. The responsibility of releasing these locks is left to the generic quit procedure. This can lead to a potential race condition when the configuration is released before the fbarray. To address this, we propose explicitly closing the memzone fbarray. This ensures proper order of operations during process closure and prevents any potential race conditions arising from the mismatched lock release timings. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Artemy Kovalyov Acked-by: Anatoly Burakov --- lib/eal/common/eal_common_memzone.c | 12 ++++++++++++ lib/eal/common/eal_private.h | 5 +++++ lib/eal/linux/eal.c | 1 + 3 files changed, 18 insertions(+) diff --git a/lib/eal/common/eal_common_memzone.c b/lib/eal/common/eal_common_memzone.c index 1f3e701..7db8029 100644 --- a/lib/eal/common/eal_common_memzone.c +++ b/lib/eal/common/eal_common_memzone.c @@ -447,6 +447,18 @@ return ret; } +void +rte_eal_memzone_cleanup(void) +{ + struct rte_mem_config *mcfg; + + mcfg = rte_eal_get_configuration()->mem_config; + + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + rte_fbarray_destroy(&mcfg->memzones); + } +} + /* Walk all reserved memory zones */ void rte_memzone_walk(void (*func)(const struct rte_memzone *, void *), void *arg) diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h index 4d2e806..944c365 100644 --- a/lib/eal/common/eal_private.h +++ b/lib/eal/common/eal_private.h @@ -81,6 +81,11 @@ struct rte_config { int rte_eal_memzone_init(void); /** + * Cleanup the memzone subsystem (private to eal). + */ +void rte_eal_memzone_cleanup(void); + +/** * Fill configuration with number of physical and logical processors * * This function is private to EAL. diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index 9b59cec..dfcbe64 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -1375,6 +1375,7 @@ static void rte_eal_init_alert(const char *msg) eal_trace_fini(); eal_mp_dev_hotplug_cleanup(); rte_eal_alarm_cleanup(); + rte_eal_memzone_cleanup(); /* after this point, any DPDK pointers will become dangling */ rte_eal_memory_detach(); rte_eal_malloc_heap_cleanup();