X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=lib%2Flibrte_eal%2Fcommon%2Finclude%2Farch%2Fx86%2Frte_spinlock.h;h=577236a3e2d4052c0f47a2958e7510252552741c;hb=ba78d0104e4ce61135ffb26a39dac0d57b00824b;hp=02f95cbb65ef16e441be49e56ab970d7100ab416;hpb=97f17497d162afdb82c8704bf097f0fee3724b2e;p=deb_dpdk.git diff --git a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h index 02f95cbb..577236a3 100644 --- a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h +++ b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h @@ -94,27 +94,22 @@ rte_spinlock_trylock (rte_spinlock_t *sl) } #endif -static uint8_t rtm_supported; /* cache the flag to avoid the overhead - of the rte_cpu_get_flag_enabled function */ - -static inline void __attribute__((constructor)) -rte_rtm_init(void) -{ - rtm_supported = rte_cpu_get_flag_enabled(RTE_CPUFLAG_RTM); -} +extern uint8_t rte_rtm_supported; static inline int rte_tm_supported(void) { - return rtm_supported; + return rte_rtm_supported; } static inline int rte_try_tm(volatile int *lock) { - if (!rtm_supported) + int retries; + + if (!rte_rtm_supported) return 0; - int retries = RTE_RTM_MAX_RETRIES; + retries = RTE_RTM_MAX_RETRIES; while (likely(retries--)) {