eventdev: fix race condition on timer list counter
authorPhil Yang <phil.yang@arm.com>
Tue, 7 Jul 2020 15:54:50 +0000 (23:54 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 8 Jul 2020 16:16:41 +0000 (18:16 +0200)
commitaceb737d6f3210556a139514d304bf8f315a043f
tree57076a66d7ee62f18483c8bc96e6f9391d8ba854
parenta0e437cc655f1f557d2b1fecfe3f50c6e70e7336
eventdev: fix race condition on timer list counter

The n_poll_lcores counter and poll_lcore array are shared between lcores
and the update of these variables are out of the protection of spinlock
on each lcore timer list. The read-modify-write operations of the counter
are not atomic, so it has the potential of race condition between lcores.

Use c11 atomics with RELAXED ordering to prevent confliction.

Fixes: cc7b73ea9e3b ("eventdev: add new software timer adapter")
Cc: stable@dpdk.org
Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
lib/librte_eventdev/rte_event_timer_adapter.c