From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id AD31F7CCD for ; Fri, 22 Sep 2017 12:32:23 +0200 (CEST) Received: by mail-wm0-f49.google.com with SMTP id r136so2621446wmf.2 for ; Fri, 22 Sep 2017 03:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pbAF6wxpXme6/WQ12bP3fxz7+cbCMSXiAMV09IcVVdE=; b=UFcKnheGad7pYeG6oeEdl55kEz9KXELBLiE+Pz1+s74jEq6J/ki/THPbuHcMR+xjrl 2rCi2OI5glQpzlpoEPtCN4BTbIS9PbGfLI0tADODmHd9uA3G5nTSayujyQns0Ptw/MOE 9C8fPDhVtSIWblrH4UAggp06Y7dLSDYkj13wg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pbAF6wxpXme6/WQ12bP3fxz7+cbCMSXiAMV09IcVVdE=; b=Tw1ymizlsN5sgNM1ME3TIsby44kzA8iAI5oadGno/4pRhkyTREHAAozjIV4MYNtNjH o7ppFhPnCcGvAjuoz47UYUoTAxqmvi81lDOEboFZiDpiVldJAP0eld8msBN1prz9hkTZ txxyCGGTCaX8zx/s81HiYi+5aQOPQQGR/dz5QrbhWoErMU4FsJ98aihR26LRSelOgbFU 4fRyyBB7ErSWtjlXekILQSfBzQvPFUPHIEBXZCBaTL6K72Yy4VhIpAR2yQvBGjfyhmUQ DefUNAQvUcnXlpG9K6LTPnoMjZv5VfbUiUdOHl6cMeiBnD8ufRN5NPg4iPX3hVAj8i1w PDcw== X-Gm-Message-State: AHPjjUhhVHQDINex2MLC5sPHEfeqnt976+PblpeIF1a/uDbe/lxGOrv5 T3NchreoUa/I8OGYaR0NgQWkfOs/7cfiQLXcdorSCVdubSA= X-Google-Smtp-Source: AOwi7QD4u9NHpUS6HutlltsqkKgOvVEcIff+dC0ww8Gkop3NO7Rvy3Sk5h0dTdJK2o0VoVWxs+WsRZOLMxD6paZVLQw= X-Received: by 10.80.215.3 with SMTP id t3mr4297031edi.45.1506076343054; Fri, 22 Sep 2017 03:32:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.174.148 with HTTP; Fri, 22 Sep 2017 03:32:22 -0700 (PDT) In-Reply-To: <1506061292-2814-1-git-send-email-phil.yang@arm.com> References: <1505706058-1841-1-git-send-email-phil.yang@arm.com> <1506061292-2814-1-git-send-email-phil.yang@arm.com> From: Jianbo Liu Date: Fri, 22 Sep 2017 18:32:22 +0800 Message-ID: To: Phil Yang Cc: dev@dpdk.org, nd@arm.com, Herbert Guan Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v2] app/testpmd: fix stats period can't quit normally in container X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Sep 2017 10:32:23 -0000 On 22 September 2017 at 14:21, Phil Yang wrote: > In container, the process cannot be terminated by SIGINT/SIGTERM when > execute with 'stats-period' option. > Fixed by adding a flag to exit stats period loop after received either > SIGINT or SIGTERM. > > Signed-off-by: Phil Yang > --- > app/test-pmd/testpmd.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index e097ee0..3ccc9ba 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -183,6 +183,13 @@ uint16_t mbuf_data_size = DEFAULT_MBUF_DATA_SIZE; /**< Mbuf data space size. */ > uint32_t param_total_num_mbufs = 0; /**< number of mbufs in all pools - if > * specified on command-line. */ > uint16_t stats_period; /**< Period to show statistics (disabled by default) */ > + > +/* > + * In container, it cannot terminate the process which running with 'stats-period' > + * option. Set flag to exit stats period loop after received SIGINT/SIGTERM. > + */ > +uint8_t f_quit; > + > /* > * Configuration of packet segments used by the "txonly" processing engine. > */ > @@ -2318,6 +2325,8 @@ signal_handler(int signum) > rte_latencystats_uninit(); > #endif > force_quit(); > + /* Set flag to indicate the force termination. */ > + f_quit = 1; > /* exit with the expected status */ > signal(signum, SIG_DFL); > kill(getpid(), signum); > @@ -2435,6 +2444,8 @@ main(int argc, char** argv) > char c; > int rc; > > + f_quit = 0; > + > printf("No commandline core given, start packet forwarding\n"); > start_packet_forwarding(tx_first); > if (stats_period != 0) { > @@ -2444,7 +2455,7 @@ main(int argc, char** argv) > /* Convert to number of cycles */ > timer_period = stats_period * rte_get_timer_hz(); > > - while (1) { > + while (f_quit == 0) { > cur_time = rte_get_timer_cycles(); > diff_time += cur_time - prev_time; > > -- > 2.7.4 > Acked-by: Jianbo Liu