DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] stack: reload head when pop fails (generic)
@ 2021-08-19  9:39 Julien Meunier
  2021-09-21 16:17 ` [dpdk-dev] [PATCH v2] stack: fix reload head when pop fails Julien Meunier
  0 siblings, 1 reply; 4+ messages in thread
From: Julien Meunier @ 2021-08-19  9:39 UTC (permalink / raw)
  To: dev; +Cc: stable, gage.eads, Olivier Matz

The previous fix 18effad9cfa7 ("stack: reload head when pop fails") only
changed C11 implementation, not generic implementation.

List head must be loaded right before continue (when failed to find the
new head). Without this, one thread might keep trying and failing to pop
items without ever loading the new correct head.

Fixes: 3340202f5954 ("stack: add lock-free implementation")
Cc: gage.eads@intel.com
Cc: stable@dpdk.org

Signed-off-by: Julien Meunier <julien.meunier@nokia.com>
---
 lib/stack/rte_stack_lf_generic.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/stack/rte_stack_lf_generic.h b/lib/stack/rte_stack_lf_generic.h
index 4850a05ee7..7fa29cedb2 100644
--- a/lib/stack/rte_stack_lf_generic.h
+++ b/lib/stack/rte_stack_lf_generic.h
@@ -128,8 +128,10 @@ __rte_stack_lf_pop_elems(struct rte_stack_lf_list *list,
 		/* If NULL was encountered, the list was modified while
 		 * traversing it. Retry.
 		 */
-		if (i != num)
+		if (i != num) {
+			old_head = list->head;
 			continue;
+		}
 
 		new_head.top = tmp;
 		new_head.cnt = old_head.cnt + 1;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2] stack: fix reload head when pop fails
  2021-08-19  9:39 [dpdk-dev] [PATCH] stack: reload head when pop fails (generic) Julien Meunier
@ 2021-09-21 16:17 ` Julien Meunier
  2021-09-24  8:57   ` Olivier Matz
  0 siblings, 1 reply; 4+ messages in thread
From: Julien Meunier @ 2021-09-21 16:17 UTC (permalink / raw)
  To: dev; +Cc: stable, Olivier Matz

The previous commit 18effad9cfa7 ("stack: reload head when pop fails")
only changed C11 implementation, not generic implementation.

List head must be loaded right before continue (when failed to find the
new head). Without this, one thread might keep trying and failing to pop
items without ever loading the new correct head.

Fixes: 3340202f5954 ("stack: add lock-free implementation")
Cc: stable@dpdk.org

Signed-off-by: Julien Meunier <julien.meunier@nokia.com>
---
v2:
* rebase
* update commit log + remove invalid CC email address

lib/stack/rte_stack_lf_generic.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/stack/rte_stack_lf_generic.h b/lib/stack/rte_stack_lf_generic.h
index 4850a05ee7..7fa29cedb2 100644
--- a/lib/stack/rte_stack_lf_generic.h
+++ b/lib/stack/rte_stack_lf_generic.h
@@ -128,8 +128,10 @@ __rte_stack_lf_pop_elems(struct rte_stack_lf_list *list,
 		/* If NULL was encountered, the list was modified while
 		 * traversing it. Retry.
 		 */
-		if (i != num)
+		if (i != num) {
+			old_head = list->head;
 			continue;
+		}

 		new_head.top = tmp;
 		new_head.cnt = old_head.cnt + 1;
--
2.17.1


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

* Re: [dpdk-dev] [PATCH v2] stack: fix reload head when pop fails
  2021-09-21 16:17 ` [dpdk-dev] [PATCH v2] stack: fix reload head when pop fails Julien Meunier
@ 2021-09-24  8:57   ` Olivier Matz
  2021-09-27 15:47     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Olivier Matz @ 2021-09-24  8:57 UTC (permalink / raw)
  To: Julien Meunier; +Cc: dev, stable

Hello,

On Tue, Sep 21, 2021 at 06:17:24PM +0200, Julien Meunier wrote:
> The previous commit 18effad9cfa7 ("stack: reload head when pop fails")
> only changed C11 implementation, not generic implementation.
> 
> List head must be loaded right before continue (when failed to find the
> new head). Without this, one thread might keep trying and failing to pop
> items without ever loading the new correct head.
> 
> Fixes: 3340202f5954 ("stack: add lock-free implementation")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Julien Meunier <julien.meunier@nokia.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

Thanks Julien!

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

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2] stack: fix reload head when pop fails
  2021-09-24  8:57   ` Olivier Matz
@ 2021-09-27 15:47     ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2021-09-27 15:47 UTC (permalink / raw)
  To: Julien Meunier; +Cc: stable, dev, Olivier Matz

24/09/2021 10:57, Olivier Matz:
> Hello,
> 
> On Tue, Sep 21, 2021 at 06:17:24PM +0200, Julien Meunier wrote:
> > The previous commit 18effad9cfa7 ("stack: reload head when pop fails")
> > only changed C11 implementation, not generic implementation.
> > 
> > List head must be loaded right before continue (when failed to find the
> > new head). Without this, one thread might keep trying and failing to pop
> > items without ever loading the new correct head.
> > 
> > Fixes: 3340202f5954 ("stack: add lock-free implementation")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Julien Meunier <julien.meunier@nokia.com>
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

Applied, thanks.



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

end of thread, other threads:[~2021-09-27 15:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19  9:39 [dpdk-dev] [PATCH] stack: reload head when pop fails (generic) Julien Meunier
2021-09-21 16:17 ` [dpdk-dev] [PATCH v2] stack: fix reload head when pop fails Julien Meunier
2021-09-24  8:57   ` Olivier Matz
2021-09-27 15:47     ` [dpdk-dev] [dpdk-stable] " 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).