eventdev: relax SMP barriers with C11 atomics
authorPhil Yang <phil.yang@arm.com>
Tue, 7 Jul 2020 15:54:53 +0000 (23:54 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 8 Jul 2020 16:16:41 +0000 (18:16 +0200)
commit030c2164117b87b7e81d06be9c228b555b00963e
treef86e5d22b8c78601680487e441e3148ba8aecea5
parente84d9c62c671a502022a3a81358cac702d6f3a15
eventdev: relax SMP barriers with C11 atomics

The impl_opaque field is shared between the timer arm and cancel
operations. Meanwhile, the state flag acts as a guard variable to
make sure the update of impl_opaque is synchronized. The original
code uses rte_smp barriers to achieve that. This patch uses C11
atomics with an explicit one-way memory barrier instead of full
barriers rte_smp_w/rmb() to avoid the unnecessary barrier on aarch64.

Since compilers can generate the same instructions for volatile and
non-volatile variable in C11 __atomics built-ins, so remain the volatile
keyword in front of state enum to avoid the ABI break issue.

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