DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: fix stats period can't quit normally in container
@ 2017-09-18  3:40 Phil Yang
  2017-09-21  8:32 ` Jianbo Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Phil Yang @ 2017-09-18  3:40 UTC (permalink / raw)
  To: dev; +Cc: nd

While running testpmd in container with stats-period option, it can't
quit normally after received SIGINT.

Signed-off-by: Phil Yang <phil.yang@arm.com>
---
 app/test-pmd/testpmd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e097ee0..d94c63b 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -183,6 +183,7 @@ 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) */
+uint8_t  f_quit; /* Receive LSC INTERRUPTION to stop show statistics periodically */
 /*
  * Configuration of packet segments used by the "txonly" processing engine.
  */
@@ -2285,6 +2286,8 @@ init_port(void)
 static void
 force_quit(void)
 {
+	f_quit = 1;
+
 	pmd_test_exit();
 	prompt_exit();
 }
@@ -2441,10 +2444,13 @@ main(int argc, char** argv)
 			uint64_t prev_time = 0, cur_time, diff_time = 0;
 			uint64_t timer_period;
 
+			/* Receive LSC interrupt to stop showing statistics period */
+			f_quit = 0;
+
 			/* Convert to number of cycles */
 			timer_period = stats_period * rte_get_timer_hz();
 
-			while (1) {
+			while (!f_quit) {
 				cur_time = rte_get_timer_cycles();
 				diff_time += cur_time - prev_time;
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: fix stats period can't quit normally in container
  2017-09-18  3:40 [dpdk-dev] [PATCH] app/testpmd: fix stats period can't quit normally in container Phil Yang
@ 2017-09-21  8:32 ` Jianbo Liu
  2017-09-22  6:12 ` [dpdk-dev] [PATCH v2] " Phil Yang
  2017-09-22  6:21 ` Phil Yang
  2 siblings, 0 replies; 6+ messages in thread
From: Jianbo Liu @ 2017-09-21  8:32 UTC (permalink / raw)
  To: Phil Yang; +Cc: dev, nd

On 18 September 2017 at 11:40, Phil Yang <phil.yang@arm.com> wrote:
> While running testpmd in container with stats-period option, it can't
> quit normally after received SIGINT.
>
> Signed-off-by: Phil Yang <phil.yang@arm.com>
> ---
>  app/test-pmd/testpmd.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index e097ee0..d94c63b 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -183,6 +183,7 @@ 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) */
> +uint8_t  f_quit; /* Receive LSC INTERRUPTION to stop show statistics periodically */

The comment seems wrong, as it's not related to LSC.

>  /*
>   * Configuration of packet segments used by the "txonly" processing engine.
>   */
> @@ -2285,6 +2286,8 @@ init_port(void)
>  static void
>  force_quit(void)
>  {
> +       f_quit = 1;

I suggest moving this line to the bottom of this function.

> +
>         pmd_test_exit();
>         prompt_exit();
>  }
> @@ -2441,10 +2444,13 @@ main(int argc, char** argv)
>                         uint64_t prev_time = 0, cur_time, diff_time = 0;
>                         uint64_t timer_period;
>
> +                       /* Receive LSC interrupt to stop showing statistics period */
> +                       f_quit = 0;
> +
>                         /* Convert to number of cycles */
>                         timer_period = stats_period * rte_get_timer_hz();
>
> -                       while (1) {
> +                       while (!f_quit) {
>                                 cur_time = rte_get_timer_cycles();
>                                 diff_time += cur_time - prev_time;
>
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v2] app/testpmd: fix stats period can't quit normally in container
  2017-09-18  3:40 [dpdk-dev] [PATCH] app/testpmd: fix stats period can't quit normally in container Phil Yang
  2017-09-21  8:32 ` Jianbo Liu
@ 2017-09-22  6:12 ` Phil Yang
  2017-09-22  6:21 ` Phil Yang
  2 siblings, 0 replies; 6+ messages in thread
From: Phil Yang @ 2017-09-22  6:12 UTC (permalink / raw)
  To: dev; +Cc: nd, jianbo.liu, Herbert.Guan

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 SIGINT/SIGTERM.

Signed-off-by: Phil Yang <phil.yang@arm.com>
---
 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v2] app/testpmd: fix stats period can't quit normally in container
  2017-09-18  3:40 [dpdk-dev] [PATCH] app/testpmd: fix stats period can't quit normally in container Phil Yang
  2017-09-21  8:32 ` Jianbo Liu
  2017-09-22  6:12 ` [dpdk-dev] [PATCH v2] " Phil Yang
@ 2017-09-22  6:21 ` Phil Yang
  2017-09-22 10:32   ` Jianbo Liu
  2 siblings, 1 reply; 6+ messages in thread
From: Phil Yang @ 2017-09-22  6:21 UTC (permalink / raw)
  To: dev; +Cc: nd, jianbo.liu, Herbert.Guan

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 <phil.yang@arm.com>
---
 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v2] app/testpmd: fix stats period can't quit normally in container
  2017-09-22  6:21 ` Phil Yang
@ 2017-09-22 10:32   ` Jianbo Liu
  2017-10-09  5:27     ` Ferruh Yigit
  0 siblings, 1 reply; 6+ messages in thread
From: Jianbo Liu @ 2017-09-22 10:32 UTC (permalink / raw)
  To: Phil Yang; +Cc: dev, nd, Herbert Guan

On 22 September 2017 at 14:21, Phil Yang <phil.yang@arm.com> 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 <phil.yang@arm.com>
> ---
>  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 <jianbo.liu@linaro.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v2] app/testpmd: fix stats period can't quit normally in container
  2017-09-22 10:32   ` Jianbo Liu
@ 2017-10-09  5:27     ` Ferruh Yigit
  0 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2017-10-09  5:27 UTC (permalink / raw)
  To: Jianbo Liu, Phil Yang; +Cc: dev, nd, Herbert Guan

On 9/22/2017 11:32 AM, Jianbo Liu wrote:
> On 22 September 2017 at 14:21, Phil Yang <phil.yang@arm.com> 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 <phil.yang@arm.com>>
> Acked-by: Jianbo Liu <jianbo.liu@linaro.org> 

Applied to dpdk-next-net/master, thanks.

Welcome Phil Yang!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-09  5:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-18  3:40 [dpdk-dev] [PATCH] app/testpmd: fix stats period can't quit normally in container Phil Yang
2017-09-21  8:32 ` Jianbo Liu
2017-09-22  6:12 ` [dpdk-dev] [PATCH v2] " Phil Yang
2017-09-22  6:21 ` Phil Yang
2017-09-22 10:32   ` Jianbo Liu
2017-10-09  5:27     ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).