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 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 --- 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 -- 1.8.3.1