[MXS-3750] 6.1.1 CentOS7 x86_64 RPMs fail on older CPUs without avx2 extension Created: 2021-08-31  Updated: 2021-10-06  Resolved: 2021-09-22

Status: Closed
Project: MariaDB MaxScale
Component/s: Core
Affects Version/s: 6.1.1
Fix Version/s: 6.1.2

Type: Bug Priority: Major
Reporter: Hartmut Holzgraefe Assignee: Niclas Antti
Resolution: Fixed Votes: 0
Labels: None
Environment:

CentOS7, Xeon(R) CPU E5-2660 v2 model (first released 2013)


Issue Links:
Duplicate
is duplicated by MXS-3754 maxscale-6.1.1-1.rhel.8.x86_64 crashe... Closed
Problem/Incident
is caused by MXS-3757 Don't allow any SIMD code run until c... Closed

 Description   

This fails with an invalid opcode exception when running on a Xeon(R) CPU E5-2660 v2 model (first released 2013), but works on a slightly more recent Xeon(R) CPU E5-2676 v3 from 2014.

One of the difference between the two models is that both support avx, but only the newer model also supports avx2 extensions.

Crashes already when trying to run "maxscale --version"

Backtrace:

Thread 1 (Thread 0x7f03d32dcf40 (LWP 26311)):
#0 0x00007f03d2e1f3b8 in maxsimd::simd256::make_ascii_bitmap (chars="\"'`/#-\\") at /home/timofey_turenko_mariadb_com/MaxScale/maxutils/maxsimd/src/impl/simd256.cc:64
ch = 92 '\\'
__for_range = "\"'`/#-\\"
bitmap = {_M_elems = "@\000\004\004\000\000\000\004\000\000\000\000 \004\000\004@\000\004\004\000\000\000\004\000\000\000\000 \004\000\004"}
#1 0x00007f03d2c0a751 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at /home/timofey_turenko_mariadb_com/MaxScale/maxutils/maxsimd/src/impl/simd_canonical.cc:36
No locals.
#2 _GLOBAL__sub_I_simd_canonical.cc(void) () at /home/timofey_turenko_mariadb_com/MaxScale/maxutils/maxsimd/src/impl/simd_canonical.cc:456
No locals.
#3 0x00007f03d30f59c3 in _dl_init_internal () from /lib64/ld-linux-x86-64.so.2
No symbol table info available.
#4 0x00007f03d30e717a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
No symbol table info available.
#5 0x0000000000000002 in ?? ()
No symbol table info available.
#6 0x00007ffcfb7208a0 in ?? ()
No symbol table info available.
#7 0x00007ffcfb7208a9 in ?? ()
No symbol table info available.
#8 0x0000000000000000 in ?? ()
No symbol table info available.



 Comments   
Comment by markus makela [ 2021-08-31 ]

This seems to be caused by static code being initialized regardless of the CPU type. Moving this code into a separate initialization routine that is called on startup should solve it.

Comment by Niclas Antti [ 2021-09-01 ]

At runtime the OS is apparently is reporting avx2 in /proc/cpuinfo. The E5-2660 cpu was a short-lived single core single thread xeon version that did not have avx2 although avx2 support started in 2011 for xeon processors. My guess is that the OS is reporting an incorrect flag. Since we rely on the OS to report the correct flags, there is not much we can do, apart from a config flag turning simd off. Another solution is for the customer to upgrade the hardware.

Comment by Edward Stoever [ 2021-09-25 ]

On Debian 10 Buster, I was getting this error in /var/log/messages:

Sep 24 20:04:55 mm2 kernel: [   14.115528] traps: maxscale[433] trap invalid opcode ip:7fa3f8bad752 sp:7fffdc174840 error:0 in libmaxscale-common.so.1.0.0[7fa3f8b81000+21e000]

When I use debian 9 Stretch, the error does not appear. My processor does not support avx2.

root@mx:~$ maxscale --version
MaxScale 6.1.1
root@mx:~$ cat /etc/*rele*| grep PRETTY
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
root@mx:~$

Generated at Thu Feb 08 04:23:41 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.