All of lore.kernel.org
 help / color / mirror / Atom feed
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	[thread overview]
Message-ID: <bug-1305-3@http.bugs.dpdk.org/> (raw)

[-- Attachment #1: Type: text/plain, Size: 4738 bytes --]

https://bugs.dpdk.org/show_bug.cgi?id=1305

            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=file build-clang/app/dpdk-testpmd -c 3 --no-huge -m
40 -a 0:0.0 --vdev net_tap0 -- --no-mlockall --total-num-mbufs=2048 -a

...

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

[pid 3780703] --- SIGRT_3 {si_signo=SIGRT_3, si_code=0x1, si_pid=65, si_uid=0,
si_int=22, si_ptr=0x16} ---
  io packet forwarding packets/burst=32
  nb forwarding cores=1 - nb forwarding ports=1
  port 0: RX queue number: 1 Tx queue number: 1
    Rx offloads=0x0 Tx offloads=0x0
    RX queue: 0
      RX desc=0 - RX free threshold=0
      RX threshold registers: pthresh=0 hthresh=0  wthresh=0
      RX Offloads=0x0
    TX queue: 0
      TX desc=0 - TX free threshold=0
      TX threshold registers: pthresh=0 hthresh=0  wthresh=0
      TX offloads=0x0 - TX RS bit threshold=0
Press enter to exit
[pid 3780703] --- SIGRT_3 {si_signo=SIGRT_3, si_code=0x1, si_pid=65, si_uid=0,
si_int=22, si_ptr=0x16} ---
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=SIGRTMIN, si_code=SI_TKILL,
si_pid=3780703, si_uid=0} ---
[pid 3780705] +++ exited with 0 +++
[pid 3780703] unlink("/var/run/dpdk/rte/mp_socket") = 0
[pid 3780703] unlink("/var/run/dpdk/rte/dpdk_telemetry.v2:1") = 0
==3780703==LeakSanitizer has encountered a fatal error.
==3780703==HINT: For debugging, try setting environment variable
LSAN_OPTIONS=verbosity=1:log_threads=1
==3780703==HINT: 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 = 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)
+                       if (read(0, &c, 1) < 0 && errno != EINTR)
                                rte_exit(EXIT_FAILURE,
                                         "Read failed: %s\n",
                                         strerror(errno));

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #2: Type: text/html, Size: 6736 bytes --]

                 reply	other threads:[~2023-10-26 10:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-1305-3@http.bugs.dpdk.org/ \
    --to=bugzilla@dpdk.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.