mysql8.4/community-mysql-s390-tsc.patch

42 lines
1.7 KiB
Diff
Raw Normal View History

Support s390/s390x in performance schema's cycle-counting functions.
Filed upstream at http://bugs.mysql.com/bug.php?id=59953
2015-09-23 10:31:06 +00:00
diff -up --recursive mysql-5.7.9.orig/include/my_rdtsc.h mysql-5.7.9/include/my_rdtsc.h
--- mysql-5.7.9.orig/include/my_rdtsc.h 2015-10-12 08:21:33.000000000 +0200
+++ mysql-5.7.9/include/my_rdtsc.h 2015-11-10 16:33:36.037432669 +0100
@@ -125,6 +125,7 @@ C_MODE_END
#define MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME 26
#define MY_TIMER_ROUTINE_ASM_SUNPRO_X86_64 27
2015-09-23 10:31:06 +00:00
#define MY_TIMER_ROUTINE_ASM_AARCH64 28
+#define MY_TIMER_ROUTINE_ASM_S390 29
#endif
2015-09-23 10:31:06 +00:00
diff -up --recursive mysql-5.7.9.orig/mysys/my_rdtsc.c mysql-5.7.9/mysys/my_rdtsc.c
--- mysql-5.7.9.orig/mysys/my_rdtsc.c 2015-10-12 08:21:33.000000000 +0200
+++ mysql-5.7.9/mysys/my_rdtsc.c 2015-11-10 16:33:36.038432668 +0100
@@ -183,6 +183,13 @@ ulonglong my_timer_cycles(void)
__asm __volatile__ ("mrs %[rt],cntvct_el0" : [rt] "=r" (result));
return result;
}
+#elif defined(__GNUC__) && defined(__s390__)
+ /* covers both s390 and s390x */
+ {
+ ulonglong result;
+ __asm__ __volatile__ ("stck %0" : "=Q" (result) : : "cc");
2015-09-23 10:31:06 +00:00
+ return result;
+ }
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
/* gethrtime may appear as either cycle or nanosecond counter */
return (ulonglong) gethrtime();
2015-09-23 10:31:06 +00:00
@@ -487,6 +494,8 @@ void my_timer_init(MY_TIMER_INFO *mti)
mti->cycles.routine= MY_TIMER_ROUTINE_ASM_GCC_SPARC32;
2015-09-23 10:31:06 +00:00
#elif defined(__GNUC__) && defined(__aarch64__)
mti->cycles.routine= MY_TIMER_ROUTINE_ASM_AARCH64;
+#elif defined(__GNUC__) && defined(__s390__)
+ mti->cycles.routine= MY_TIMER_ROUTINE_ASM_S390;
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
mti->cycles.routine= MY_TIMER_ROUTINE_GETHRTIME;
#else