patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] l3fwd-power: add Rx interrupt timeout
@ 2020-04-29 12:21 Anatoly Burakov
  2020-04-29 12:27 ` Hunt, David
  2020-04-30 10:49 ` [dpdk-stable] [PATCH v2] " Anatoly Burakov
  0 siblings, 2 replies; 7+ messages in thread
From: Anatoly Burakov @ 2020-04-29 12:21 UTC (permalink / raw)
  To: dev; +Cc: David Hunt, stable

Currently, thread waiting on an interrupt does not have a timeout, so
it will not ever wake up until traffic arrives. This means that, when
time comes to exit the application, it will not quit unless there
happens to be traffic coming in and waking up the thread from sleep.

Fix it so that the interrupt thread sleeps for 10ms before waking up
and attempting to poll again.

Fixes: 613ce6691c0d ("examples/l3fwd-power: implement proper shutdown")
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 examples/l3fwd-power/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 293b3da4ae..4112bbbee4 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -833,7 +833,7 @@ sleep_until_rx_interrupt(int num)
 		"lcore %u sleeps until interrupt triggers\n",
 		rte_lcore_id());
 
-	n = rte_epoll_wait(RTE_EPOLL_PER_THREAD, event, num, -1);
+	n = rte_epoll_wait(RTE_EPOLL_PER_THREAD, event, num, 10);
 	for (i = 0; i < n; i++) {
 		data = event[i].epdata.data;
 		port_id = ((uintptr_t)data) >> CHAR_BIT;
@@ -1306,7 +1306,8 @@ main_loop(__rte_unused void *dummy)
 					/**
 					 * start receiving packets immediately
 					 */
-					goto start_rx;
+					if (likely(!is_done()))
+						goto start_rx;
 				}
 			}
 			stats[lcore_id].sleep_time += lcore_idle_hint;
-- 
2.17.1

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

* Re: [dpdk-stable] [PATCH] l3fwd-power: add Rx interrupt timeout
  2020-04-29 12:21 [dpdk-stable] [PATCH] l3fwd-power: add Rx interrupt timeout Anatoly Burakov
@ 2020-04-29 12:27 ` Hunt, David
  2020-04-30 10:49 ` [dpdk-stable] [PATCH v2] " Anatoly Burakov
  1 sibling, 0 replies; 7+ messages in thread
From: Hunt, David @ 2020-04-29 12:27 UTC (permalink / raw)
  To: Anatoly Burakov, dev; +Cc: stable


On 29/4/2020 1:21 PM, Anatoly Burakov wrote:
> Currently, thread waiting on an interrupt does not have a timeout, so
> it will not ever wake up until traffic arrives. This means that, when
> time comes to exit the application, it will not quit unless there
> happens to be traffic coming in and waking up the thread from sleep.
>
> Fix it so that the interrupt thread sleeps for 10ms before waking up
> and attempting to poll again.
>
> Fixes: 613ce6691c0d ("examples/l3fwd-power: implement proper shutdown")
> Cc: stable@dpdk.org
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>   


Acked-by: David Hunt <david.hunt@intel.com>



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

* [dpdk-stable] [PATCH v2] l3fwd-power: add Rx interrupt timeout
  2020-04-29 12:21 [dpdk-stable] [PATCH] l3fwd-power: add Rx interrupt timeout Anatoly Burakov
  2020-04-29 12:27 ` Hunt, David
@ 2020-04-30 10:49 ` Anatoly Burakov
  2020-04-30 13:08   ` Hunt, David
  2020-05-07 10:46   ` [dpdk-stable] [PATCH v3] " Anatoly Burakov
  1 sibling, 2 replies; 7+ messages in thread
From: Anatoly Burakov @ 2020-04-30 10:49 UTC (permalink / raw)
  To: dev; +Cc: David Hunt, stable

Currently, thread waiting on an interrupt does not have a timeout, so
it will not ever wake up until traffic arrives. This means that, when
time comes to exit the application, it will not quit unless there
happens to be traffic coming in and waking up the thread from sleep.

Fix it so that the interrupt thread sleeps for 10ms before waking up
and attempting to poll again. Additionally, remove the log message
to avoid spamming about entering interrupt mode.

Fixes: 613ce6691c0d ("examples/l3fwd-power: implement proper shutdown")
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 examples/l3fwd-power/main.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 293b3da4ae..21fb15e1a2 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -829,11 +829,7 @@ sleep_until_rx_interrupt(int num)
 	uint8_t queue_id;
 	void *data;
 
-	RTE_LOG(INFO, L3FWD_POWER,
-		"lcore %u sleeps until interrupt triggers\n",
-		rte_lcore_id());
-
-	n = rte_epoll_wait(RTE_EPOLL_PER_THREAD, event, num, -1);
+	n = rte_epoll_wait(RTE_EPOLL_PER_THREAD, event, num, 10);
 	for (i = 0; i < n; i++) {
 		data = event[i].epdata.data;
 		port_id = ((uintptr_t)data) >> CHAR_BIT;
@@ -1306,7 +1302,8 @@ main_loop(__rte_unused void *dummy)
 					/**
 					 * start receiving packets immediately
 					 */
-					goto start_rx;
+					if (likely(!is_done()))
+						goto start_rx;
 				}
 			}
 			stats[lcore_id].sleep_time += lcore_idle_hint;
-- 
2.17.1

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

* Re: [dpdk-stable] [PATCH v2] l3fwd-power: add Rx interrupt timeout
  2020-04-30 10:49 ` [dpdk-stable] [PATCH v2] " Anatoly Burakov
@ 2020-04-30 13:08   ` Hunt, David
  2020-05-07 10:46   ` [dpdk-stable] [PATCH v3] " Anatoly Burakov
  1 sibling, 0 replies; 7+ messages in thread
From: Hunt, David @ 2020-04-30 13:08 UTC (permalink / raw)
  To: Anatoly Burakov, dev; +Cc: stable


On 30/4/2020 11:49 AM, Anatoly Burakov wrote:
> Currently, thread waiting on an interrupt does not have a timeout, so
> it will not ever wake up until traffic arrives. This means that, when
> time comes to exit the application, it will not quit unless there
> happens to be traffic coming in and waking up the thread from sleep.
>
> Fix it so that the interrupt thread sleeps for 10ms before waking up
> and attempting to poll again. Additionally, remove the log message
> to avoid spamming about entering interrupt mode.
>
> Fixes: 613ce6691c0d ("examples/l3fwd-power: implement proper shutdown")
> Cc: stable@dpdk.org
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---


Acked-by: David Hunt <david.hunt@intel.com>



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

* [dpdk-stable] [PATCH v3] l3fwd-power: add Rx interrupt timeout
  2020-04-30 10:49 ` [dpdk-stable] [PATCH v2] " Anatoly Burakov
  2020-04-30 13:08   ` Hunt, David
@ 2020-05-07 10:46   ` Anatoly Burakov
  2020-05-08  1:50     ` [dpdk-stable] [dpdk-dev] " Ma, LihongX
  2020-05-11 19:35     ` Thomas Monjalon
  1 sibling, 2 replies; 7+ messages in thread
From: Anatoly Burakov @ 2020-05-07 10:46 UTC (permalink / raw)
  To: dev; +Cc: David Hunt, stable

Currently, thread waiting on an interrupt does not have a timeout, so
it will not ever wake up until traffic arrives. This means that, when
time comes to exit the application, it will not quit unless there
happens to be traffic coming in and waking up the thread from sleep.

Fix it so that the interrupt thread sleeps for 10ms before waking up
and attempting to poll again. Additionally, remove the log message
to avoid spamming about entering interrupt mode.

Fixes: 613ce6691c0d ("examples/l3fwd-power: implement proper shutdown")
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
---

Notes:
    v3:
    - Turns out that log message was important, so
      bring it back, but prevent spam
    v2:
    - Remove log spam

 examples/l3fwd-power/main.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 293b3da4ae..23685c48fc 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -823,17 +823,24 @@ power_freq_scaleup_heuristic(unsigned lcore_id,
 static int
 sleep_until_rx_interrupt(int num)
 {
+	/*
+	 * we want to track when we are woken up by traffic so that we can go
+	 * back to sleep again without log spamming.
+	 */
+	static bool timeout;
 	struct rte_epoll_event event[num];
 	int n, i;
 	uint16_t port_id;
 	uint8_t queue_id;
 	void *data;
 
-	RTE_LOG(INFO, L3FWD_POWER,
-		"lcore %u sleeps until interrupt triggers\n",
-		rte_lcore_id());
+	if (!timeout) {
+		RTE_LOG(INFO, L3FWD_POWER,
+				"lcore %u sleeps until interrupt triggers\n",
+				rte_lcore_id());
+	}
 
-	n = rte_epoll_wait(RTE_EPOLL_PER_THREAD, event, num, -1);
+	n = rte_epoll_wait(RTE_EPOLL_PER_THREAD, event, num, 10);
 	for (i = 0; i < n; i++) {
 		data = event[i].epdata.data;
 		port_id = ((uintptr_t)data) >> CHAR_BIT;
@@ -844,6 +851,7 @@ sleep_until_rx_interrupt(int num)
 			" port %d queue %d\n",
 			rte_lcore_id(), port_id, queue_id);
 	}
+	timeout = n == 0;
 
 	return 0;
 }
@@ -1306,7 +1314,8 @@ main_loop(__rte_unused void *dummy)
 					/**
 					 * start receiving packets immediately
 					 */
-					goto start_rx;
+					if (likely(!is_done()))
+						goto start_rx;
 				}
 			}
 			stats[lcore_id].sleep_time += lcore_idle_hint;
-- 
2.17.1

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

* Re: [dpdk-stable] [dpdk-dev] [PATCH v3] l3fwd-power: add Rx interrupt timeout
  2020-05-07 10:46   ` [dpdk-stable] [PATCH v3] " Anatoly Burakov
@ 2020-05-08  1:50     ` Ma, LihongX
  2020-05-11 19:35     ` Thomas Monjalon
  1 sibling, 0 replies; 7+ messages in thread
From: Ma, LihongX @ 2020-05-08  1:50 UTC (permalink / raw)
  To: Burakov, Anatoly, dev; +Cc: Hunt, David, stable

Tested-by:ma,lihong<lihongx.ma@intel.com>

Regards,
Ma,lihong

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Anatoly Burakov
Sent: Thursday, May 7, 2020 6:46 PM
To: dev@dpdk.org
Cc: Hunt, David <david.hunt@intel.com>; stable@dpdk.org
Subject: [dpdk-dev] [PATCH v3] l3fwd-power: add Rx interrupt timeout

Currently, thread waiting on an interrupt does not have a timeout, so it will not ever wake up until traffic arrives. This means that, when time comes to exit the application, it will not quit unless there happens to be traffic coming in and waking up the thread from sleep.

Fix it so that the interrupt thread sleeps for 10ms before waking up and attempting to poll again. Additionally, remove the log message to avoid spamming about entering interrupt mode.

Fixes: 613ce6691c0d ("examples/l3fwd-power: implement proper shutdown")
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
---

Notes:
    v3:
    - Turns out that log message was important, so
      bring it back, but prevent spam
    v2:
    - Remove log spam

 examples/l3fwd-power/main.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 293b3da4ae..23685c48fc 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -823,17 +823,24 @@ power_freq_scaleup_heuristic(unsigned lcore_id,  static int  sleep_until_rx_interrupt(int num)  {
+	/*
+	 * we want to track when we are woken up by traffic so that we can go
+	 * back to sleep again without log spamming.
+	 */
+	static bool timeout;
 	struct rte_epoll_event event[num];
 	int n, i;
 	uint16_t port_id;
 	uint8_t queue_id;
 	void *data;
 
-	RTE_LOG(INFO, L3FWD_POWER,
-		"lcore %u sleeps until interrupt triggers\n",
-		rte_lcore_id());
+	if (!timeout) {
+		RTE_LOG(INFO, L3FWD_POWER,
+				"lcore %u sleeps until interrupt triggers\n",
+				rte_lcore_id());
+	}
 
-	n = rte_epoll_wait(RTE_EPOLL_PER_THREAD, event, num, -1);
+	n = rte_epoll_wait(RTE_EPOLL_PER_THREAD, event, num, 10);
 	for (i = 0; i < n; i++) {
 		data = event[i].epdata.data;
 		port_id = ((uintptr_t)data) >> CHAR_BIT; @@ -844,6 +851,7 @@ sleep_until_rx_interrupt(int num)
 			" port %d queue %d\n",
 			rte_lcore_id(), port_id, queue_id);
 	}
+	timeout = n == 0;
 
 	return 0;
 }
@@ -1306,7 +1314,8 @@ main_loop(__rte_unused void *dummy)
 					/**
 					 * start receiving packets immediately
 					 */
-					goto start_rx;
+					if (likely(!is_done()))
+						goto start_rx;
 				}
 			}
 			stats[lcore_id].sleep_time += lcore_idle_hint;
--
2.17.1

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

* Re: [dpdk-stable] [dpdk-dev] [PATCH v3] l3fwd-power: add Rx interrupt timeout
  2020-05-07 10:46   ` [dpdk-stable] [PATCH v3] " Anatoly Burakov
  2020-05-08  1:50     ` [dpdk-stable] [dpdk-dev] " Ma, LihongX
@ 2020-05-11 19:35     ` Thomas Monjalon
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2020-05-11 19:35 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, David Hunt, stable

07/05/2020 12:46, Anatoly Burakov:
> Currently, thread waiting on an interrupt does not have a timeout, so
> it will not ever wake up until traffic arrives. This means that, when
> time comes to exit the application, it will not quit unless there
> happens to be traffic coming in and waking up the thread from sleep.
> 
> Fix it so that the interrupt thread sleeps for 10ms before waking up
> and attempting to poll again. Additionally, remove the log message
> to avoid spamming about entering interrupt mode.
> 
> Fixes: 613ce6691c0d ("examples/l3fwd-power: implement proper shutdown")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> Acked-by: David Hunt <david.hunt@intel.com>

Applied, thanks




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

end of thread, other threads:[~2020-05-11 19:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 12:21 [dpdk-stable] [PATCH] l3fwd-power: add Rx interrupt timeout Anatoly Burakov
2020-04-29 12:27 ` Hunt, David
2020-04-30 10:49 ` [dpdk-stable] [PATCH v2] " Anatoly Burakov
2020-04-30 13:08   ` Hunt, David
2020-05-07 10:46   ` [dpdk-stable] [PATCH v3] " Anatoly Burakov
2020-05-08  1:50     ` [dpdk-stable] [dpdk-dev] " Ma, LihongX
2020-05-11 19:35     ` Thomas Monjalon

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).