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 70EB548A44 for ; Fri, 31 Oct 2025 15:39:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6ADE040693; Fri, 31 Oct 2025 15:39:08 +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 F289840150 for ; Fri, 31 Oct 2025 15:39:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761921546; 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=B7fSTJB9iMw4Wc645WY8T9E8jeu1lJxQZxSqeL9lGdM=; b=Z9AUYJnJ9sVBSzkYXUjYTtjWqj7FQCVT75bjAzsGqzqGM/NuZgDVey1BCMeASQNafQ6Pqy cmlKYzwg+bpwXLRzYY31UdDe+xNTE2bqat1Wul43tLIysmeZHBPlnxlWJpDuXB+uWSpAaR jnlsoJ0ClRle0dQXvOyDqTUhUuZtftU= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-145-9RbLdZixNoiGRcToPt00-Q-1; Fri, 31 Oct 2025 10:39:02 -0400 X-MC-Unique: 9RbLdZixNoiGRcToPt00-Q-1 X-Mimecast-MFC-AGG-ID: 9RbLdZixNoiGRcToPt00-Q_1761921541 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3DA9119560A3; Fri, 31 Oct 2025 14:39:01 +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 7681A180044F; Fri, 31 Oct 2025 14:38:59 +0000 (UTC) From: Kevin Traynor To: Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk> Cc: Stephen Hemminger , dpdk stable Subject: patch 'app/testpmd: stop forwarding in secondary process' has been queued to stable release 24.11.4 Date: Fri, 31 Oct 2025 14:33:39 +0000 Message-ID: <20251031143421.324432-97-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: JM8kBTxw8Z7W8pkRMuiV1NXmOYM2hqReGnnKCtnXwdw_1761921541 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/a5c12c892dd18ff8d37dcf7f1ad28a7de49f29a3 Thanks. Kevin --- >From a5c12c892dd18ff8d37dcf7f1ad28a7de49f29a3 Mon Sep 17 00:00:00 2001 From: Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk> Date: Wed, 17 Sep 2025 23:47:03 -0700 Subject: [PATCH] app/testpmd: stop forwarding in secondary process [ upstream commit f96273c8e9d39e472bb07acc05e493b1e712e51b ] When the secondary process testpmd application running any fwd_engine and after that primary has exited will cause a crash. This patch forces secondary process forwarding lcores in fwd_engine to stop before the primary process exits. Fixes: a550baf24af90f ("app/testpmd: support multi-process") Signed-off-by: Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk> Signed-off-by: Stephen Hemminger --- app/test-pmd/testpmd.c | 103 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 99 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 5aaf6534e3..0fb18abe79 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -3568,4 +3568,81 @@ detach_devargs(char *identifier) } +#ifndef RTE_EXEC_ENV_WINDOWS + +enum testpmd_req_type { + TESTPMD_REQ_TYPE_EXIT, +}; + +struct testpmd_mp_req { + enum testpmd_req_type t; +}; + +struct testpmd_mp_resp { + int result; +}; + +#define TESTPMD_MP "mp_testpmd" + +/* Send reply to this peer when testpmd exits */ +static RTE_ATOMIC(const char *) primary_name; + +static void +reply_to_primary(const char *peer, int result) +{ + struct rte_mp_msg reply = { }; + struct testpmd_mp_resp *resp = (struct testpmd_mp_resp *) &reply.param; + + strlcpy(reply.name, TESTPMD_MP, RTE_MP_MAX_NAME_LEN); + reply.len_param = sizeof(*resp); + resp->result = result; + + printf("Replying %d to primary\n", result); + fflush(stdout); + + if (rte_mp_reply(&reply, peer) < 0) + printf("Failed to send response to primary:%s", strerror(rte_errno)); +} + +/* Primary process is exiting, stop secondary process */ +static void +pmd_notify_secondary(void) +{ + struct testpmd_mp_req request = { + .t = TESTPMD_REQ_TYPE_EXIT, + }; + struct rte_mp_msg mp_req = { + .name = TESTPMD_MP, + .len_param = sizeof(request), + }; + struct rte_mp_reply reply; + struct timespec ts = {.tv_sec = 5, .tv_nsec = 0}; + + printf("\nPrimary: Sending 'stop_req' request to secondary...\n"); + fflush(stdout); + + memcpy(mp_req.param, &request, sizeof(request)); + rte_mp_request_sync(&mp_req, &reply, &ts); +} + +static int +handle_testpmd_request(const struct rte_mp_msg *request, const void *peer) +{ + const struct testpmd_mp_req *req = (const struct testpmd_mp_req *)request->param; + + if (req->t == TESTPMD_REQ_TYPE_EXIT) { + printf("\nReceived notification of primary exiting\n"); + fflush(stdout); + + /* Response is sent after forwarding loop exits */ + rte_atomic_store_explicit(&primary_name, peer, rte_memory_order_relaxed); + + kill(getpid(), SIGINT); + } else { + reply_to_primary(peer, -EINVAL); + } + return 0; +} +#endif + void pmd_test_exit(void) @@ -3579,4 +3656,8 @@ pmd_test_exit(void) #ifndef RTE_EXEC_ENV_WINDOWS + /* Tell secondary to exit */ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + pmd_notify_secondary(); + for (i = 0 ; i < RTE_DIM(mempools) ; i++) { if (mempools[i]) { @@ -4359,7 +4440,10 @@ main(int argc, char** argv) #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"); + if (rte_eal_process_type() == RTE_PROC_SECONDARY) { + if (enable_primary_monitor() < 0) + rte_exit(EXIT_FAILURE, "Cannot setup primary monitor"); + if (rte_mp_action_register(TESTPMD_MP, handle_testpmd_request) < 0) + rte_exit(EXIT_FAILURE, "Failed to register message action\n"); + } #endif @@ -4558,10 +4642,21 @@ main(int argc, char** argv) #ifndef RTE_EXEC_ENV_WINDOWS - if (rte_eal_process_type() == RTE_PROC_SECONDARY) + if (rte_eal_process_type() == RTE_PROC_SECONDARY) { disable_primary_monitor(); + rte_mp_action_unregister(TESTPMD_MP); + } #endif pmd_test_exit(); +#ifndef RTE_EXEC_ENV_WINDOWS + if (rte_eal_process_type() == RTE_PROC_SECONDARY) { + const char *peer = rte_atomic_exchange_explicit(&primary_name, NULL, + rte_memory_order_relaxed); + if (peer) + reply_to_primary(peer, 0); + } +#endif + #ifdef RTE_LIB_PDUMP /* uninitialize packet capture framework */ -- 2.51.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-10-31 13:53:55.192085490 +0000 +++ 0097-app-testpmd-stop-forwarding-in-secondary-process.patch 2025-10-31 13:53:52.274524111 +0000 @@ -1 +1 @@ -From f96273c8e9d39e472bb07acc05e493b1e712e51b Mon Sep 17 00:00:00 2001 +From a5c12c892dd18ff8d37dcf7f1ad28a7de49f29a3 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit f96273c8e9d39e472bb07acc05e493b1e712e51b ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index 1a48b00e93..2360da3a48 100644 +index 5aaf6534e3..0fb18abe79 100644 @@ -25 +26 @@ -@@ -3611,4 +3611,81 @@ detach_devargs(char *identifier) +@@ -3568,4 +3568,81 @@ detach_devargs(char *identifier) @@ -107 +108 @@ -@@ -3622,4 +3699,8 @@ pmd_test_exit(void) +@@ -3579,4 +3656,8 @@ pmd_test_exit(void) @@ -116 +117 @@ -@@ -4431,7 +4512,10 @@ main(int argc, char** argv) +@@ -4359,7 +4440,10 @@ main(int argc, char** argv) @@ -130 +131 @@ -@@ -4635,10 +4719,21 @@ main(int argc, char** argv) +@@ -4558,10 +4642,21 @@ main(int argc, char** argv)