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 7F5C143711; Sun, 17 Dec 2023 04:54:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 12A8040284; Sun, 17 Dec 2023 04:54:19 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2042.outbound.protection.outlook.com [40.107.237.42]) by mails.dpdk.org (Postfix) with ESMTP id 972BC40273 for ; Sun, 17 Dec 2023 04:54:17 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mBlJcniFvhi943ksV/rmNkg2pgIxuWkMoZXV8rRuMdx+vlpT/XFwBiP45sW95SKxPwa/kF9GbwvlvxpOGM/JSDhzALwLf2wnw0Jh+5HHFZNag2zHM2BxAC2LKHUYpP8GNYiLHtsgymUE1HH0zLZ6zzx4e0KMS/KArAg/qD/RifL+1nfeiLnQl8bhDLHUFwOal3hRCyxKsoALzIS5/tyrl+I4J84Xpt0iLFWlIbOvJil32RWWFlwXf5mpSMN3Fb4WrZMsqOtNLgTGblnaTdB8baQh4WveobuST62D+5cODa9MpMPNGP3AEQWYGAYcOzfcC8Sdu0ayUBslAjepRvMAqA== 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=RAH0Na0WUjJTfekGJme1o4D5t3Q+qFm4aaVVKYEdKZ0=; b=hycJFUXnH+Glje+v/IJ4A7wUJwfsJsrdCiuyGP+ddBmEMcVDpsGK+9C5gjiz38UUGlbcTuukHbAJq1vPMYIl0KCJRr6RHPatp2xZYhk7uD+C2EYfGMQbsYCosaZNI6Po1VM0YzwLsMcgrbavDqGyOFIORrQL+SRLd/AdmBbxHZqtTMpCzmKnhVJr+OZQm1xE2+UDmdS/CaDsmR9cyeWnJbIVE317YHEC0wI9PNz9Jo83VS/VBaJ12r4+46li2tGiSDsinWqNOPmjrDs8U6XCo2KJSbHmXCII6HfOdtve5gOEGpH+E+w6NS+FJGLl3o5E2S+40l1B2TSx7k08MerXUQ== 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=RAH0Na0WUjJTfekGJme1o4D5t3Q+qFm4aaVVKYEdKZ0=; b=OcEUmvfcUZVOrcwFl62eA5zvD9cP1vqXsYzr2lZkYaafEXHo5lic58uHb3odAtif6YpE7fQacToKn2Ox0sYO04niK2onf/m7oOHoXbr+woZgKKeWpzijgj5WLLgK6No4GNqEtfSvJzreCynkQdkcE+YMAbkwaQGBy4dvhoj1GPnN5xns25wYchsE8leY9YBNj3EiHLvVHnWNnCrNwZ76y/7gcznQAvyntbGljQ4NANs4p8rTjLzfjTfhRSuuoqidY488seE7WUkdq4LdOE+Ur0Qa1JYWm3DmughyW243iL4mwu3r7Qd8nNEtYqa/fNmkxJsKv5YPvAmm40lPNPWZpg== Received: from BL1PR13CA0092.namprd13.prod.outlook.com (2603:10b6:208:2b9::7) by SJ0PR12MB5455.namprd12.prod.outlook.com (2603:10b6:a03:3ba::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.36; Sun, 17 Dec 2023 03:54:14 +0000 Received: from BL02EPF0001A0FE.namprd03.prod.outlook.com (2603:10b6:208:2b9:cafe::9a) by BL1PR13CA0092.outlook.office365.com (2603:10b6:208:2b9::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.15 via Frontend Transport; Sun, 17 Dec 2023 03:54:14 +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 BL02EPF0001A0FE.mail.protection.outlook.com (10.167.242.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.14 via Frontend Transport; Sun, 17 Dec 2023 03:54:14 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) 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; Sat, 16 Dec 2023 19:54:03 -0800 Received: from rnnvmail204.nvidia.com (10.129.68.6) 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.986.41; Sat, 16 Dec 2023 19:54:03 -0800 Received: from nvidia.com (10.127.8.9) by mail.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.986.41 via Frontend Transport; Sat, 16 Dec 2023 19:54:02 -0800 From: Artemy Kovalyov To: CC: Thomas Monjalon , Anatoly Burakov Subject: [PATCH v2 1/5] app/test-mp: add multiprocess test Date: Sun, 17 Dec 2023 05:53:59 +0200 Message-ID: <20231217035400.1060336-1-artemyko@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231212042517.164353-2-artemyko@nvidia.com> References: <20231212042517.164353-2-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: BL02EPF0001A0FE:EE_|SJ0PR12MB5455:EE_ X-MS-Office365-Filtering-Correlation-Id: 88bc3534-909b-4187-e3f7-08dbfeb3d5ea 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: +dYdDZvla1dKa+CMZ4ih7xrYgaqJo+CFGYcOuw4xW9Va+c3WNf3xlQkU41msWNrH5qxWXg0iASWDp+3MThvKLgB71lXS+Xcc0aAaemZtc6GSlRAgZ0lCk7nvTTRm6xE49dLqDoabsYGUfITi0GW4wDEU7P+fUZVqCE8QoWx963AC6fzqY4qhdyA4iQep4Kn+nKo1y79MneUCojYcH2fdB9aHbWStS8Z+1W/vy46msyXdLaS8/gA0WoQy02570SHZ+xtHVpaEAxRfzfqTIKefQTqJ/Qvo7uWS7oUILTSEXdvhvU2BZG1RTeKc2Ty8sJzpUtP+SixyiIIOFzJ6hcToE2gFeieAv/d0qVGnk79x2fnRawg7KXV9cXpFYIRzq2pqfDk5XGtG6KbGpdEsZWvVThi51/LPdhAcQRNQ2GsXwL9cRWlxix05sh9i/QRMU1jkEa5z/l2EE6PZtVL5Cs+T4jWsb76OAricmasIo7C4njXa9AnQJ3veNoVArRCrVey039vJWTj9TRlpo5hZEVuUMi4JKw/TjytHA+CPohWiwlIrabsqRaoLWKaLtR4siiRM6z59VFBuftQoHjHtvd4qxYoIi6Ea+viuGrOLswwaOY/yhQFbmR+mZyBUnZBFRBX65+Le/9dYCAnwt+iOpirzlnJu8NhGNzt3K4qDIHp4SuqgwavEmHkh0vJpY+8L6WWkaON5CpHLdnuGbOnNWq/s6lMxof3gD/TJ1p4NkWiBytIzsjTMG3dos1HMdkwlAH6i 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)(4636009)(136003)(396003)(376002)(39860400002)(346002)(230922051799003)(64100799003)(186009)(82310400011)(1800799012)(451199024)(46966006)(40470700004)(36840700001)(316002)(6916009)(70586007)(54906003)(8936002)(8676002)(4326008)(70206006)(478600001)(41300700001)(36756003)(86362001)(2906002)(47076005)(5660300002)(36860700001)(426003)(336012)(7696005)(6666004)(82740400003)(356005)(7636003)(83380400001)(2616005)(1076003)(26005)(6286002)(40480700001)(55016003)(40460700003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2023 03:54:14.2724 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 88bc3534-909b-4187-e3f7-08dbfeb3d5ea 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: BL02EPF0001A0FE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB5455 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 --- v2: CI && CR fixes - add missing includes - use RTE_TEST_ASSERT --- 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