Solved FreeBSD upgraded from 11.3 to 11.4 - now the machine crashes if I load the radeonkms module

tingo

Son of Beastie

Reaction score: 643
Messages: 2,549

So I upgrade my main workstation from FreeBSD 11.3 (FreeBSD 11.3-release-p14) to 11.4 (FreeBSD 11.4-release-p4) today.
Code:
root@kg-core2# freebsd-version -ku
11.4-RELEASE-p3
11.4-RELEASE-p4
root@kg-core2# uname -a
FreeBSD kg-core2.kg4.no 11.4-RELEASE-p3 FreeBSD 11.4-RELEASE-p3 #0: Tue Sep  1 08:22:33 UTC 2020     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
Unfortunately, after the upgrade the machine crashes if I try to load the radeonkms module (/boot/modules/radonkms.ko), and puts this in /var/log/messages:
Code:
[drm] radeon kernel modesetting enabled.
drmn0: <drmn> on vgapci0
vgapci0: child drmn0 requested pci_enable_io
vgapci0: child drmn0 requested pci_enable_io
[drm] initializing kernel modesetting (CAICOS 0x1002:0x677B 0x1462:0x8099 0x00).
[drm] register mmio base: 0xFCE20000
[drm] register mmio size: 131072
[drm:radeon_device_init] Unable to find PCI I/O BAR
[drm:radeon_atombios_init] Unable to find PCI I/O BAR; using MMIO for ATOM IIO
ATOM BIOS: 113
drmn0: VRAM: 2048M 0x0000000000000000 - 0x000000007FFFFFFF (2048M used)
drmn0: GTT: 1024M 0x0000000080000000 - 0x00000000BFFFFFFF
[drm] Detected VRAM RAM=2048M, BAR=256M
[drm] RAM width 64bits DDR
[TTM] Zone  kernel: Available graphics memory: 33512064 kiB
[TTM] Zone   dma32: Available graphics memory: 2097152 kiB
[TTM] Initializing pool allocator


Fatal trap 12: page fault while in kernel mode
cpuid = 3; apic id = 03
fault virtual address   = 0xfffffe62919678d8
fault code              = supervisor read data, page not present
instruction pointer     = 0x20:0xffffffff82602882
stack pointer           = 0x28:0xfffffe104d48af10
frame pointer           = 0x28:0xfffffe104d48af30
code segment            = base 0x0, limit 0xfffff, type 0x1b
                       = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 100 (kldload)
trap number             = 12
panic: page fault
cpuid = 3
KDB: stack backtrace:
#0 0xffffffff80b43105 at kdb_backtrace+0x65
#1 0xffffffff80afd20e at vpanic+0x15e
#2 0xffffffff80afd0a3 at panic+0x43
#3 0xffffffff80f75fc5 at trap_fatal+0x365
#4 0xffffffff80f76019 at trap_pfault+0x49
#5 0xffffffff80f756ce at trap+0x27e
#6 0xffffffff80f5545f at calltrap+0x8
#7 0xffffffff82611e6c at reservation_object_wait_timeout_rcu+0x6c
#8 0xffffffff826238f8 at ttm_bo_wait+0x48
#9 0xffffffff824f109d at radeon_bo_move+0x2d
#10 0xffffffff82624f4e at ttm_bo_handle_move_mem+0x1ce
#11 0xffffffff82621e04 at ttm_bo_validate+0xd4
#12 0xffffffff8262228a at ttm_bo_init+0x37a
#13 0xffffffff824e54e1 at radeon_bo_create+0x1a1
#14 0xffffffff824efc5f at radeon_ttm_init+0x21f
#15 0xffffffff82473fc3 at evergreen_init+0x103
#16 0xffffffff824cc8f5 at radeon_device_init+0xd15
#17 0xffffffff824ddf2c at radeon_driver_load_kms+0x13c
Uptime: 1s
I checked if there were any updates to the relevant packages - nope. The relevant packages are
Code:
root@kg-core2# pkg info drm*
drm-fbsd11.2-kmod-4.11g20200420
drm-kmod-g20190710
drm_info-2.2.0_1
root@kg-core2# pkg info gpu*
gpu-firmware-kmod-g20200503
So no console output and no graphics output on my main workstation now. Some days it is just hard to be a FreeBSD user.
 
OP
T

tingo

Son of Beastie

Reaction score: 643
Messages: 2,549

No worries, I can still use my FreeBSD 12 partition, right? I abandonded that when FreeBSD 12.0-release-p3 was still fresh, because it was instable and would crash (core dump) every few hours if I had a few applications open (even if I was not using them). So, spend a few hours with freebsd-update and I got it upgraded
Code:
root@kg-core2# freebsd-version -ku
12.1-RELEASE-p10
12.1-RELEASE-p10

root@kg-core2# uname -a
FreeBSD kg-core2.kg4.no 12.1-RELEASE-p10 FreeBSD 12.1-RELEASE-p10 GENERIC  amd64
a few more hours, and the packages was updated too. The relevant packages are
Code:
root@kg-core2# pkg info drm* gpu*
drm-fbsd12.0-kmod-4.16.g20200221
drm-kmod-g20190710
gpu-firmware-kmod-g20200503
So, the good news are that I can load the radeonkms module and the machine doesn't crash. It doesn't crash when I run startx or startxfce4 either - more good news. Unfortunately, as soon as I start a browser (I've only tried iridium and firefox) the machine core dumps, this is what it puts in /var/log/mesages
Code:
Oct  3 23:03:54 kg-core2 kernel: Fatal trap 12: page fault while in kernel mode
Oct  3 23:03:54 kg-core2 kernel: cpuid = 9; apic id = 0b
Oct  3 23:03:54 kg-core2 kernel: fault virtual address  = 0xc0
Oct  3 23:03:54 kg-core2 kernel: fault code             = supervisor read data, page not present
Oct  3 23:03:54 kg-core2 kernel: instruction pointer    = 0x20:0xffffffff829af627
Oct  3 23:03:54 kg-core2 kernel: stack pointer          = 0x28:0xfffffe00c0e7a860
Oct  3 23:03:54 kg-core2 kernel: frame pointer          = 0x28:0xfffffe00c0e7a890
Oct  3 23:03:54 kg-core2 kernel: code segment           = base 0x0, limit 0xfffff, type 0x1b
Oct  3 23:03:54 kg-core2 kernel:                        = DPL 0, pres 1, long 1, def32 0, gran 1
Oct  3 23:03:54 kg-core2 kernel: processor eflags       = interrupt enabled, resume, IOPL = 0
Oct  3 23:03:54 kg-core2 kernel: current process                = 0 (linuxkpi_short_wq_1)
Oct  3 23:03:54 kg-core2 kernel: trap number            = 12
Oct  3 23:03:54 kg-core2 kernel: panic: page fault
Oct  3 23:03:54 kg-core2 kernel: cpuid = 9
Oct  3 23:03:54 kg-core2 kernel: time = 1601758979
Oct  3 23:03:54 kg-core2 kernel: KDB: stack backtrace:
Oct  3 23:03:54 kg-core2 kernel: #0 0xffffffff80c1d207 at kdb_backtrace+0x67
Oct  3 23:03:54 kg-core2 kernel: #1 0xffffffff80bd053d at vpanic+0x19d
Oct  3 23:03:54 kg-core2 kernel: #2 0xffffffff80bd0393 at panic+0x43
Oct  3 23:03:54 kg-core2 kernel: #3 0xffffffff810a8dcc at trap_fatal+0x39c
Oct  3 23:03:54 kg-core2 kernel: #4 0xffffffff810a8e19 at trap_pfault+0x49
Oct  3 23:03:54 kg-core2 kernel: #5 0xffffffff810a840f at trap+0x29f
Oct  3 23:03:54 kg-core2 kernel: #6 0xffffffff8108221c at calltrap+0x8
Oct  3 23:03:54 kg-core2 kernel: #7 0xffffffff82a18dfc at ttm_bo_man_put_node+0x3c
Oct  3 23:03:54 kg-core2 kernel: #8 0xffffffff82a173bb at ttm_bo_cleanup_refs+0x22b
Oct  3 23:03:54 kg-core2 kernel: #9 0xffffffff82a164ea at ttm_bo_delayed_delete+0x1aa
Oct  3 23:03:54 kg-core2 kernel: #10 0xffffffff82a166ea at ttm_bo_delayed_workqueue+0x1a
Oct  3 23:03:54 kg-core2 kernel: #11 0xffffffff829f9e94 at linux_work_fn+0xf4
Oct  3 23:03:54 kg-core2 kernel: #12 0xffffffff80c2f9e4 at taskqueue_run_locked+0x154
Oct  3 23:03:54 kg-core2 kernel: #13 0xffffffff80c30d18 at taskqueue_thread_loop+0x98
Oct  3 23:03:54 kg-core2 kernel: #14 0xffffffff80b90b53 at fork_exit+0x83
Oct  3 23:03:54 kg-core2 kernel: #15 0xffffffff8108325e at fork_trampoline+0xe
Oct  3 23:03:54 kg-core2 kernel: Uptime: 10m37s
Some days it is just really hard to be a FreeBSD user.
 

Alexander88207

Aspiring Daemon

Reaction score: 529
Messages: 755

Hello,

have you already tried to build your drivers against the source of 11.4?

Many people had the same problem with drm-kmod after the upgrading from 12.0 to 12.1 because it was still build for 12.0.
 
OP
T

tingo

Son of Beastie

Reaction score: 643
Messages: 2,549

have you already tried to build your drivers against the source of 11.4?

Many people had the same problem with drm-kmod after the upgrading from 12.0 to 12.1 because it was still build for 12.0.
No, I haven't done that yet. Now that you mention it, I remember reading about that.
What's the easiest way of getting sources on my machine, and make those sources match the kernel I have?
(it is Sunday, I'm lazy today)
 

Alexander88207

Aspiring Daemon

Reaction score: 529
Messages: 755

No, I haven't done that yet. Now that you mention it, I remember reading about that.
What's the easiest way of getting sources on my machine, and make those sources match the kernel I have?
(it is Sunday, I'm lazy today)

svnlite checkout https://svn.freebsd.org/base/releng/11.4 /usr/src to fetch the source from 11.4-RELEASE.

Then remove the drm-kmod package, after that do pkg autoremove this should remove the drm-fbsd and gpu firmware packages because drm-kmod is only a meta port.

If everything is now deleted go to /usr/ports/graphics/drm-kmod and do make install clean.
 
OP
T

tingo

Son of Beastie

Reaction score: 643
Messages: 2,549

Ok, status for 11.4: I removed the drm* and gpu* packages, and rebuilt them from ports as described by Alexander88207 . Result: the machine no longer crashes when I load the radeonkms module. In fact, everything seems to be working (knock on wood - the machine only has been up for about an hour, but I am hopeful) like before the upgrade.
 
OP
T

tingo

Son of Beastie

Reaction score: 643
Messages: 2,549

The machine has been up more than a day now, I declare this solved.
Code:
root@kg-core2# date;uptime
Mon Oct  5 20:10:51 CEST 2020
 8:10PM  up 1 day,  5:04, 4 users, load averages: 1.70, 1.29, 1.04
 
Top