patch 'app/testpmd: fix early exit from signal' has been queued to stable release 22.11.4

Xueming Li xuemingl at nvidia.com
Mon Dec 11 11:10:43 CET 2023


Hi,

FYI, your patch has been queued to stable release 22.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 12/13/23. 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://git.dpdk.org/dpdk-stable/log/?h=22.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=976cefa8035d36d2f42a430cc1bcf877c12bff20

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 976cefa8035d36d2f42a430cc1bcf877c12bff20 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Thu, 26 Oct 2023 10:11:33 -0700
Subject: [PATCH] app/testpmd: fix early exit from signal
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit a996cd04aeeaeca88e6313174101a1229349fb47 ]

Other signals may occur causing read to get interrupted.
Loop until quit flag is set by signal, a character is entered,
or end of file. This fixes bug where testpmd would exit early
because of signal used by TAP device.

Bugzilla ID: 1305
Fixes: 0fd1386c30c3 ("app/testpmd: cleanup cleanly from signal")

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Ferruh Yigit <ferruh.yigit at amd.com>
Reviewed-by: David Marchand <david.marchand at redhat.com>
---
 app/test-pmd/testpmd.c | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 33c9888740..340c713c19 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -11,7 +11,6 @@
 #include <fcntl.h>
 #ifndef RTE_EXEC_ENV_WINDOWS
 #include <sys/mman.h>
-#include <sys/select.h>
 #endif
 #include <sys/types.h>
 #include <errno.h>
@@ -4646,25 +4645,17 @@ main(int argc, char** argv)
 			}
 		} else {
 			char c;
-			fd_set fds;
 
 			printf("Press enter to exit\n");
-
-			FD_ZERO(&fds);
-			FD_SET(0, &fds);
-
-			/* wait for signal or enter */
-			ret = select(1, &fds, NULL, NULL, NULL);
-			if (ret < 0 && errno != EINTR)
-				rte_exit(EXIT_FAILURE,
-					 "Select failed: %s\n",
-					 strerror(errno));
-
-			/* if got enter then consume it */
-			if (ret == 1 && read(0, &c, 1) < 0)
-				rte_exit(EXIT_FAILURE,
-					 "Read failed: %s\n",
+			while (f_quit == 0) {
+				/* end-of-file or any character exits loop */
+				if (read(0, &c, 1) >= 0)
+					break;
+				if (errno == EINTR)
+					continue;
+				rte_exit(EXIT_FAILURE, "Read failed: %s\n",
 					 strerror(errno));
+			}
 		}
 	}
 
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-12-11 17:56:23.786477700 +0800
+++ 0018-app-testpmd-fix-early-exit-from-signal.patch	2023-12-11 17:56:22.907652300 +0800
@@ -1 +1 @@
-From a996cd04aeeaeca88e6313174101a1229349fb47 Mon Sep 17 00:00:00 2001
+From 976cefa8035d36d2f42a430cc1bcf877c12bff20 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit a996cd04aeeaeca88e6313174101a1229349fb47 ]
@@ -13 +15,0 @@
-Cc: stable at dpdk.org
@@ -23 +25 @@
-index 595b77748c..9e4e99e53b 100644
+index 33c9888740..340c713c19 100644
@@ -34 +36 @@
-@@ -4743,25 +4742,17 @@ main(int argc, char** argv)
+@@ -4646,25 +4645,17 @@ main(int argc, char** argv)


More information about the stable mailing list