btop: [BUG] rocm_smi_lib structs has changed on ROCm 6, causing segmentation fault
Describe the bug
The definition of struct rsmi_frequencies_t has changed on ROCm 6,
but Gpu::Rsmi::rsmi_frequencies_t is the ROCm 5.x one, causing segmentation fault.
( rsmi_frequencies_t of ROCm 6.0.0, rsmi_frequencies_t of ROCm 5.7.1 )
Fix seems simple: replace the definition;
but if need to check this on compile, maybe have to always #include <rocm_smi/rocm_smi.h> instead of #if defined(RSMI_STATIC)
Workaround: build and link the ROCm SMI library statically.
To Reproduce
- Install ROCm 6
- build btop with GPU support and without building and linking the ROCm SMI library statically
- run btop
Expected behavior
- work normally
Screenshots
[1] 157114 segmentation fault (core dumped) ./btop
Info (please complete the following information):
- btop++ version: 1.3.0
36842a3 - Binary: self compiled
- (If compiled) Compiler and version: g++ 11.4.0 & clang 17.0.4
- Architecture: x86_64
- Platform: Linux
- (Linux) Kernel: 6.5.0-1010-oem
- Terminal used: Konsole 22.04.3
- Font used: Noto Mono
Additional context
Contents of ~/.config/btop/btop.log
2024/01/08 (00:56:59) | ===> btop++ v.1.3.0
2024/01/08 (00:56:59) | WARNING: ROCm SMI: Failed to get maximum GPU power draw, defaulting to 225W
2024/01/08 (00:56:59) | WARNING: ROCm SMI: Failed to get maximum GPU temperature, defaulting to 110°C
2024/01/08 (00:56:59) | WARNING: ROCm SMI: Failed to get VRAM utilization
GDB Backtrace
(Extra helpful if compiled with make OPTFLAGS="-O0 -g")
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x0000000000000000 in ?? ()
(gdb)
Even with OPTFLAGS="-O0 -g"
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 11
- Comments: 16 (8 by maintainers)
@alerque Fixes included in release v1.3.1
@aristocratos I’ve tested the commit 5511131 and made some further changes at #737 , after applying these changes it seems to work on my setup.
@romner-set
Yeah, I realized when I started looking at the code, had forgotten.
I don’t think it’s a big issue yet. The only difference between version 5 and 6 for the functionality we use were only an added bool in a struct. As long as they stick with only breaking ABI between major versions I don’t mind adding some branches when needed.
And the code I added will disable AMD gpu support instead of crashing if using an unsupported ROCm version, unless in the unlikely case that they change the definition for
rsmi_version_get()…We just had to disable GPU support entirely in btop on Arch Linux because ROCM6 shipped before a release was cut with this fix. I’ll re-enable it as soon as a release is cut.
This is immanently about to break
btopon a bunch of distros. Because of the way it is compiled where it isn’t even linked to the ROCm libraries but does try to load them at runtime if found, thebtoppackages are not even getting marked to be rebuilt and tested with ROCm 6 — which is about to land in several distros. This will break the existingbtopbinaries as currently installed.I think some sort of defensive move needs to happen soon. Either it needs to be made compatible with the v6 API so it can run or at least the version needs to be checked for compatibly and ignored if it is not compatible so at least it doesn’t crash.