[dpdk-dev] [PATCH v2] eal/ppc64: improve rte_rdtsc with ppc_get_timebase
david.marchand at redhat.com
Wed Feb 5 22:29:22 CET 2020
On Fri, Jan 31, 2020 at 11:04 PM Thinh Tran <thinhtr at linux.vnet.ibm.com> wrote:
> __ppc_get_timebase() is GNU extension and is more efficient
The commit title and log are quite short and give little idea on what
this is about.
I had a look at this glibc helper:
/* Read the Time Base Register. */
static __inline__ uint64_t
#if __GNUC_PREREQ (4, 8)
return __builtin_ppc_get_timebase ();
# ifdef __powerpc64__
/* "volatile" is necessary here, because the user expects this assembly
isn't moved after an optimization. */
__asm__ volatile ("mfspr %0, 268" : "=r" (__tb));
# else /* not __powerpc64__ */
uint32_t __tbu, __tbl, __tmp; \
__asm__ volatile ("0:\n\t"
"cmpw %0, %2\n\t"
: "=r" (__tbu), "=r" (__tbl), "=r" (__tmp));
return (((uint64_t) __tbu << 32) | __tbl);
# endif /* not __powerpc64__ */
The last block is exactly the code we had in dpdk.
So I suppose we are trying to use mfspr for register 268 which seems
linked to timebase (looking at the linux kernel sources).
Please, confirm this is an enhancement (and how this improves current
More information about the dev