From patchwork Thu Oct 26 10:32:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bugzilla@dpdk.org X-Patchwork-Id: 133387 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org 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: 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 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));