Discussion:
MariaDB 10.11 issue on armel/armhf
(too old to reply)
Otto Kekäläinen
2023-01-17 03:30:01 UTC
Permalink
Hi!

Are there any ARM experts here interested in helping MariaDB 10.11 run
better on armel/armhf?

The issue is explained well in upstream bug
https://jira.mariadb.org/browse/MDEV-30411 but upstream is not
investing developers/testing into armel/armhf, so I wanted to check if
anybody here could help.

Basically the upstream header
https://github.com/MariaDB/server/tree/10.11/include/my_rdtsc.h needs
to be extended to handle armel/armhf (and maybe also mipsel and
mips64el) properly so it would make all official Debian architectures
happy.

- Otto

PS. I am not on the list, please Reply-to-All
Jeffrey Walton
2023-01-17 04:10:01 UTC
Permalink
Post by Otto Kekäläinen
Are there any ARM experts here interested in helping MariaDB 10.11 run
better on armel/armhf?
The issue is explained well in upstream bug
https://jira.mariadb.org/browse/MDEV-30411 but upstream is not
investing developers/testing into armel/armhf, so I wanted to check if
anybody here could help.
Basically the upstream header
https://github.com/MariaDB/server/tree/10.11/include/my_rdtsc.h needs
to be extended to handle armel/armhf (and maybe also mipsel and
mips64el) properly so it would make all official Debian architectures
happy.
I believe Andy Polyakov performed the heavy lifting for OpenSSL. I
would check the OpenSSL code. It should not be much more than a
copy/paste. Or if you don't like the license, convert the *.pl file to
a source file to see how OpenSSL does it, then write your own.

openssl$ grep -IR rdtsc | ...

crypto/alphacpuid.pl:.end OPENSSL_rdtsc
crypto/alphacpuid.pl:.ent OPENSSL_rdtsc
crypto/alphacpuid.pl:.globl OPENSSL_rdtsc
crypto/alphacpuid.pl:OPENSSL_rdtsc:
crypto/armcap.c:uint32_t OPENSSL_rdtsc(void)
crypto/c64xpluscpuid.pl: .asg OPENSSL_rdtsc,_OPENSSL_rdtsc
crypto/c64xpluscpuid.pl: .global _OPENSSL_rdtsc
crypto/c64xpluscpuid.pl:_OPENSSL_rdtsc:
crypto/cpuid.c:uint32_t OPENSSL_rdtsc(void)
crypto/ia64cpuid.S:.endp OPENSSL_rdtsc#
crypto/ia64cpuid.S:.global OPENSSL_rdtsc#
crypto/ia64cpuid.S:.proc OPENSSL_rdtsc#
crypto/ia64cpuid.S:OPENSSL_rdtsc:
crypto/loongarch64cpuid.pl:# uint32_t OPENSSL_rdtsc(void)
crypto/loongarch64cpuid.pl:.globl OPENSSL_rdtsc
crypto/loongarch64cpuid.pl:.type OPENSSL_rdtsc,\@function
crypto/loongarch64cpuid.pl:OPENSSL_rdtsc:
crypto/pariscid.pl: .EXPORT OPENSSL_rdtsc,ENTRY
crypto/pariscid.pl:OPENSSL_rdtsc
crypto/ppccap.c: OPENSSL_rdtsc_mfspr268();
crypto/ppccap.c: OPENSSL_rdtsc_mftb();
crypto/ppccap.c: return OPENSSL_rdtsc_mfspr268();
crypto/ppccap.c: return OPENSSL_rdtsc_mftb();
crypto/ppccap.c:long OPENSSL_rdtsc_mfspr268(void);
crypto/ppccap.c:long OPENSSL_rdtsc_mftb(void);
crypto/ppccap.c:uint32_t OPENSSL_rdtsc(void)
crypto/ppccpuid.pl:.OPENSSL_rdtsc_mfspr268:
crypto/ppccpuid.pl:.OPENSSL_rdtsc_mftb:
crypto/ppccpuid.pl:.globl .OPENSSL_rdtsc_mfspr268
crypto/ppccpuid.pl:.globl .OPENSSL_rdtsc_mftb
crypto/riscvcap.c:uint32_t OPENSSL_rdtsc(void)
crypto/s390xcpuid.pl:.globl OPENSSL_rdtsc
crypto/s390xcpuid.pl:.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
crypto/s390xcpuid.pl:.type OPENSSL_rdtsc,\@function
crypto/s390xcpuid.pl:OPENSSL_rdtsc:
crypto/sparcv9cap.c:uint32_t OPENSSL_rdtsc(void)
crypto/x86_64cpuid.pl: rdtsc
crypto/x86_64cpuid.pl: rdtsc # collect 1st diff
crypto/x86_64cpuid.pl: rdtsc # collect 1st tick
crypto/x86_64cpuid.pl:.Loop: rdtsc
crypto/x86_64cpuid.pl:.globl OPENSSL_rdtsc
crypto/x86_64cpuid.pl:.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
crypto/x86_64cpuid.pl:.type OPENSSL_rdtsc,\@abi-omnipotent
crypto/x86_64cpuid.pl:OPENSSL_rdtsc:
crypto/x86cpuid.pl: &rdtsc ();

You can convert a *.pl file to a source file that can be assembled or
compiled by following the instructions at
https://wiki.openssl.org/index.php/Cryptogams_AES or
https://wiki.openssl.org/index.php/Cryptogams_SHA.

Jeff
John Paul Adrian Glaubitz
2023-01-17 08:20:01 UTC
Permalink
Hi Jeffrey!
Post by Jeffrey Walton
I believe Andy Polyakov performed the heavy lifting for OpenSSL. I
would check the OpenSSL code. It should not be much more than a
copy/paste. Or if you don't like the license, convert the *.pl file to
a source file to see how OpenSSL does it, then write your own.
openssl$ grep -IR rdtsc | ...
(...)
You can convert a *.pl file to a source file that can be assembled or
compiled by following the instructions at
https://wiki.openssl.org/index.php/Cryptogams_AES or
https://wiki.openssl.org/index.php/Cryptogams_SHA.
Thanks for this very useful reference. I think, this should give the MariaDB developers
all the information they need to implement the rdtsc calls for the remaining architectures.

Wondering why they simply didn't use the OpenSSL code, the license shouldn't be a problem,
should it?

Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
John Paul Adrian Glaubitz
2023-01-17 19:50:01 UTC
Permalink
Hello Otto!
Thanks for the pointers!
I suspect MariaDB developers will not do any code changes. The patch to fix
https://github.com/MariaDB/server/tree/10.11/include/my_rdtsc.h needs to come
from somebody with easy access to armel/armhf/mipsel/mips64el to test the patch
and the knowledge to argument why the code change is correct.
https://gcc.gnu.org/wiki/CompileFarm
Access to ARM32 platforms is available to anyone with a Raspberry Pi.

Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Otto Kekäläinen
2023-01-17 20:00:01 UTC
Permalink
Thanks for the pointers!

I suspect MariaDB developers will not do any code changes. The patch to fix
https://github.com/MariaDB/server/tree/10.11/include/my_rdtsc.h needs to
come from somebody with easy access to armel/armhf/mipsel/mips64el to test
the patch and the knowledge to argument why the code change is correct.

Anybody here willing to take a stab on it?

Loading...