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 8F63248A44 for ; Fri, 31 Oct 2025 15:36:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 88D0240652; Fri, 31 Oct 2025 15:36:15 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 26D7340150 for ; Fri, 31 Oct 2025 15:36:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761921373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dw9uxkM0sagOR3gHrQRTPhnjQbhUzGR7JByAzhmMROs=; b=Li2ZVlC7adqxMf1sJWODFC8FzOHAsMCq/th8SjbChJXtuo3VyRPPHk7/o9y6yjOwGR6hI1 xrxALlxGGripFZmnDRqOwRKK2gZp5TP9oiO3PGg6ImRrwaLSqSfSaT09UoMn7yojiw2oXz j4QSxeCfDHkupuTjISuuwYeBZ4sGxrs= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-447-ZzCqN2U5PIKXGYdMV4U_7A-1; Fri, 31 Oct 2025 10:36:12 -0400 X-MC-Unique: ZzCqN2U5PIKXGYdMV4U_7A-1 X-Mimecast-MFC-AGG-ID: ZzCqN2U5PIKXGYdMV4U_7A_1761921371 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5D44E1800D86; Fri, 31 Oct 2025 14:36:11 +0000 (UTC) Received: from rh.redhat.com (unknown [10.44.32.50]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8B96F180044F; Fri, 31 Oct 2025 14:36:08 +0000 (UTC) From: Kevin Traynor To: Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk> Cc: Stephen Hemminger , dpdk stable Subject: patch 'app/testpmd: monitor state of primary process' has been queued to stable release 24.11.4 Date: Fri, 31 Oct 2025 14:32:27 +0000 Message-ID: <20251031143421.324432-25-ktraynor@redhat.com> In-Reply-To: <20251031143421.324432-1-ktraynor@redhat.com> References: <20251031143421.324432-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: XNIzuGfpMuwiIA6ntxsdhB3hhdIw-wsd0P33aogW7tw_1761921371 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 24.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/05/25. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/1abb5e1c5de1b16d4d08fc98715e66eab2767944 Thanks. Kevin --- >From 1abb5e1c5de1b16d4d08fc98715e66eab2767944 Mon Sep 17 00:00:00 2001 From: Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk> Date: Mon, 4 Aug 2025 07:33:22 -0400 Subject: [PATCH] app/testpmd: monitor state of primary process [ upstream commit 7628f5bbb7e882e57c956d98731cac12a436c9a7 ] In secondary processes, accessing device after primary has exited will cause crash. This patch adds a mechanism in testpmd to monitor the primary process from the secondary process. When primary process exits it forces secondary to exit avoiding issues from cleanup logic. Fixes: a550baf24af9 ("app/testpmd: support multi-process") Signed-off-by: Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk> Signed-off-by: Stephen Hemminger --- app/test-pmd/testpmd.c | 47 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index ac654048df..5aaf6534e3 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -102,4 +102,7 @@ uint16_t verbose_level = 0; /**< Silent by default. */ int testpmd_logtype; /**< Log type for testpmd logs */ +/* Maximum delay for exiting after primary process. */ +#define MONITOR_INTERVAL (500 * 1000) + /* use main core for command line ? */ uint8_t interactive = 0; @@ -107,5 +110,4 @@ uint8_t auto_start = 0; uint8_t tx_first; char cmdline_filename[PATH_MAX] = {0}; - /* * NUMA support configuration. @@ -4293,4 +4295,36 @@ signal_handler(int signum __rte_unused) } +#ifndef RTE_EXEC_ENV_WINDOWS +/* Alarm signal handler, used to check that primary process */ +static void +monitor_primary(void *arg __rte_unused) +{ + if (rte_eal_primary_proc_alive(NULL)) { + rte_eal_alarm_set(MONITOR_INTERVAL, monitor_primary, NULL); + } else { + /* + * If primary process exits, then all the device information + * is no longer valid. Calling any cleanup code is going to + * run into use after free. + */ + fprintf(stderr, "\nPrimary process is no longer active, exiting...\n"); + exit(EXIT_FAILURE); + } +} + +/* Setup handler to check when primary exits. */ +static int +enable_primary_monitor(void) +{ + return rte_eal_alarm_set(MONITOR_INTERVAL, monitor_primary, NULL); +} + +static void +disable_primary_monitor(void) +{ + rte_eal_alarm_cancel(monitor_primary, NULL); +} +#endif + int main(int argc, char** argv) @@ -4324,4 +4358,10 @@ main(int argc, char** argv) rte_strerror(rte_errno)); +#ifndef RTE_EXEC_ENV_WINDOWS + if (rte_eal_process_type() == RTE_PROC_SECONDARY && + enable_primary_monitor() < 0) + rte_exit(EXIT_FAILURE, "Cannot setup primary monitor"); +#endif + /* allocate port structures, and init them */ init_port(); @@ -4517,4 +4557,9 @@ main(int argc, char** argv) } +#ifndef RTE_EXEC_ENV_WINDOWS + if (rte_eal_process_type() == RTE_PROC_SECONDARY) + disable_primary_monitor(); +#endif + pmd_test_exit(); -- 2.51.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-10-31 13:53:53.034360913 +0000 +++ 0025-app-testpmd-monitor-state-of-primary-process.patch 2025-10-31 13:53:52.051523415 +0000 @@ -1 +1 @@ -From 7628f5bbb7e882e57c956d98731cac12a436c9a7 Mon Sep 17 00:00:00 2001 +From 1abb5e1c5de1b16d4d08fc98715e66eab2767944 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 7628f5bbb7e882e57c956d98731cac12a436c9a7 ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ -index db52ed22f1..0f58a31eb5 100644 +index ac654048df..5aaf6534e3 100644 @@ -27 +28 @@ -@@ -103,4 +103,7 @@ uint16_t verbose_level = 0; /**< Silent by default. */ +@@ -102,4 +102,7 @@ uint16_t verbose_level = 0; /**< Silent by default. */ @@ -35 +36,2 @@ -@@ -109,5 +112,4 @@ uint8_t tx_first; +@@ -107,5 +110,4 @@ uint8_t auto_start = 0; + uint8_t tx_first; @@ -37 +38,0 @@ - bool echo_cmdline_file; @@ -41 +42 @@ -@@ -4364,4 +4366,36 @@ signal_handler(int signum __rte_unused) +@@ -4293,4 +4295,36 @@ signal_handler(int signum __rte_unused) @@ -78 +79 @@ -@@ -4395,4 +4429,10 @@ main(int argc, char** argv) +@@ -4324,4 +4358,10 @@ main(int argc, char** argv) @@ -89 +90 @@ -@@ -4588,4 +4628,9 @@ main(int argc, char** argv) +@@ -4517,4 +4557,9 @@ main(int argc, char** argv)