vppinfra: implement CLIB_PAUSE () for aarch64 platforms
Define CLIB_PAUSE () to generate the "yield" instruction. No significant
performance changes were observed for clib_spinlock_t and clib_rwlock_t.
Type: feature
Change-Id: I59eb996e61c7a16007517e57e6996567302c1657
Signed-off-by: Jason Zhang <jason.zhang2@arm.com>
Reviewed-by: Lijian Zhang <Lijian.Zhang@arm.com>
diff --git a/src/vppinfra/lock.h b/src/vppinfra/lock.h
index 49e849b..3cfe11c 100644
--- a/src/vppinfra/lock.h
+++ b/src/vppinfra/lock.h
@@ -21,6 +21,8 @@
#if __x86_64__
#define CLIB_PAUSE() __builtin_ia32_pause ()
+#elif defined (__aarch64__) || defined (__arm__)
+#define CLIB_PAUSE() __asm__ ("yield")
#else
#define CLIB_PAUSE()
#endif