timer: relax barrier for status update
authorPhil Yang <phil.yang@arm.com>
Sun, 26 Apr 2020 14:45:15 +0000 (22:45 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 26 Apr 2020 20:07:38 +0000 (22:07 +0200)
commit2f89dc2ed7832845203e92d6c293bda62a7682e0
tree5ef3e158c5545abb8aefe0c081a92776f76772fc
parent9ca37645c7935f63ac1f8ec9b7c3548d89462f00
timer: relax barrier for status update

Volatile has no ordering semantics. The rte_timer structure defines
timer status as a volatile variable and uses the rte_r/wmb barrier
to guarantee inter-thread visibility.

This patch optimized the volatile operation with c11 atomic operations
and one-way barrier to save the performance penalty. According to the
timer_perf_autotest benchmarking results, this patch can uplift 10%~16%
timer appending performance, 3%~20% timer resetting performance and 45%
timer callbacks scheduling performance on aarch64 and no loss in
performance for x86.

Suggested-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
lib/librte_timer/rte_timer.c