Bug 1219684 - Illegal instruction in mariadb on VisionFive2
Summary: Illegal instruction in mariadb on VisionFive2
Status: RESOLVED DUPLICATE of bug 1222395
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Kernel (show other bugs)
Version: Current
Hardware: RISC-V Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: openSUSE Kernel Bugs
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-07 19:58 UTC by Felix Niederwanger
Modified: 2024-07-18 12:50 UTC (History)
3 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
coredump (426.53 KB, application/gzip)
2024-02-07 19:58 UTC, Felix Niederwanger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Niederwanger 2024-02-07 19:58:56 UTC
Created attachment 872555 [details]
coredump

Running MariaDB on a Starfive VisionFive2 board results in an illegal instruction when starting the server process.

>            PID: 20389 (mariadbd)
>            UID: 0 (root)
>            GID: 0 (root)
>         Signal: 4 (ILL)
>      Timestamp: Wed 2024-02-07 19:51:55 UTC (2min 42s ago)
>   Command Line: /usr/sbin/mariadbd --defaults-file=/etc/my.cnf --lc-messages=en_US --bootstrap --silent-startup --basedir=/usr --datadir=/srv/mariadb --log-warnings=0 --enforce-storage-engine= --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysql/mysqld.log --max_allowed_packet=8M --net_buffer_length=16K
>     Executable: /usr/sbin/mariadbd
>  Control Group: /user.slice/user-0.slice/session-8.scope
>           Unit: session-8.scope
>          Slice: user-0.slice
>        Session: 8
>      Owner UID: 0 (root)
>        Boot ID: b63d1de236674af2b1eb326a79f059ee
>     Machine ID: 0ea98dae415c43249f83b5e8a77e5726
>       Hostname: archon.home
>        Storage: /var/lib/systemd/coredump/core.mariadbd.0.b63d1de236674af2b1eb326a79f059ee.20389.1707335515000000.zst (present)
>   Size on Disk: 360.5K
>        Message: Process 20389 (mariadbd) of user 0 dumped core.
>                 
>                 Stack trace of thread 20389:
>                 #0  0x0000002abd97fa4e my_timer_init (mariadbd + 0xd14a4e)
>                 #1  0x0000002abd2e7d0e _Z11mysqld_mainiPPc (mariadbd + 0x67cd0e)
>                 #2  0x0000003fbc0d1668 __libc_start_call_main (libc.so.6 + 0x2b668)
>                 #3  0x0000003fbc0d1710 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x2b710)
>                 #4  0x0000002abd2ae890 _start (mariadbd + 0x643890)
>                 ELF object binary architecture: RISC-V

I'm also attaching the core dump of the failing process.

Currently running Tumbleweed 20240205 and started with the openSUSE-Tumbleweed-RISC-V-JeOS-starfivevisionfive2.riscv64-2024.01.16-Build23.10.raw.xz image from https://en.opensuse.org/HCL:VisionFive2.
Comment 1 Felix Niederwanger 2024-02-19 08:41:16 UTC
After some investigation, it looks like that the issue could come from a yet incomplete implementation of the timer in the kernel [1, 2].

I could trace the SIGILL back to the RDCYCLE instruction in gdb:

> #0  0x0000002aab7bea4e in my_timer_init ()
> #1  0x0000002aab126d0e in mysqld_main(int, char**) ()
> #2  0x0000003ff7655668 in __libc_start_call_main () from /lib64/lp64d/libc.so.6
> #3  0x0000003ff7655710 in __libc_start_main_impl () from /lib64/lp64d/libc.so.6
> #4  0x0000002aab0ed890 in _start ()
> 
> 0x0000002aab7bea4e <my_timer_init+52>  rdcycle a5

This pseudoinstructions is part of the Zicntr extension [3] and by first look it looks like a rather basic extension that should be supported (subjunctive!).

So, I think the issue arises from a yet incomplete implementation of the timer function in the kernel, but this assessment is coming from someone without real expertise in the RISC-V domain. Perhaps someone else could have a look and confirm/deny my hypothesis?

Thanks!

[1] https://rvspace.org/en/project/JH7110_Upstream_Plan
[2] https://lore.kernel.org/all/20231219145402.7879-3-xingyu.wu@starfivetech.com/
[3] https://riscv.org/wp-content/uploads/2019/12/riscv-spec-20191213.pdf
Comment 2 Matthias Brugger 2024-07-18 12:50:10 UTC
Works fine with latest tumblweed, please see
https://bugzilla.suse.com/show_bug.cgi?id=1222395

*** This bug has been marked as a duplicate of bug 1222395 ***