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 C6329436CB; Tue, 12 Dec 2023 05:25:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD36C42DD5; Tue, 12 Dec 2023 05:25:35 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id 2AB7142DC7 for ; Tue, 12 Dec 2023 05:25:34 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gg0Yl/bokoipJCi2YCxqXqTU5Je6nx9YDmw9C5gSiTK2yrK3KEKDZHL9ALJotT3prtmbZGf2ZoXCznyatL5suk5pbCd9NCfKH84dRKas5R2ZwG+QmmA00qFKSHdICtqi1dlogQJjnyjdmeNXaCmKK0jqv4pnKacDhxN4ajEIO4mtD5WtSPCn4RwNN1yo9KLHwQ9BKKahSyGxF7iCOHM9Gqfh4+2T05szBhnsgNVFTYP9eTAqg9Wy5JeOxB3/X3V9Y3e8e4mkpN5a4QrcEZX5VabbBnjyHX9eJgF31mfja8EoZAOn3BdJK8lVKZ9O/dFJtgr29CrskkOod83VFWUjuQ== 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=rMHyOMYkFDq/NevqLigOn8l4MYpPrChK5G4e8kSel0E=; b=fZBHeKnn7zSWbI35jCtYYh/B1T0mLWShhr4zaU379KLvVSozZjdm0pMCQabjr484+9ZgyMjU80LmNQSKxC/Btp771yKbnbkbW/rtnwhIy3QsVV4hK3eO6NfOFmeV6fu8EYJX+pwFheIPhkLt9GQ9lnwKXAnQCwxL+peZZXMaBu7BPLIB0aXeqY5Ktrxtm2qyUTDJEf6/1XBXojsAjuZx30sU3H4hRe1aLTgb5iqNbBOH39FIrZDGgEZwPI3aO036K5ruCROYqrQFMO8VMOlRSF7iZNPQwCyVDZdd/A3+t5NBwMxWDCD7d8+BQqXUeJm0QB9vOapbfVCuA9nCQ8Kkew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) 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=rMHyOMYkFDq/NevqLigOn8l4MYpPrChK5G4e8kSel0E=; b=fLMnG/mKFj7xFTcuX4O7+EzcaC39D9SlfK8nTHoibCxDamDrO/s/inJfEICetJQD+g+P9AinkQIqcZizmWMMKb5cDHctXjV2iWwbL3jKuXhN/9T3OHzcdp+r3tMyG7s+/RXpQfVJgjxU8peIwCIl5Y408D+CicJa7H98KHB3E5AUn5on/niqX1PdUMqvWPNMd7dh8MTIfIRzSGV7061VKahrJNNct4nCZ5/f6e53RyBRy6cYe51P6ohJoFfCYL6DU+q4t1MXngDkP+f0TioS2wGL31U07tRsjr6Bf5GhPN/wLk3uNVdj3ixrraZmzwIv+1E7Qio+VMGt26Spn8NAkA== Received: from PH0PR07CA0115.namprd07.prod.outlook.com (2603:10b6:510:4::30) by SA1PR12MB7037.namprd12.prod.outlook.com (2603:10b6:806:24c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Tue, 12 Dec 2023 04:25:32 +0000 Received: from SA2PEPF000015CA.namprd03.prod.outlook.com (2603:10b6:510:4:cafe::39) by PH0PR07CA0115.outlook.office365.com (2603:10b6:510:4::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.33 via Frontend Transport; Tue, 12 Dec 2023 04:25:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF000015CA.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.18 via Frontend Transport; Tue, 12 Dec 2023 04:25:31 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 11 Dec 2023 20:25:21 -0800 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 11 Dec 2023 20:25:21 -0800 Received: from nvidia.com (10.127.8.9) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41 via Frontend Transport; Mon, 11 Dec 2023 20:25:20 -0800 From: Artemy Kovalyov To: CC: Thomas Monjalon , Anatoly Burakov Subject: [PATCH 1/5] app/test-pm: add multiprocess test Date: Tue, 12 Dec 2023 06:25:12 +0200 Message-ID: <20231212042517.164353-2-artemyko@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231212042517.164353-1-artemyko@nvidia.com> References: <20231212042517.164353-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: SA2PEPF000015CA:EE_|SA1PR12MB7037:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d70a68c-ffe6-4769-e3d7-08dbfaca60cf 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: G320wt18uOl/f1p8FBZNX2GdZQWY29c4PPoiqvQUiHfCIRq+QYTAvob43sDorI+PgAblT8dlPm1E3chGaj+0SKgjOECY9umRfLAfkDIvgLhDVVoyuH4rVp+rfRgfRG4LnMTLh5Bq9AolCs/tFUJk5OJ5TPlbxuV82kaLxKdGD2PnsgenKvXTo0HDbjFbMzaXLSTMWTSkA4Go/anResI7ZsEiFyyuHw/UuM7g3XB08HQcsu19qD1Vn2SKqD7LcNEB7xuQyMEBo+InjC2ZzaTruvgL1bYm6fqEAVwHys4+VFR88ZrpzE9KL1GV2aJEFo/CoRDfNgM4FbllliCuJA0NE+Rr/nnAwSGEi09T9ZfR5V3roavLJX8bz3JJhhw+kJEutTLo5I0u70FduzJEWnPsGJ0RVvDi6ZgGGT5tacCEddKhPYvbo4CbkctQ0sJfh+1GkYOgrj/Z8vOlQSHXoxprTMDeb7BMrEwodpxWlWJZCnHzhxUe3f8/cg2XUVwgGnFfJIsl6bZ6AUzXSjgEUegp+VRbCE25hSxQzbwsq6en7r2fgisswYisjKdWC7MrLA9ovCJMW+mzj856F7Y4XKNTQOBaKgiwVRsy/QZ7ob3w9g08iT5EJq/wOtlJc2amJS3wMNl8EhVa5Do2eaucd//VjAOGFxS28DbfKVSCEcMhQPIhH8F9YVKilmJ9YpKrsQyJrKkYX8R932Wiwg5/QS+uEVgCkl6R8JNgrRrBkq3nxDP99XfFPHPPAgE4AsxQnRiw X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(376002)(39860400002)(346002)(396003)(136003)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(82310400011)(36840700001)(40470700004)(46966006)(40460700003)(2906002)(41300700001)(36860700001)(86362001)(36756003)(82740400003)(2616005)(356005)(83380400001)(336012)(1076003)(426003)(6286002)(26005)(478600001)(7696005)(47076005)(6666004)(4326008)(5660300002)(316002)(70586007)(8936002)(6916009)(70206006)(54906003)(7636003)(8676002)(55016003)(40480700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2023 04:25:31.6381 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8d70a68c-ffe6-4769-e3d7-08dbfaca60cf X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015CA.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7037 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 | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ app/test-mp/meson.build | 8 ++++++++ app/test-mp/run.sh | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 97 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..0a0fbbf --- /dev/null +++ b/app/test-mp/main.c @@ -0,0 +1,49 @@ +#include +#include + +#include +#include +#include + +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); + assert(ret >= 0); + + rte_atomic32_set(&g_count, atoi(argv[++ret])); + + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + ret = rte_mp_action_register("done", done); + assert(ret == 0); + } + + p = rte_malloc(NULL, 0x1000000, 0x1000); + assert(p); + + 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) + assert(rte_rdtsc() < timeout); + } 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..feb9e20 --- /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'] # , 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline'] diff --git a/app/test-mp/run.sh b/app/test-mp/run.sh new file mode 100755 index 0000000..8de07e2 --- /dev/null +++ b/app/test-mp/run.sh @@ -0,0 +1,39 @@ +#!/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 + 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 + done + wait || break + [ $(ls core.* 2>/dev/null | wc -l) -gt 0 ] && break + echo iteration $j passed +done -- 1.8.3.1