vppinfra: implement CLIB_PAUSE () for aarch64 platforms 33/22533/2
authorjaszha03 <[email protected]>
Fri, 27 Sep 2019 16:48:23 +0000 (11:48 -0500)
committerAndrew Yourtchenko <[email protected]>
Fri, 11 Oct 2019 11:44:48 +0000 (11:44 +0000)
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 <[email protected]>
Reviewed-by: Lijian Zhang <[email protected]>
(cherry picked from commit 18512b002da5da312aa2638b67a8ec4bb2c10236)

src/vppinfra/lock.h

index 49e849b..3cfe11c 100644 (file)
@@ -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