From: Steven Lariau Date: Fri, 25 Sep 2020 17:43:38 +0000 (+0100) Subject: stack: reload head when pop fails X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=18effad9cfa7ab077712c9d37672c3ae1bbf9213;p=dpdk.git stack: reload head when pop fails 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: 7e6e609939a8 ("stack: add C11 atomic implementation") Cc: gage.eads@intel.com Cc: stable@dpdk.org Signed-off-by: Steven Lariau Reviewed-by: Dharmik Thakkar Reviewed-by: Ruifeng Wang Acked-by: Gage Eads --- diff --git a/lib/librte_stack/rte_stack_lf_c11.h b/lib/librte_stack/rte_stack_lf_c11.h index 2bc6394194..adb9f590de 100644 --- a/lib/librte_stack/rte_stack_lf_c11.h +++ b/lib/librte_stack/rte_stack_lf_c11.h @@ -133,8 +133,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;