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: 7e6e609939 ("stack: add C11 atomic implementation")
Cc: gage.eads@intel.com
Cc: stable@dpdk.org

Signed-off-by: Steven Lariau <steven.lariau@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Gage Eads <gage.eads@intel.com>
This commit is contained in:
Steven Lariau 2020-09-25 18:43:38 +01:00 committed by David Marchand
parent 2cdfe4e577
commit 18effad9cf

View File

@ -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;