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 96F97489EF for ; Mon, 27 Oct 2025 17:20:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C85F40655; Mon, 27 Oct 2025 17:20:47 +0100 (CET) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mails.dpdk.org (Postfix) with ESMTP id 33E754028B for ; Mon, 27 Oct 2025 17:20:46 +0100 (CET) Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-3ee64bc6b85so5054600f8f.3 for ; Mon, 27 Oct 2025 09:20:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761582046; x=1762186846; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IC6N+VNQQtPOH3uaOVQ3HpyX+p7mcz/kiVrxPTFADGw=; b=gzpnG4MzGFwfAmbrJWNLX0X9RZoPIi2yrW18cFzUHn/3b3Z6kNq17BGbJ6FBujlL8x sS14+d1YmOrs9xB205Wqcuh6scX88xn25h+nVdQGbw9U1fSyOd4x9Y21YXZ3yj0b40CS GlSi2m7wBpzlMkVaEFVMpIUmGuu3CKnjO6RW0TbjVKUfRm5C98WnMb6gCm9UwgoApF34 5JnOcx1AxHDSKwRb8v6xa8szA5pu3I5yaubKJCh4F/9E/rzVZTDX/DlDv/6MskuO1atN qBXEgCuWjJZQIlad8Pq4GVpccZt7d+3v78wmBx6jkyf8P2/U2783MhnSReDh7t3zEazK 988Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761582046; x=1762186846; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IC6N+VNQQtPOH3uaOVQ3HpyX+p7mcz/kiVrxPTFADGw=; b=dJAlfgUbLizQUZYQ+k0o2EjcTv33cwGCDX7GA3O6amkpb3Rq1yoONspx8Ca0Z7wlvg dkFJSEmplVIU1vhvK4Oz1azlyLGryUHvx6aFdbm/ib+pkJ5IvQJL1zyr/msFHrmxXhal RWxN8vJfB4I7sY9sSCXojFLG9DeYJZ4A5NVWI9fVu6cFr1ZPMhe5XD4XftyDBdpPTFyd ueFC6F8P84YY3lM7FXN9sU0gS8R3TEB5pxNb9VHyTuG7Z19uKncI5W07JcDvNJ4zrZ9j E/pbcQXYPp4Vywbqcr3/7KcrQi/JkmoKqmL4QANOs6haYpMnal+DZGZ1AzXgZFu4R2sQ eeGw== X-Forwarded-Encrypted: i=1; AJvYcCWl3g2ZDNWjc48JH5h4NFZYq7UZGGMC+FlUQERjxP32zq2Opdg18fmoFEZ400OfD07c7YS+p9k=@dpdk.org X-Gm-Message-State: AOJu0YyLEK8myfm+RuPc3SCNdDVCIdTR+2hMUb28FhBDHiuWn5oaRqfS ALoQ/aAzfZzsUTvKmMPZYAOEesHFxf+LlzHp6z4baDo0gE0eRTkoxmjmXm3DFA== X-Gm-Gg: ASbGncvKOwdZjzQewmuKrKTnnQaMN8ZBtKUc0oYJ9WwgGLHxXWBmD9c3tfLeYaC6zeS ACivqE+zkjcAWGlYM6JZ48853ElY5//JXanD/8KTfTf8hfePLBuGZYkBFcW/seguTD+rqtn5jB8 cM7G7UP9NuHupST2GJ/16DhC3KqhWZj9+HSjslszZTqu7ujQv2smP/+FaUGBaZ44wWgLrT4Sm/r o2wYKCXqczYpZq0IRUaCYpCB6MsvIv12MFR3stFTEcBKHRqRtaKf6cYS855pvYSD0bSDuy62AN2 071xiYCxpdC2y46P6b7fCEVZQ8gliQuo31CgjdY0NFuDRnVAxMW94U3MfI4/J+hgJNhuy2KUshF LtKiGF2St94AqglWCkO5TEnnFZUEkUJQ5tuXvtomrJjiWy8jaPolSArd9dGmnmKsMzAuCVNoaa5 hlbMwpX+6T11vD7cTj X-Google-Smtp-Source: AGHT+IHVggDsQ57zFew7qDQREGGlQ9FcHI+f018OR2ITAMqmAterTBeqCUbIcHb3YhOYq87Xwxp7dQ== X-Received: by 2002:a5d:5d0a:0:b0:427:813:6a52 with SMTP id ffacd0b85a97d-429a7e70961mr238928f8f.41.1761582045603; Mon, 27 Oct 2025 09:20:45 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:6fc5:c3bc:147e:832c]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-429952e3201sm15189779f8f.47.2025.10.27.09.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Oct 2025 09:20:45 -0700 (PDT) From: luca.boccassi@gmail.com 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 22.11.11 Date: Mon, 27 Oct 2025 16:18:51 +0000 Message-ID: <20251027162001.3710450-13-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251027162001.3710450-1-luca.boccassi@gmail.com> References: <20251027162001.3710450-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 22.11.11 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/29/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/7b609f1130635dd8e03954a0c4d9e265742d4ad4 Thanks. Luca Boccassi --- >From 7b609f1130635dd8e03954a0c4d9e265742d4ad4 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 340c713c19..a293018341 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -101,12 +101,14 @@ 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; uint8_t auto_start = 0; uint8_t tx_first; char cmdline_filename[PATH_MAX] = {0}; - /* * NUMA support configuration. * When set, the NUMA support attempts to dispatch the allocation of the @@ -4431,6 +4433,38 @@ signal_handler(int signum __rte_unused) prompt_exit(); } +#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) { @@ -4462,6 +4496,12 @@ main(int argc, char** argv) rte_exit(EXIT_FAILURE, "Cannot init EAL: %s\n", 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(); @@ -4659,6 +4699,11 @@ 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(); #ifdef RTE_LIB_PDUMP -- 2.47.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-10-27 15:54:35.320924375 +0000 +++ 0013-app-testpmd-monitor-state-of-primary-process.patch 2025-10-27 15:54:34.731947944 +0000 @@ -1 +1 @@ -From 7628f5bbb7e882e57c956d98731cac12a436c9a7 Mon Sep 17 00:00:00 2001 +From 7b609f1130635dd8e03954a0c4d9e265742d4ad4 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 340c713c19..a293018341 100644 @@ -27 +28 @@ -@@ -102,13 +102,15 @@ +@@ -101,12 +101,14 @@ @@ -39 +39,0 @@ - bool echo_cmdline_file; @@ -44 +44 @@ -@@ -4363,6 +4365,38 @@ signal_handler(int signum __rte_unused) +@@ -4431,6 +4433,38 @@ signal_handler(int signum __rte_unused) @@ -83 +83 @@ -@@ -4394,6 +4428,12 @@ main(int argc, char** argv) +@@ -4462,6 +4496,12 @@ main(int argc, char** argv) @@ -96 +96 @@ -@@ -4587,6 +4627,11 @@ main(int argc, char** argv) +@@ -4659,6 +4699,11 @@ main(int argc, char** argv)