Skip to content
Permalink
Browse files
Cleanup UT_LOW_PRIORITY_CPU/UT_RESUME_PRIORITY_CPU
Server already has HMT_low/HMT_medium.
  • Loading branch information
Sergey Vojtovich committed Nov 28, 2017
1 parent 1c4968f commit a489d91
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 29 deletions.
@@ -191,7 +191,6 @@
#cmakedefine HAVE_PREAD 1
#cmakedefine HAVE_PAUSE_INSTRUCTION 1
#cmakedefine HAVE_FAKE_PAUSE_INSTRUCTION 1
#cmakedefine HAVE_HMT_PRIORITY_INSTRUCTION 1
#cmakedefine HAVE_RDTSCLL 1
#cmakedefine HAVE_READ_REAL_TIME 1
#cmakedefine HAVE_PTHREAD_ATTR_CREATE 1
@@ -792,17 +792,6 @@ IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)
}
" HAVE_FAKE_PAUSE_INSTRUCTION)
ENDIF()
IF (NOT HAVE_PAUSE_INSTRUCTION)
CHECK_C_SOURCE_COMPILES("
#include <sys/platform/ppc.h>
int main()
{
__ppc_set_ppr_low();
__ppc_set_ppr_med();
return 0;
}
" HAVE_HMT_PRIORITY_INSTRUCTION)
ENDIF()
ENDIF()

CHECK_SYMBOL_EXISTS(tcgetattr "termios.h" HAVE_TCGETATTR 1)
@@ -21,17 +21,18 @@
The defines are the same ones used by the linux kernel
*/

#if defined(__powerpc__)
#ifdef _ARCH_PWR8
#include <sys/platform/ppc.h>
/* Very low priority */
#define HMT_very_low() asm volatile("or 31,31,31")
#define HMT_very_low() __ppc_set_ppr_very_low()
/* Low priority */
#define HMT_low() asm volatile("or 1,1,1")
#define HMT_low() __ppc_set_ppr_low()
/* Medium low priority */
#define HMT_medium_low() asm volatile("or 6,6,6")
#define HMT_medium_low() __ppc_set_ppr_med_low()
/* Medium priority */
#define HMT_medium() asm volatile("or 2,2,2")
#define HMT_medium() __ppc_set_ppr_med()
/* Medium high priority */
#define HMT_medium_high() asm volatile("or 5,5,5")
#define HMT_medium_high() __ppc_set_ppr_med_high()
/* High priority */
#define HMT_high() asm volatile("or 3,3,3")
#else
@@ -89,15 +89,6 @@ typedef time_t ib_time_t;
# define UT_COMPILER_BARRIER()
#endif

#if defined(HAVE_HMT_PRIORITY_INSTRUCTION)
# include <sys/platform/ppc.h>
# define UT_LOW_PRIORITY_CPU() __ppc_set_ppr_low()
# define UT_RESUME_PRIORITY_CPU() __ppc_set_ppr_med()
#else
# define UT_LOW_PRIORITY_CPU() ((void)0)
# define UT_RESUME_PRIORITY_CPU() ((void)0)
#endif

/*********************************************************************//**
Delays execution for at most max_wait_us microseconds or returns earlier
if cond becomes true.
@@ -37,6 +37,7 @@ Created 5/11/1994 Heikki Tuuri
#include "trx0trx.h"
#include <string>
#include "log.h"
#include "my_cpu.h"

#ifdef _WIN32
/*****************************************************************//**
@@ -290,14 +291,14 @@ ut_delay(
{
ulint i;

UT_LOW_PRIORITY_CPU();
HMT_low();

for (i = 0; i < delay * 50; i++) {
UT_RELAX_CPU();
UT_COMPILER_BARRIER();
}

UT_RESUME_PRIORITY_CPU();
HMT_medium();
}

/*************************************************************//**

3 comments on commit a489d91

@svoj
Copy link

@svoj svoj commented on a489d91 Nov 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grooverdan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works for me. Where you going to bring the UT_RELAX_CPU and UT_COMPILER_BARRIER definitions into ut0ut.cc directly?

@svoj
Copy link

@svoj svoj commented on a489d91 Nov 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure yet. I'm just playing with this code, but apparently my current experiments don't work well on ARM. They're in 952b57d and fabc368.

Please sign in to comment.