Bug 285747 - graphics/drm-61-kmod: Freezes with AMD GPU
Summary: graphics/drm-61-kmod: Freezes with AMD GPU
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-x11 (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-29 18:21 UTC by Pero Oršolić
Modified: 2025-04-29 19:51 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (x11)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pero Oršolić 2025-03-29 18:21:05 UTC
I am on FreeBSD 14.2-RELEASE on my desktop PC with AMD 4750G Renoir GPU.

% freebsd -ku
14.2-RELEASE-p1
14.2-RELEASE-p2

% pkg info drm\*
drm-61-kmod-6.1.128.1402000_1

% uptime
 1:52PM  up 10 days, 16:26, 42 users, load averages: 7.02, 6.47, 6.42

% kldstat | grep -iE 'drm|amdgpu'
 8    1 0xffffffff83e00000   6878f0 amdgpu.ko
 9    2 0xffffffff83c13000    88082 drm.ko
15    1 0xffffffff83cbe000     64e0 amdgpu_renoir_sdma_bin.ko
16    1 0xffffffff83cc5000    2c2e0 amdgpu_renoir_asd_bin.ko
17    1 0xffffffff83cf2000     c4e0 amdgpu_renoir_ta_bin.ko
18    1 0xffffffff83cff000    1fbe8 amdgpu_renoir_dmcub_bin.ko
19    1 0xffffffff83d1f000     7560 amdgpu_renoir_pfp_bin.ko
20    1 0xffffffff83d27000     6560 amdgpu_renoir_me_bin.ko
21    1 0xffffffff83d2e000     4560 amdgpu_renoir_ce_bin.ko
22    1 0xffffffff83d33000     bcd8 amdgpu_renoir_rlc_bin.ko
23    1 0xffffffff83d3f000    43800 amdgpu_renoir_mec_bin.ko
24    1 0xffffffff83d83000    645a0 amdgpu_renoir_vcn_bin.ko

drm-kmod and gpu-firmware are compiled from ports.
All pkgs and system are up to the date.
System will freeze for seconds, later for minutes - mouse cursor will move but won't do anything, audio will play but video will stop, it would not be possible to switch alt-tab programs or do anything on the PC.
There is nothing related in /var/log/messages.
As the uptime grows, freezes will be longer and longer (5 minutes and longer is not unusual, measured personal record is 27 minutes), VM will stop working, audio too, keyboard and mouse won't react.
Sometimes problem occurs freshly after restart, sometimes days are needed for reproduction.
Same thing if picom is used or not.

Everything was working without problems for the past 5 years until few weeks ago. I think it started on 14.1, before 14.2-RELEASE upgrade, but I am not sure anymore (although I remember that I did upgraded all pkgs and rebooted after few months of uptime and then problem started).
Nothing has changed HW wise in years. RAM is healthy (according to memtest), ZFS doesn't report problems on NVMe nor SATA drives.

I did try to use drm-515 but that ends with kernel panic.
Rebuilding older drm-kmods from ports didn't help.

My problem seems similar to the https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284480 but there are no zpool scrubs involved.

Is there something I can do? This is making my system unusable (and having freezes of 5+ minutes every windows switch is not nice either)
Comment 1 Marek Zarychta 2025-03-29 18:36:34 UTC
Please try to apply this patch:
https://github.com/freebsd/freebsd-src/commit/718d1928f8748fe4429c011296f94f194d63c695
Comment 2 Pero Oršolić 2025-03-31 17:44:24 UTC
(In reply to Marek Zarychta from comment #1)
Thank you very much!
Patch is applied and for the past two days PC is working without issues
Comment 3 Marek Zarychta 2025-03-31 18:37:23 UTC
Thank you for the report. 
Please keep it open, perhaps it's worth errata. Let the bugmeister and others judge.
Comment 4 Pero Oršolić 2025-04-09 15:38:13 UTC
Unfortunately, applying that patch didn't fix the problem for me.
Freezes still occurs. I would say that they are less intense (10-ish seconds max), but I am just at 3 days of uptime.
They can start after 1 day of uptime (I would say even quicker) and it doesn't depend on RAM usage - it could be reproduced with more than half of 48GB RAM free, with all Firefox profiles closed.
Freezes will occur more often if mpv is playing video from (ZFS) disk.
When freeze occurs and goes away I noticed that in htop all bars will be fully red (indicating kernel activity). Standard top(1) will show that Xorg is using 100% of CPU for the brief moment of time.
Comment 5 Olivier Certner freebsd_committer freebsd_triage 2025-04-09 19:20:31 UTC
(In reply to bsd from comment #4)

Hi, after the applying the patch to your source tree, you must not only recompile the kernel and modules, but also the DRM module (drm-61-kmod in your case).  If you have a fancy install, please make sure that the proper ones are loaded (linuxkpi.ko for the base part).  Did you perform all these steps?
Comment 6 Pero Oršolić 2025-04-11 16:31:03 UTC
Hi, thanks!
I didn't recompile drm module.
Now I did and, after one day of uptime it seems okay, but we'll see, hoping for the best!

To be exact, these are the steps performed:
rm -rf /usr/obj/usr/src/amd64.amd64
cd /usr/src
make -j20 __MAKE_CONF=/dev/null SRCCONF=/dev/null buildkernel
make __MAKE_CONF=/dev/null SRCCONF=/dev/null installkernel
reboot

cd /usr/ports/graphics/drm-61-kmod
make clean deinstall install
reboot

pkg info drm-61-kmod-6.1.128.1402000_2                                                                                                                                                                                  drm-61-kmod-6.1.128.1402000_2
Name           : drm-61-kmod
Version        : 6.1.128.1402000_2
Installed on   : Thu Apr 10 20:45:24 2025 CEST
Origin         : graphics/drm-61-kmod
Architecture   : FreeBSD:14:amd64
Prefix         : /usr/local
Categories     : kld graphics
Licenses       : BSD2CLAUSE, MIT, GPLv2
Maintainer     : x11@FreeBSD.org
WWW            : https://github.com/freebsd/drm-kmod/
Comment        : DRM drivers modules
Annotations    :
        FreeBSD_version: 1402000
Flat size      : 17.2MiB
Description    :
amdgpu, i915, and radeon DRM drivers modules.
Currently corresponding to Linux 6.1 DRM.
This version is for FreeBSD 14-STABLE 1400508
and above.
Comment 7 Pero Oršolić 2025-04-29 19:51:33 UTC
After recompiling DRM kmod as described in comment 6 my system didn't experienced any graphics related issues after uptime of 13 days.
Keeping this PR open as suggested in comment 3.