public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Michal Schorm <mschorm@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/mysql8.4] f44: Implement my_timer_cycles() on riscv64
Date: Fri, 06 Nov 2026 11:41:21 GMT [thread overview]
Message-ID: <179396528182.1.8471326141895569816.rpms-mysql8.4-6f2c195815e6@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/mysql8.4
Branch : f44
Commit : 6f2c195815e6af1eab81c117ddac5e5827450087
Author : Michal Schorm <mschorm@redhat.com>
Date : 2026-11-06T02:35:11+01:00
Stats : +72/-4 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/mysql8.4/c/6f2c195815e6af1eab81c117ddac5e5827450087?branch=f44
Log:
Implement my_timer_cycles() on riscv64
Rebased patch from Marcin Juszkiewicz (originally submitted against 8.4.11)
to the current 8.4.13 release.
The patch uses the time CSR (rdtime) instead of the unavailable cycle CSR
to provide a fixed-frequency counter on RISC-V, matching the aarch64
approach with cntvct_el0.
Upstream-status: https://github.com/mysql/mysql-server/pull/851
Co-Authored-By: Claude AI <noreply@anthropic.com>
---
diff --git a/mysql-rdtsc-riscv64.patch b/mysql-rdtsc-riscv64.patch
new file mode 100644
index 0000000..b2764ca
--- /dev/null
+++ b/mysql-rdtsc-riscv64.patch
@@ -0,0 +1,67 @@
+From c6d2d5d141f4b5446343f73fb3acabfa47065c0e Mon Sep 17 00:00:00 2001
+From: Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
+Date: Tue, 13 Oct 2026 10:51:50 +0200
+Subject: [PATCH] Implement my_timer_cycles() on riscv64
+
+There is no cycle counter for riscv64, so my_timer_cycles() returns 0 and
+performance_schema logs MY-011037 at every startup. That also makes mtr
+fail every test which restarts the server.
+
+The cycle CSR (rdcycle) is not readable from user mode on Linux, so use
+the time CSR instead - a fixed frequency counter, just like cntvct_el0
+used on aarch64.
+
+Assisted-by: LLM
+
+Upstream-status: https://github.com/mysql/mysql-server/pull/851
+
+---
+ include/my_rdtsc.h | 1 +
+ mysys/my_rdtsc.cc | 13 +++++++++++++
+ 2 files changed, 14 insertions(+)
+
+diff --git a/include/my_rdtsc.h b/include/my_rdtsc.h
+index 95baeb3f827..92e1a6d4677 100644
+--- a/include/my_rdtsc.h
++++ b/include/my_rdtsc.h
+@@ -138,5 +138,6 @@ void my_timer_init(MY_TIMER_INFO *mti);
+ #define MY_TIMER_ROUTINE_ASM_AARCH64 28
+ #define MY_TIMER_ROUTINE_GET_THREAD_TIMES 29
+ #define MY_TIMER_ROUTINE_ASM_S390X 30
++#define MY_TIMER_ROUTINE_ASM_RISCV64 31
+
+ #endif
+diff --git a/mysys/my_rdtsc.cc b/mysys/my_rdtsc.cc
+index 7b4583124d8..e33a6e9eee5 100644
+--- a/mysys/my_rdtsc.cc
++++ b/mysys/my_rdtsc.cc
+@@ -175,6 +175,17 @@ ulonglong my_timer_cycles() {
+ __asm __volatile__("stckf %0" : "=Q"(result) : : "cc");
+ return result;
+ }
++#elif defined(__GNUC__) && defined(__riscv) && __riscv_xlen == 64
++ {
++ /*
++ The cycle CSR (rdcycle) is not readable from user mode on Linux,
++ so use the time CSR instead. Like cntvct_el0 on aarch64 it is not
++ a cycle count but a fixed frequency counter.
++ */
++ ulonglong result;
++ __asm __volatile__("rdtime %0" : "=r"(result));
++ return result;
++ }
+ #elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
+ /* gethrtime may appear as either cycle or nanosecond counter */
+ return (ulonglong)gethrtime();
+@@ -506,6 +517,8 @@ void my_timer_init(MY_TIMER_INFO *mti) {
+ mti->cycles.routine = MY_TIMER_ROUTINE_ASM_AARCH64;
+ #elif defined(__GNUC__) && defined(__s390x__)
+ mti->cycles.routine = MY_TIMER_ROUTINE_ASM_S390X;
++#elif defined(__GNUC__) && defined(__riscv) && __riscv_xlen == 64
++ mti->cycles.routine = MY_TIMER_ROUTINE_ASM_RISCV64;
+ #elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
+ mti->cycles.routine = MY_TIMER_ROUTINE_GETHRTIME;
+ #else
+--
+2.56.0
+
diff --git a/mysql8.4.spec b/mysql8.4.spec
index 44e3a8d..3b50bce 100644
--- a/mysql8.4.spec
+++ b/mysql8.4.spec
@@ -99,7 +99,7 @@ ExcludeArch: %{ix86}
Name: %{majorname}%{majorversion}
Version: %{package_version}
-Release: 1%{?with_debug:.debug}%{?dist}
+Release: 2%{?with_debug:.debug}%{?dist}
Summary: MySQL client programs and shared libraries
URL: http://www.mysql.com
@@ -142,6 +142,7 @@ Patch52: %{pkgnamepatch}-rpath.patch
Patch54: %{pkgnamepatch}-gcc-15.patch
Patch56: %{pkgnamepatch}-flush-logrotate.patch
Patch57: %{pkgnamepatch}-fix-compilation-with-openssl4.patch
+Patch58: %{pkgnamepatch}-rdtsc-riscv64.patch
# Patches taken from boost 1.59
Patch112: boost-1.57.0-mpl-print.patch
@@ -1099,6 +1100,9 @@ popd
%endif
%changelog
+* Sat Oct 24 2026 Marcin Juszkiewicz <mjuszkiewicz@redhat.com> - 8.4.13-2
+- Implement my_timer_cycles() on riscv64
+
* Fri Oct 23 2026 Michal Schorm <mschorm@redhat.com> - 8.4.13-1
- Rebase to 8.4.13
diff --git a/rh-skipped-tests-list-riscv.list b/rh-skipped-tests-list-riscv.list
index 2bba0af..e69de29 100644
--- a/rh-skipped-tests-list-riscv.list
+++ b/rh-skipped-tests-list-riscv.list
@@ -1,3 +0,0 @@
-# Fails since 8.0.40
-# [Warning] [MY-011037] [Server] The CYCLE timer is not available. WAIT events in the performance_schema will not be timed.
-main.test_mysql_thd_store_service : BUG#0
reply other threads:[~2026-11-06 11:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179396528182.1.8471326141895569816.rpms-mysql8.4-6f2c195815e6@fedoraproject.org \
--to=mschorm@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox