Bug 264206 - graphics/drm-fbsd13-kmod: System panic setting sysctl hw.dri.0.vblank=1 - page fault (drm_vblank_info -> sysctl_root_handler_locked)
Summary: graphics/drm-fbsd13-kmod: System panic setting sysctl hw.dri.0.vblank=1 - pag...
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-x11 (Nobody)
URL:
Keywords: crash, needs-qa
Depends on:
Blocks:
 
Reported: 2022-05-24 16:08 UTC by Ed Silva
Modified: 2022-05-25 14:42 UTC (History)
3 users (show)

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


Attachments
panic console output (134.77 KB, image/png)
2022-05-25 14:12 UTC, Ed Silva
no flags Details
sysctl.conf (2.06 KB, text/plain)
2022-05-25 14:20 UTC, Ed Silva
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Silva 2022-05-24 16:08:49 UTC
I am using an older ATI card, using the latest drm-fbsd13-kmod version
'sysctl hw.dri.0.vblank' causes a kernel panic. 

I managed to capture a screenshot of the console before the system, it is attached.


These are the kernel modules loaded:

root@r720 ~# kldstat
Id Refs Address                Size Name
 1  111 0xffffffff80200000  1f30590 kernel
 2    1 0xffffffff82131000    94d10 t4fw_cfg.ko
 3    1 0xffffffff821c6000    c23b8 t6fw_cfg.ko
 4    1 0xffffffff82289000    b5318 t5fw_cfg.ko
 5    1 0xffffffff8233f000    13408 ipmi.ko
 6    2 0xffffffff82353000     4508 smbus.ko
 7    1 0xffffffff82358000     af68 cryptodev.ko
 8    1 0xffffffff82363000    22910 if_oce.ko
 9    1 0xffffffff82386000     43b8 pflog.ko
10    2 0xffffffff8238b000    785e0 pf.ko
11    1 0xffffffff82404000   5ec1d8 zfs.ko
12    1 0xffffffff829f1000    f32b8 if_cxgbe.ko
13    1 0xffffffff82ae6000    3fc98 mps.ko
14    1 0xffffffff82b26000     3d58 coretemp.ko
15    1 0xffffffff82ee8000   150c70 radeonkms.ko
16    2 0xffffffff83039000    7e020 drm.ko
17    3 0xffffffff830b8000     cbc8 linuxkpi_gplv2.ko
18    1 0xffffffff830c5000     e778 ttm.ko
19    1 0xffffffff830d4000     3378 acpi_wmi.ko
20    1 0xffffffff830d8000     8d38 ioat.ko
21    1 0xffffffff830e1000     2340 uhid.ko
22    1 0xffffffff830e4000     3380 usbhid.ko
23    1 0xffffffff830e8000     31f8 hidbus.ko
24    1 0xffffffff830ec000     4350 ums.ko
25    1 0xffffffff830f1000     2a08 mac_ntpd.ko

This is the drm related dmesg output:

[95] <6>[drm] radeon kernel modesetting enabled.
[95] drmn1: <drmn> numa-domain 1 on vgapci1
[95] vgapci1: child drmn1 requested pci_enable_io
[95] vgapci1: child drmn1 requested pci_enable_io
[95] sysctl_warn_reuse: can't re-use a leaf (hw.dri.debug)!
[95] <6>[drm] initializing kernel modesetting (CAICOS 0x1002:0x6778 0x1028:0x2120 0x00).
[96] [drm ERROR :radeon_atombios_init] Unable to find PCI I/O BAR; using MMIO for ATOM IIO
[96] ATOM BIOS: C26411
[96] <6>[drm] GPU not posted. posting now...
[96] drmn1: VRAM: 1024M 0x0000000000000000 - 0x000000003FFFFFFF (1024M used)
[96] drmn1: GTT: 1024M 0x0000000040000000 - 0x000000007FFFFFFF
[96] Successfully added WC MTRR for [0x3bff0000000-0x3bfffffffff]: 0;
[96] <6>[drm] Detected VRAM RAM=1024M, BAR=256M
[96] <6>[drm] RAM width 64bits DDR
[96] [TTM] Zone  kernel: Available graphics memory: 67054486 KiB
[96] [TTM] Zone   dma32: Available graphics memory: 2097152 KiB
[96] [TTM] Initializing pool allocator
[96] <6>[drm] radeon: 1024M of VRAM memory ready
[96] <6>[drm] radeon: 1024M of GTT memory ready.
[96] <6>[drm] Loading CAICOS Microcode
[96] drmn1: could not load firmware image 'radeon/CAICOS_pfp.bin'
[96] ni_cp: Failed to load firmware "radeon/CAICOS_pfp.bin"
[96] [drm ERROR :evergreen_init] Failed to load firmware!
[96] drmn1: Fatal error during GPU init
[96] <6>[drm] radeon: finishing device.
[96] [TTM] Finalizing pool allocator
[96] [TTM] Zone  kernel: Used memory at exit: 0 KiB
[96] [TTM] Zone   dma32: Used memory at exit: 0 KiB
[96] <6>[drm] radeon: ttm finalized
[96] Warning: can't remove non-dynamic nodes (dri)!
[96] device_attach: drmn1 attach returned 2

This is the hardware being used:

vgapci1@pci0:67:0:0:	class=0x030000 rev=0x00 hdr=0x00 vendor=0x1002 device=0x6778 subvendor=0x1028 subdevice=0x2120
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Caicos XT [Radeon HD 7470/8470 / R5 235/310 OEM]'
    class      = display
    subclass   = VGA
Comment 1 Ed Silva 2022-05-24 16:16:04 UTC
(In reply to Ed Silva from comment #0)

This is the screenshot of the panic:

https://flic.kr/p/2nny3DS
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2022-05-25 00:37:46 UTC
@Reporter Thank you for your report. Could you please include additional information:

- exact uname -a output
- /etc/sysctl.conf contents (as an attachment)
- pkg info drm-fbsd13-kmod (output as an attachment)
- Include screenshot mentioned in comment 1 as an attachment

If you're able to configure a debug kernel and kernel core dumps [1] to obtain a detailed backtrace, that would be great

[1] https://docs.freebsd.org/en/books/developers-handbook/kerneldebug/
Comment 3 Emmanuel Vadot freebsd_committer freebsd_triage 2022-05-25 09:26:22 UTC
Your first problem is that you don't have the needed firmware, pkg install gpu-firmware-radeon-kmod-caicos should fix the attach problem.
The second one is that somewhere in drm they leave some variable uninit and we panic when we try to access them. This is fixed in 5.10 and tbh bisecting which changed is needed to fix this in 5.4 is too complicated.
Comment 4 Ed Silva 2022-05-25 14:12:13 UTC
uname-a:
FreeBSD r720.edlitmus.info 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64

pkg install gpu-firmware-radeon-kmod-caicos did not fix the issue, the panic still occurs when calling 'sysctl hw.dri.0.vblank'.
Comment 5 Ed Silva 2022-05-25 14:12:36 UTC
Created attachment 234209 [details]
panic console output
Comment 6 Ed Silva 2022-05-25 14:13:24 UTC
(In reply to Kubilay Kocak from comment #2)
I will try to work on a debug kernel this week.
Comment 7 Ed Silva 2022-05-25 14:20:53 UTC
Created attachment 234210 [details]
sysctl.conf
Comment 8 Emmanuel Vadot freebsd_committer freebsd_triage 2022-05-25 14:38:38 UTC
(In reply to Ed Silva from comment #4)
You're likely still missing a firmware and radeonkms didn't attached.
Comment 9 Ed Silva 2022-05-25 14:42:38 UTC
After installing gpu-firmware-radeon-kmod-btc this issue went away.

I feel like while my issue is resolved, this maybe should still be an open bug, but I will defer to the judgement of others.

Please feel free to close this.