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 1820443206; Thu, 26 Oct 2023 12:32:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9D7E402C5; Thu, 26 Oct 2023 12:32:25 +0200 (CEST) Received: from inbox.dpdk.org (inbox.dpdk.org [95.142.172.178]) by mails.dpdk.org (Postfix) with ESMTP id 805D5402BA for ; Thu, 26 Oct 2023 12:32:24 +0200 (CEST) Received: by inbox.dpdk.org (Postfix, from userid 33) id 70C2D43208; Thu, 26 Oct 2023 12:32:24 +0200 (CEST) From: bugzilla@dpdk.org To: dev@dpdk.org Subject: [Bug 1305] testpmd: early exit with tap driver in non interactive mode Date: Thu, 26 Oct 2023 10:32:24 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: DPDK X-Bugzilla-Component: testpmd X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: david.marchand@redhat.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: dev@dpdk.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: multipart/alternative; boundary=16983163440.5D654D6bA.223876 Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://bugs.dpdk.org/ Auto-Submitted: auto-generated X-Auto-Response-Suppress: All MIME-Version: 1.0 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 --16983163440.5D654D6bA.223876 Date: Thu, 26 Oct 2023 12:32:24 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.dpdk.org/ Auto-Submitted: auto-generated X-Auto-Response-Suppress: All https://bugs.dpdk.org/show_bug.cgi?id=3D1305 Bug ID: 1305 Summary: testpmd: early exit with tap driver in non interactive mode Product: DPDK Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority: Normal Component: testpmd Assignee: dev@dpdk.org Reporter: david.marchand@redhat.com Target Milestone: --- Reported by Frode, while running OVS-DPDK unit tests. testpmd behavior changed with commit 0fd1386c30c3 ("app/testpmd: cleanup cleanly from signal"). Any signal makes testpmd quit. This can be problematic with the tap driver which uses internal signalling. Reproducer with strace to illustrate the issue: $ sudo strace -f -e trace=3Dfile build-clang/app/dpdk-testpmd -c 3 --no-hug= e -m 40 -a 0:0.0 --vdev net_tap0 -- --no-mlockall --total-num-mbufs=3D2048 -a ... No commandline core given, start packet forwarding io packet forwarding - ports=3D1 - cores=3D1 - streams=3D1 - NUMA support e= nabled, MP allocation mode: native Logical Core 1 (socket 0) forwards packets on 1 streams: RX P=3D0/Q=3D0 (socket 0) -> TX P=3D0/Q=3D0 (socket 0) peer=3D02:00:00:00= :00:00 [pid 3780703] --- SIGRT_3 {si_signo=3DSIGRT_3, si_code=3D0x1, si_pid=3D65, = si_uid=3D0, si_int=3D22, si_ptr=3D0x16} --- io packet forwarding packets/burst=3D32 nb forwarding cores=3D1 - nb forwarding ports=3D1 port 0: RX queue number: 1 Tx queue number: 1 Rx offloads=3D0x0 Tx offloads=3D0x0 RX queue: 0 RX desc=3D0 - RX free threshold=3D0 RX threshold registers: pthresh=3D0 hthresh=3D0 wthresh=3D0 RX Offloads=3D0x0 TX queue: 0 TX desc=3D0 - TX free threshold=3D0 TX threshold registers: pthresh=3D0 hthresh=3D0 wthresh=3D0 TX offloads=3D0x0 - TX RS bit threshold=3D0 Press enter to exit [pid 3780703] --- SIGRT_3 {si_signo=3DSIGRT_3, si_code=3D0x1, si_pid=3D65, = si_uid=3D0, si_int=3D22, si_ptr=3D0x16} --- Telling cores to stop... Waiting for lcores to finish... ---------------------- Forward statistics for port 0 -------------------= --- RX-packets: 1 RX-dropped: 0 RX-total: 1 TX-packets: 1 TX-dropped: 0 TX-total: 1 -------------------------------------------------------------------------= --- +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++= ++ RX-packets: 1 RX-dropped: 0 RX-total: 1 TX-packets: 1 TX-dropped: 0 TX-total: 1 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++ Done. Stopping port 0... Stopping ports... Done Shutting down port 0... Closing ports... Port 0 is closed Done Bye... [pid 3780705] --- SIGRTMIN {si_signo=3DSIGRTMIN, si_code=3DSI_TKILL, si_pid=3D3780703, si_uid=3D0} --- [pid 3780705] +++ exited with 0 +++ [pid 3780703] unlink("/var/run/dpdk/rte/mp_socket") =3D 0 [pid 3780703] unlink("/var/run/dpdk/rte/dpdk_telemetry.v2:1") =3D 0 =3D=3D3780703=3D=3DLeakSanitizer has encountered a fatal error. =3D=3D3780703=3D=3DHINT: For debugging, try setting environment variable LSAN_OPTIONS=3Dverbosity=3D1:log_threads=3D1 =3D=3D3780703=3D=3DHINT: LeakSanitizer does not work under ptrace (strace, = gdb, etc) [pid 3780710] +++ exited with 1 +++ [pid 3780704] +++ exited with 1 +++ [pid 3780706] +++ exited with 1 +++ +++ exited with 1 +++ A quick fix I tried: diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 595b77748c..57d257623e 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -4743,22 +4743,11 @@ 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 =3D select(1, &fds, NULL, NULL, NULL); - if (ret < 0 && errno !=3D EINTR) - rte_exit(EXIT_FAILURE, - "Select failed: %s\n", - strerror(errno)); - /* if got enter then consume it */ - if (ret =3D=3D 1 && read(0, &c, 1) < 0) + if (read(0, &c, 1) < 0 && errno !=3D EINTR) rte_exit(EXIT_FAILURE, "Read failed: %s\n", strerror(errno)); --=20 You are receiving this mail because: You are the assignee for the bug.= --16983163440.5D654D6bA.223876 Date: Thu, 26 Oct 2023 12:32:24 +0200 MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.dpdk.org/ Auto-Submitted: auto-generated X-Auto-Response-Suppress: All
Bug ID 1305
Summary testpmd: early exit with tap driver in non interactive mode
Product DPDK
Version unspecified
Hardware All
OS All
Status UNCONFIRMED
Severity normal
Priority Normal
Component testpmd
Assignee dev@dpdk.org
Reporter david.marchand@redhat.com
Target Milestone ---

Reported by Frode, while running O=
VS-DPDK unit tests.

testpmd behavior changed with commit 0fd1386c30c3 ("app/testpmd: clean=
up
cleanly from signal"). Any signal makes testpmd quit.

This can be problematic with the tap driver which uses internal signalling.


Reproducer with strace to illustrate the issue:

$ sudo strace -f -e trace=3Dfile build-clang/app/dpdk-testpmd -c 3 --no-hug=
e -m
40 -a 0:0.0 --vdev net_tap0 -- --no-mlockall --total-num-mbufs=3D2048 -a

...

No commandline core given, start packet forwarding
io packet forwarding - ports=3D1 - cores=3D1 - streams=3D1 - NUMA support e=
nabled, MP
allocation mode: native
Logical Core 1 (socket 0) forwards packets on 1 streams:
  RX P=3D0/Q=3D0 (socket 0) -> TX P=3D0/Q=3D0 (socket 0) peer=3D02:00:00=
:00:00:00

[pid 3780703] --- SIGRT_3 {si_signo=3DSIGRT_3, si_code=3D0x1, si_pid=3D65, =
si_uid=3D0,
si_int=3D22, si_ptr=3D0x16} ---
  io packet forwarding packets/burst=3D32
  nb forwarding cores=3D1 - nb forwarding ports=3D1
  port 0: RX queue number: 1 Tx queue number: 1
    Rx offloads=3D0x0 Tx offloads=3D0x0
    RX queue: 0
      RX desc=3D0 - RX free threshold=3D0
      RX threshold registers: pthresh=3D0 hthresh=3D0  wthresh=3D0
      RX Offloads=3D0x0
    TX queue: 0
      TX desc=3D0 - TX free threshold=3D0
      TX threshold registers: pthresh=3D0 hthresh=3D0  wthresh=3D0
      TX offloads=3D0x0 - TX RS bit threshold=3D0
Press enter to exit
[pid 3780703] --- SIGRT_3 {si_signo=3DSIGRT_3, si_code=3D0x1, si_pid=3D65, =
si_uid=3D0,
si_int=3D22, si_ptr=3D0x16} ---
Telling cores to stop...
Waiting for lcores to finish...

  ---------------------- Forward statistics for port 0  -------------------=
---
  RX-packets: 1              RX-dropped: 0             RX-total: 1
  TX-packets: 1              TX-dropped: 0             TX-total: 1
  -------------------------------------------------------------------------=
---

  +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++=
++
  RX-packets: 1              RX-dropped: 0             RX-total: 1
  TX-packets: 1              TX-dropped: 0             TX-total: 1
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
+++

Done.

Stopping port 0...
Stopping ports...
Done

Shutting down port 0...
Closing ports...
Port 0 is closed
Done

Bye...
[pid 3780705] --- SIGRTMIN {si_signo=3DSIGRTMIN, si_code=3DSI_TKILL,
si_pid=3D3780703, si_uid=3D0} ---
[pid 3780705] +++ exited with 0 +++
[pid 3780703] unlink("/var/run/dpdk/rte/mp_socket") =3D 0
[pid 3780703] unlink("/var/run/dpdk/rte/dpdk_telemetry.v2:1") =3D=
 0
=3D=3D3780703=3D=3DLeakSanitizer has encountered a fatal error.
=3D=3D3780703=3D=3DHINT: For debugging, try setting environment variable
LSAN_OPTIONS=3Dverbosity=3D1:log_threads=3D1
=3D=3D3780703=3D=3DHINT: LeakSanitizer does not work under ptrace (strace, =
gdb, etc)
[pid 3780710] +++ exited with 1 +++
[pid 3780704] +++ exited with 1 +++
[pid 3780706] +++ exited with 1 +++
+++ exited with 1 +++


A quick fix I tried:
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 595b77748c..57d257623e 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -4743,22 +4743,11 @@ 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 =3D select(1, &fds, NULL, NULL, NULL);
-                       if (ret < 0 && errno !=3D EINTR)
-                               rte_exit(EXIT_FAILURE,
-                                        "Select failed: %s\n",
-                                        strerror(errno));
-
                        /* if got enter then consume it */
-                       if (ret =3D=3D 1 && read(0, &c, 1) <=
 0)
+                       if (read(0, &c, 1) < 0 && errno !=3D=
 EINTR)
                                rte_exit(EXIT_FAILURE,
                                         "Read failed: %s\n",
                                         strerror(errno));
          


You are receiving this mail because:
  • You are the assignee for the bug.
=20=20=20=20=20=20=20=20=20=20
= --16983163440.5D654D6bA.223876--