DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] lib/distributor: fix segfaults in flush
@ 2017-04-13  8:36 David Hunt
  2017-04-14  6:04 ` Liu, Yong
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: David Hunt @ 2017-04-13  8:36 UTC (permalink / raw)
  To: dev; +Cc: David Hunt

A segfault when flushing packets has been revealed by further testing
when using distributor in single packet mode. This patch resolves that.

Fixes: 775003ad2f96 ("distributor: add new burst-capable library")

Reported-by: Yong Liu <yong.liu@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 lib/librte_distributor/rte_distributor.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c
index 4725904..e4dfa7f 100644
--- a/lib/librte_distributor/rte_distributor.c
+++ b/lib/librte_distributor/rte_distributor.c
@@ -555,7 +555,7 @@ total_outstanding(const struct rte_distributor *d)
 int
 rte_distributor_flush_v1705(struct rte_distributor *d)
 {
-	const unsigned int flushed = total_outstanding(d);
+	unsigned int flushed;
 	unsigned int wkr;
 
 	if (d->alg_type == RTE_DIST_ALG_SINGLE) {
@@ -563,6 +563,8 @@ rte_distributor_flush_v1705(struct rte_distributor *d)
 		return rte_distributor_flush_v20(d->d_v20);
 	}
 
+	flushed = total_outstanding(d);
+
 	while (total_outstanding(d) > 0)
 		rte_distributor_process(d, NULL, 0);
 
@@ -590,6 +592,7 @@ rte_distributor_clear_returns_v1705(struct rte_distributor *d)
 	if (d->alg_type == RTE_DIST_ALG_SINGLE) {
 		/* Call the old API */
 		rte_distributor_clear_returns_v20(d->d_v20);
+		return;
 	}
 
 	/* throw away returns, so workers can exit */
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v1] lib/distributor: fix segfaults in flush
  2017-04-13  8:36 [dpdk-dev] [PATCH v1] lib/distributor: fix segfaults in flush David Hunt
@ 2017-04-14  6:04 ` Liu, Yong
  2017-04-14  8:41 ` Bruce Richardson
  2017-04-14  8:59 ` [dpdk-dev] [PATCH v2] " David Hunt
  2 siblings, 0 replies; 5+ messages in thread
From: Liu, Yong @ 2017-04-14  6:04 UTC (permalink / raw)
  To: Hunt, David, dev; +Cc: Hunt, David

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of David Hunt
> Sent: Thursday, April 13, 2017 4:36 PM
> To: dev@dpdk.org
> Cc: Hunt, David <david.hunt@intel.com>
> Subject: [dpdk-dev] [PATCH v1] lib/distributor: fix segfaults in flush
> 
> A segfault when flushing packets has been revealed by further testing
> when using distributor in single packet mode. This patch resolves that.
> 
> Fixes: 775003ad2f96 ("distributor: add new burst-capable library")
> 
> Reported-by: Yong Liu <yong.liu@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> ---

Tested-by: Yong Liu <yong.liu@intel.com>	

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

* Re: [dpdk-dev] [PATCH v1] lib/distributor: fix segfaults in flush
  2017-04-13  8:36 [dpdk-dev] [PATCH v1] lib/distributor: fix segfaults in flush David Hunt
  2017-04-14  6:04 ` Liu, Yong
@ 2017-04-14  8:41 ` Bruce Richardson
  2017-04-14  8:59 ` [dpdk-dev] [PATCH v2] " David Hunt
  2 siblings, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2017-04-14  8:41 UTC (permalink / raw)
  To: David Hunt; +Cc: dev

On Thu, Apr 13, 2017 at 09:36:27AM +0100, David Hunt wrote:
> A segfault when flushing packets has been revealed by further testing
> when using distributor in single packet mode. This patch resolves that.
> 
> Fixes: 775003ad2f96 ("distributor: add new burst-capable library")
> 
> Reported-by: Yong Liu <yong.liu@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>

Hi Dave,

I think you could do with giving more details in the commit messaage on
how/why the error occurs and how exactly this patch fixes it.

With expanded commit log message:
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

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

* [dpdk-dev] [PATCH v2] lib/distributor: fix segfaults in flush
  2017-04-13  8:36 [dpdk-dev] [PATCH v1] lib/distributor: fix segfaults in flush David Hunt
  2017-04-14  6:04 ` Liu, Yong
  2017-04-14  8:41 ` Bruce Richardson
@ 2017-04-14  8:59 ` David Hunt
  2017-04-20 23:05   ` Thomas Monjalon
  2 siblings, 1 reply; 5+ messages in thread
From: David Hunt @ 2017-04-14  8:59 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, David Hunt

Occasionally, the distributor single-packet-at-a-time mode will
segfault because it inadvertently calls some burst mode code when
flushing packets.

This patch ensures that only the v20 (single mode) codepath is used, and
returns without falling through to the burst mode code.

Fixes: 775003ad2f96 ("distributor: add new burst-capable library")

v2: Extented commit message. Patch remains the same.

Signed-off-by: David Hunt <david.hunt@intel.com>
Tested-by: Yong Liu <yong.liu@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/librte_distributor/rte_distributor.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c
index 4725904..e4dfa7f 100644
--- a/lib/librte_distributor/rte_distributor.c
+++ b/lib/librte_distributor/rte_distributor.c
@@ -555,7 +555,7 @@ total_outstanding(const struct rte_distributor *d)
 int
 rte_distributor_flush_v1705(struct rte_distributor *d)
 {
-	const unsigned int flushed = total_outstanding(d);
+	unsigned int flushed;
 	unsigned int wkr;
 
 	if (d->alg_type == RTE_DIST_ALG_SINGLE) {
@@ -563,6 +563,8 @@ rte_distributor_flush_v1705(struct rte_distributor *d)
 		return rte_distributor_flush_v20(d->d_v20);
 	}
 
+	flushed = total_outstanding(d);
+
 	while (total_outstanding(d) > 0)
 		rte_distributor_process(d, NULL, 0);
 
@@ -590,6 +592,7 @@ rte_distributor_clear_returns_v1705(struct rte_distributor *d)
 	if (d->alg_type == RTE_DIST_ALG_SINGLE) {
 		/* Call the old API */
 		rte_distributor_clear_returns_v20(d->d_v20);
+		return;
 	}
 
 	/* throw away returns, so workers can exit */
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v2] lib/distributor: fix segfaults in flush
  2017-04-14  8:59 ` [dpdk-dev] [PATCH v2] " David Hunt
@ 2017-04-20 23:05   ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2017-04-20 23:05 UTC (permalink / raw)
  To: David Hunt; +Cc: dev, bruce.richardson

14/04/2017 10:59, David Hunt:
> Occasionally, the distributor single-packet-at-a-time mode will
> segfault because it inadvertently calls some burst mode code when
> flushing packets.
> 
> This patch ensures that only the v20 (single mode) codepath is used, and
> returns without falling through to the burst mode code.
> 
> Fixes: 775003ad2f96 ("distributor: add new burst-capable library")
> 
> v2: Extented commit message. Patch remains the same.
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>
> Tested-by: Yong Liu <yong.liu@intel.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Applied, thanks

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

end of thread, other threads:[~2017-04-20 23:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-13  8:36 [dpdk-dev] [PATCH v1] lib/distributor: fix segfaults in flush David Hunt
2017-04-14  6:04 ` Liu, Yong
2017-04-14  8:41 ` Bruce Richardson
2017-04-14  8:59 ` [dpdk-dev] [PATCH v2] " David Hunt
2017-04-20 23:05   ` 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).