12.3-RELEASE GPU Hangs

From: Greg Balfour <greg.bal4_at_gmail.com>
Date: Thu, 27 Jan 2022 22:30:28 UTC
Ever since upgrading to 12.3-RELEASE I've been experiencing GPU Hangs
every 7 to 10 days.  Almost always associated with Firefox (from
ports) when either the Download for Print dialog windows are opened.
I had it hang once (Jan 19) when running vlc.

When it hangs the desktop is frozen.  I am able to ssh into the
machine and do a reboot when this happens.

Any clues as to what the issue is and how to resolve it?

Log messages and some config info below.

Jan  2 09:55:42 desktop kernel: [drm] GPU HANG: ecode 6:0:0x8588cffc,
in MainThread [100247], reason: Hang on rcs0, action: reset
Jan  2 09:55:42 desktop kernel: drmn0: Resetting chip after gpu hang
Jan  2 09:55:51 desktop syslogd: last message repeated 1 times
Jan  2 09:55:56 desktop kernel: drmn0: i915_reset_device timed out,
cancelling all in-flight rendering.

Jan 12 13:40:03 desktop kernel: [drm] GPU HANG: ecode 6:0:0x8588fff8,
in MainThread [100244], reason: Hang on rcs0, action: reset
Jan 12 13:40:03 desktop kernel: drmn0: Resetting chip after gpu hang
Jan 12 13:40:12 desktop syslogd: last message repeated 1 times
Jan 12 13:40:17 desktop kernel: drmn0: i915_reset_device timed out,
cancelling all in-flight rendering.

Jan 19 12:34:07 desktop kernel: drmn0: Resetting chip after gpu hang
Jan 19 12:34:12 desktop kernel: drmn0: i915_reset_device timed out,
cancelling all in-flight rendering.

Jan 27 15:54:58 desktop kernel: [drm] GPU HANG: ecode 6:0:0x8588fff8,
in MainThread [100258], reason: Hang on rcs0, action: reset
Jan 27 15:54:58 desktop kernel: drmn0: Resetting chip after gpu hang
Jan 27 15:55:07 desktop syslogd: last message repeated 1 times
Jan 27 15:55:12 desktop kernel: drmn0: i915_reset_device timed out,
cancelling all in-flight rendering.

---<<BOOT>>---
Copyright (c) 1992-2021 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.3-RELEASE r371126 GENERIC amd64
FreeBSD clang version 10.0.1 (git@github.com:llvm/llvm-project.git
llvmorg-10.0.1-0-gef32c611aa2)
VT(vga): resolution 640x480
CPU: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz (3392.37-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x206a7  Family=0x6  Model=0x2a  Stepping=7
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x1fbae3ff<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX>
  AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
  AMD Features2=0x1<LAHF>
  XSAVE Features=0x1<XSAVEOPT>
  VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID
  TSC: P-state invariant, performance statistics
real memory  = 17179869184 (16384 MB)
avail memory = 16503447552 (15738 MB)
Event timer "LAPIC" quality 600
ACPI APIC Table: <DELL   CBX3   >
FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs
FreeBSD/SMP: 1 package(s) x 4 core(s) x 2 hardware threads
...
vgapci0: <VGA-compatible display> port 0x3000-0x303f mem
0xe0c00000-0xe0ffffff,0xd0000000-0xdfffffff irq 16 at device 2.0 on
pci0
vgapci0: Boot video device
...
drmn0: <drmn> on vgapci0
vgapci0: child drmn0 requested pci_enable_io
vgapci0: child drmn0 requested pci_enable_io
[drm] Unable to create a private tmpfs mount, hugepage support will be
disabled(-19).
Failed to add WC MTRR for [0xd0000000-0xdfffffff]: -22; performance may suffer
[drm] Got stolen memory base 0xcba00000, size 0x4000000
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] Driver supports precise vblank timestamp query.
[drm] Connector VGA-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.VGA-1
[drm]   - kern.vt.fb.default_mode
[drm] Connector HDMI-A-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.HDMI-A-1
[drm]   - kern.vt.fb.default_mode
[drm] Connector DP-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.DP-1
[drm]   - kern.vt.fb.default_mode
[drm] Initialized i915 1.6.0 20171222 for drmn0 on minor 0
WARNING: Device "fb" is Giant locked and may be deleted before FreeBSD 14.0.
VT: Replacing driver "vga" with new "fb".
start FB_INFO:
type=11 height=768 width=1024 depth=32
cmsize=16 size=3145728
pbase=0xd0061000 vbase=0xfffff800d0061000
name=drmn0 flags=0x0 stride=4096 bpp=32
cmap[0]=0 cmap[1]=7f0000 cmap[2]=7f00 cmap[3]=c4a000
end FB_INFO
drmn0: fb0: inteldrmfb frame buffer device

And in /etc/rc.conf:
kld_list="/boot/modules/drm.ko /boot/modules/i915kms.ko"