nvtop icon indicating copy to clipboard operation
nvtop copied to clipboard

Crash on FreeBSD 14.1 with LinuxKPI DRM 5.15.160

Open vedranmiletic opened this issue 1 year ago • 3 comments

After adding #ifndef __FreeBSD__/#endif pairs around sys/sysmacros.h includes, I am glad to say that nvtop compiles on FreeBSD. However, it crashes on startup:

# uname -aKU
FreeBSD amdgpu-testserver 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 1401000 1401000
# gdb ./src/nvtop
GNU gdb (GDB) 14.1 [GDB v14.1 for FreeBSD]
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd14.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./src/nvtop...
(gdb) run
Starting program: /home/vedran/workspace/nvtop/build/src/nvtop

Program received signal SIGSEGV, Segmentation fault.
Address not mapped to object.
0x00000008002bd7b7 in udev_device_ref () from /usr/local/lib/libudev.so.0
(gdb) backtrace
#0  0x00000008002bd7b7 in udev_device_ref () from /usr/local/lib/libudev.so.0
#1  0x00000000002242a5 in nvtop_device_ref (device=0x0) at /home/vedran/workspace/nvtop/src/device_discovery_linux.c:49
#2  0x0000000000224e3e in nvtop_device_get_hwmon (dev=0x800c10380) at /home/vedran/workspace/nvtop/src/device_discovery_linux.c:347
#3  0x0000000000226bf7 in initDeviceSysfsPaths (gpu_info=0x800c4b000) at /home/vedran/workspace/nvtop/src/extract_gpuinfo_amdgpu.c:331
#4  0x0000000000225b6e in gpuinfo_amdgpu_get_device_handles (devices=0x7fffffffea90, count=0x7fffffffe934)
at /home/vedran/workspace/nvtop/src/extract_gpuinfo_amdgpu.c:468
#5  0x000000000021b83a in gpuinfo_init_info_extraction (monitored_dev_count=0x7fffffffeaa4, devices=0x7fffffffea90)
at /home/vedran/workspace/nvtop/src/extract_gpuinfo.c:67
#6  0x000000000020c7e7 in main (argc=1, argv=0x7fffffffeb98) at /home/vedran/workspace/nvtop/src/nvtop.c:197

I would be glad to fix this myself, but would require some pointers what could be the issue and where to start looking.

vedranmiletic avatar Jul 24 '24 11:07 vedranmiletic

Hello, I pushed a patch that should fix your issue

Syllo avatar Jul 29 '24 11:07 Syllo

Hello, I pushed a patch that should fix your issue

Indeed, there is no more segfault, now it fails with:

Assertion failed: (gpu_info->hwmonDevice != NULL), function initDeviceSysfsPaths, file /home/vedran/workspace/nvtop/src/extract_gpuinfo_amdgpu.c, line332.
Abort (core dumped)

Any chance for proper FreeBSD support? FWIW, radeontop supports it, but nvtop is fancier and would be really nice to have.

vedranmiletic avatar Jul 29 '24 18:07 vedranmiletic

The issue you are having should be resolved after I merge #308 for another issue. Without hwmon, the fan speed and critical temperatures won't be available though.

Syllo avatar Jul 30 '24 09:07 Syllo