Commit 64824a76 authored by Daniel Black's avatar Daniel Black

MDEV-8684: UT_RELAX_CPU on Power to non-empty expansion

Using __ppc_get_timebase will translate to mfspr instruction
The mfspr instruction will block FXU1 until complete but the other
Pipelines are available for execution of instructions from other
SMT threads on the same core.

The latency time to read the timebase SPR is ~10 cycles.

So any impact on other threads is limited other FXU1 only instructions
(basically other mfspr/mtspr ops).

Suggested by Steven J. Munroe, Linux on Power Toolchain Architect,
Linux Technology Center
IBM Corporation
parent 3d1a7cba
......@@ -88,6 +88,11 @@ private:
the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
independent way by using YieldProcessor. */
# define UT_RELAX_CPU() YieldProcessor()
# elif defined(__powerpc__)
#include <sys/platform/ppc.h>
# define UT_RELAX_CPU() do { \
volatile lint volatile_var = __ppc_get_timebase(); \
} while (0)
# else
# define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
# endif
......
......@@ -85,6 +85,11 @@ private:
the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
independent way by using YieldProcessor. */
# define UT_RELAX_CPU() YieldProcessor()
# elif defined(__powerpc__)
#include <sys/platform/ppc.h>
# define UT_RELAX_CPU() do { \
volatile lint volatile_var = __ppc_get_timebase(); \
} while (0)
# else
# define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
# endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment